test_dataloader
must be implemented to be used with the Lightning Trainer
#18274
Replies: 2 comments 6 replies
-
I'm new to PyTorch Lightning, so I have a simple question from what I've quickly skimmed on their documentation/guide for validating and testing a model. Thanks for the post; I'm learning more ways to modularize my old PyTorch code by reading your post and going to the guide. Where do you tell the Trainer what LightningDataModule (LDM) to use? As far as I can tell, you don't give the Trainer a reference to a LDM in the provided code. Is there some place you pass it in before the |
Beta Was this translation helpful? Give feedback.
-
Hi @changspencer and @JustinGoheen , Thanks for your inputs! Stupid mistake from my end... As you said @changspencer, I don't pass the datamodule to my Trainer when calling the .test() method. My main code before the fix:
My main code after the fix:
Giving the datamodule to the test() method solved my error. I got mislead by this part of the lightning documentation: There is no way to pass a datamodule or model to the Trainer at instantiation. So I don't see how it would work doing it like the doc says. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I am getting the following error:
Although as shown below my test_dataloader is correctly implemented:
I switched from pytorch-lightning to lightning 2.0.6 as i appeared as a solution in a couple of online forum threads, but it didn't work for me. Downgrading to lightning 2.0.0 didn't fix anything neither.
Here is my LightningModule:
Beta Was this translation helpful? Give feedback.
All reactions