You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This leads to some confusing logic for both users and the framework over how to access the dataloaders being used. Currently, the LightningModule and DataModule are treated completely independently. Both are passed as arguments to the trainer like so:
One issue that arises is when the model needs to know about the dataloader. This has come up recently with LR schedulers. Currently, users have to reach into the trainer to get the instance:
self.trainer.datamodule.get_train_dataloader()
or
self.trainer.train_dataloader
But these are not obvious and may not be guaranteed to work at all call times.
In the former, a datamodule might not be used at all.
In the latter, the train dataloader might not be instantiated for reference.
I think this approach could simplify both of these, while still providing good modularity and encapsulation.
Note: this would not be a requirement for how to use these components. This would only be a recommendation, especially for users looking to organize their code.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Data has multiple potential sources
This leads to some confusing logic for both users and the framework over how to access the dataloaders being used. Currently, the LightningModule and DataModule are treated completely independently. Both are passed as arguments to the trainer like so:
One issue that arises is when the model needs to know about the dataloader. This has come up recently with LR schedulers. Currently, users have to reach into the trainer to get the instance:
or
But these are not obvious and may not be guaranteed to work at all call times.
In the former, a datamodule might not be used at all.
In the latter, the train dataloader might not be instantiated for reference.
I think this approach could simplify both of these, while still providing good modularity and encapsulation.
Note: this would not be a requirement for how to use these components. This would only be a recommendation, especially for users looking to organize their code.
Changes to LightningModule
Intended use case:
we can even enable this with already instantiated dataloaders for a consistent experience
Why not do this?
Nothing prevents users from doing this already! We absolutely don't need API changes to enable this.
So should we do anything? One option would be to document this usage as a style guide
Beta Was this translation helpful? Give feedback.
All reactions