Pytorch-lightning: How can I perform only validation without training

Created on 3 Jul 2020  ·  7Comments  ·  Source: PyTorchLightning/pytorch-lightning

❓ Questions and Help

It seems the metric 0.8737 in the checkpoint 'm10-f1_1=0.8737.ckpt' can not be found in progress_bar,
I want to load the .ckpt to perform validation without training,
How should I config the trainer?

question won't fix

Most helpful comment

I think we need to wait for #2107 for this to be possible. evaluate() would have to be different from the validation loop that runs during training, for example, it should not invoke callbacks like early stopping or checkpointing.

All 7 comments

The progress bar averages the values over time.
To test your model on the validation set you can do

model = ...
trainer = Trainer(...)
trainer.test(model, ckpt_path="path/to/m10-f1_1=0.8737.ckpt", test_dataloaders=model.val_dataloader())

I'm afraid not. This code does not call validation_ step() and validation_ epoch_ end() and it can not calc the metric either

You need to implement test_step and test_epoch end. If testing does not differ from your validation, you can just call validstion_step from test_step.

@awaelchli What if they(testing and validation procedures) are different or don't have any test_step or test_epoch_end or just want to use test_step and test_epoch_end to save the outputs of the model in a file. I suggest there should be something like .evaluate() or .validate() just for validation_step and validation_epoch_end with a same api as that of .test(). Thoughts??

I think we need to wait for #2107 for this to be possible. evaluate() would have to be different from the validation loop that runs during training, for example, it should not invoke callbacks like early stopping or checkpointing.

I thought its not allowed? I remember seeing it here

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iakremnev picture iakremnev  ·  3Comments

as754770178 picture as754770178  ·  3Comments

srush picture srush  ·  3Comments

williamFalcon picture williamFalcon  ·  3Comments

polars05 picture polars05  ·  3Comments