Skip to content
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

Add example of saving / resuming DataLoader state with PyTorch Lightning #249

Open
schopra8 opened this issue Jul 21, 2024 · 2 comments
Open
Labels
documentation Improvements or additions to documentation

Comments

@schopra8
Copy link

📚 Documentation

Right now, the README shows an example of pausing and resuming the StreamingDataLoader state within a simple for loop over the dataloader.

It's not clear to me how to adapt that example to work with PyTorch Lightning, where the training loop is abstracted away.

My first guess is to make a callback for the Trainer -- but it would be great to have a simple example of how to do this in PyTorch Lightning.

@schopra8 schopra8 added the documentation Improvements or additions to documentation label Jul 21, 2024
@awaelchli
Copy link
Contributor

awaelchli commented Jul 22, 2024

The README shows how you'd do it in plain torch yes. PyTorch Lightning already supports checkpointing out of the box, so you'd literally have to do nothing.

If your train_dataloader() methods return a StreamingDataLoader then its state will be saved into the checkpoints and when you resume from one via trainer.fit(..., ckpt_path=...) it loads the dataloader state back to continue.

Yes we can make it more explicit in docs and examples etc, good idea!

@awaelchli awaelchli changed the title Add example of saving / resuming DataLoader state with PyTorch Litghtning Add example of saving / resuming DataLoader state with PyTorch Lightning Jul 22, 2024
@schopra8
Copy link
Author

Thank you for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants