Is the use of data methods on LightningModule standard? #7227
-
It took me quite some time playing with PyTorch Lightning and reading through the docs before I realized I can attach the data-related methods ( |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi, could you explain what you mean by
Do you mean dynamically bind the dataloader method of datamodule to lightning module? I recommend passing the datamodule/dataloader into the fit function like so: trainer.fit(model, datamodule=datamodule)
# or
trainer.fit(model, train_dataloader=...) Then it will be clear to any reader that the datamodule loaders are used for training. |
Beta Was this translation helpful? Give feedback.
Hi, could you explain what you mean by
Do you mean dynamically bind the dataloader method of datamodule to lightning module?
I would not personally recommend that because it can be harder to read and debug, especially if your LightningModule also defines dataloader methods that you may expect to run in a different context.
I recommend passing the datamodule/dataloader into the fit function like so:
Then it will be clear to any reader that the datamodule loaders are used for training.