-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Support re-instantiation for custom DataLoader in Lightning #10680
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
for more information, see https://pre-commit.ci
@awaelchli This is really cool. This comes in handy with our custom data loaders in PyG. Thank you! One issue I ran into is the use of "nested inheritance" of data loaders:
This seems to do some weird things in the |
Hi @rusty1s! Glad that you find it useful, we actually worked on this with PyG as a motivation. Happy to take a look once you define what those "weird things" are. You can find existing tests here if you are interested in poking at it yourself: Also, it would be better if you can open a new issue once you have a repro. Thank you! |
What does this PR do?
Part of #10329
Adds support for re-instantiating custom DataLoaders in Lightning, a feature that was recently added to Lite first in #10279.
*_dataloader
on the LightningModule or DataModule gets wrapped with a context manager.Limitations:
The patching will only work if the DataLoader gets instantiated inside the
*_dataloader
methods.The custom DataLoader needs to be compatible with the patching, i.e., it needs to allow Lightning to write the arguments to it's dict.
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
I made sure I had fun coding 🙃
Part of #1 (it's a lie, this is just here to avoid noisy GitHub bot)
cc @Borda @justusschock @awaelchli @ninginthecloud