-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move reload_dataloaders_every_n_epochs to the DataHooks class #8738
Comments
Hi, @ananthsub Can I work on this issue? Thank you~ |
Hi, @ananthsub For this issue, I will do the migration of |
One thing I'm not sure is if we still want to keep |
I think it makes sense to be moved into the loops directly. the property is already private it's already private, and this way we can continue whittling down what's exposed on trainer properties. we could have a mini helper function to share across fit and evaluation loops if necessary @awaelchli @tchaton @carmocca what do you think? it's somewhat related to #8946 |
Hey @ananthsub, I think it is fine to move And I believe it would be worth to explore better scheduling mechanism owned by the DataModule.
|
🚀 Feature
Motivation
We are auditing the Lightning components and APIs to assess opportunities for improvements:
reload_dataloaders_every_n_epochs
is an argument to the Trainer constructor. However, this could be a property of the DataHooks class, instead of the trainer, as whether to initiate reloading the dataloading every n epochs should be determined by the actor providing the dataloaders (e.g. the LightningModule or LightningDataModule).This is very similar to #8733 and how automatic/manual optimization is a property of the LightningModule. That property also started out as a trainer argument before being migrated to the lightning module. Since this pattern keeps occurring, we should separately understand why it's so appealing to add things to the trainer constructor instead of a more specific component.
Moreover, this one setting controls dataloader behavior for both train & val dataloaders. Do we need more granular control? Do we need two properties, one for training and one for validation? This could make sense as we could have very different epoch counts with features like
val_check_interval
, where the training epoch count != val epoch count. The property for validation would only apply duringtrainer.fit
astrainer.validate
only makes a single pass through the data.However, the documentation for the
test_dataloader
: https://github.com/PyTorchLightning/pytorch-lightning/blob/963c26764682fa4cf64c93c5a7572ae0040e9c32/pytorch_lightning/core/hooks.py#L535-L537Is this a copy/paste issue?
Pitch
Benefits:
Alternatives
Keep as is?
Additional context
If you enjoy Lightning, check out our other projects! ⚡
Metrics: Machine learning metrics for distributed, scalable PyTorch applications.
Flash: The fastest way to get a Lightning baseline! A collection of tasks for fast prototyping, baselining, finetuning and solving problems with deep learning
Bolts: Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch
Lightning Transformers: Flexible interface for high performance research using SOTA Transformers leveraging Pytorch Lightning, Transformers, and Hydra.
The text was updated successfully, but these errors were encountered: