-
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
DataLoader wrapping, re-instantiation and patching #10329
Comments
The issue exists because this wrapper here pops args and kwargs. we are re-instantiating (with the new init) but passing arguments by kwargs, strictly! This means the for loop here runs empty! What is the design flaw? As always, it is the fact that we are making too strong assumptions without documenting them and without testing for them. |
A few things that need to be addressed (discussed with @tchaton and @carmocca):
|
One minor limitation of the patching is that the dataloader needs to allow write access to its dict, i.e. something like this would be a valid DataLoader but our patching would fail: class MyDataLoader(DataLoader):
def __init__(self, whatever, *args, **kwargs):
# Lightning will not be allowed to set the attribute self.whatever here (read-only)
super().__init__(*args, **kwargs)
@property
def whatever(self):
return "foo" We may want to handle this error case. |
In practice, it would be instead: class MyDataLoader(DataLoader):
def __init__(self, whatever, *args, **kwargs):
self._whatever = whatever
super().__init__(*args, **kwargs)
@property
def whatever(self):
return self._whatever |
@carmocca @tchaton Do you remember what we wanted to do with "Open PR to PyTorch Geometric to improve support for their DataLoaders"? But we need to wait until at least 1.6 is out. |
No, it was about addressing the failure which made @tchaton add the |
Hey @awaelchli, I wonder if it would be this one: https://github.com/pyg-team/pytorch_geometric/blob/4bd1821b72039cb6beb96041bc9f18b2c4af36bb/torch_geometric/loader/graph_saint.py#L50 where the dataset isn't being poped from the kwargs, but this is maybe expected. |
This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, Pytorch Lightning Team! |
🐛 Bug
Recent changes to the Lite DataLoader in #10279 have not been properly reviewed and tested. Several clean ups need to be done and better tests need to be written.
The following issue exists:
To Reproduce
Expected behavior
According to the changes in the PR #10279, this is supposed to work and was the main motivation of it. But it does not because the tests were insufficient. This issue was found by me in #10297 while trying to clean up the code.
Environment
Lightning v1.5.0!
cc @tchaton @rohitgr7 @carmocca @justusschock @awaelchli
The text was updated successfully, but these errors were encountered: