Trainer.test() stops on missing definitions of train & validation dataloaders methods.
Steps to reproduce the behavior:
Trainer.fit(...) methodTrainer.test(...) methodtest failes on :
~python
'No train_dataloader() method defined. Lightning Trainer expects as minimum a'
pytorch_lightning.utilities.exceptions.MisconfigurationException: No train_dataloader() method defined. Lightning Trainer expects as minimum a training_step(), training_dataloader() and configure_optimizers() to be defined.
~
~python
test_data = data_loader(...)
estimator = MyEstimator.load_from_checkpoint(checkpoint_path=CKPT_PATH)
trainer = pl.Trainer(...)
trainer.test(model=estimator, test_dataloaders=test_data)
~
Run the test with provided test data loader, and do not stop on condition related to missing train & validation dataloaders which actually are not mandatory.
~~~
Hi! thanks for your contribution!, great first issue!
This issue relates to #1195, fit and test should be decoupled. Is there any consensus or proposition of further steps?
Also, using trainer.test(model) on loaded checkpoint doesn't work without explicitly passing test_dataloader parameter even if all *_dataloader methods are defined. Example.
This use case isn't documented in the 0.7.5 documentation but evidently was relevant at some point: https://pytorch-lightning.readthedocs.io/en/latest/test_set.html#test-pre-trained-model.
I suggest to either:
trainer.test(model) without specifying test_dataloader parameter. After all, what's the point of defining Model.test_dataloader method?@iakremnev can you fix the link? It's asking for request access.
@rohitgr7 oops, fixed it.
it is the same as #1754