-
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 DataLoader
s with missing arguments in replace_sampler
#8519
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8519 +/- ##
======================================
Coverage 92% 92%
======================================
Files 218 218
Lines 14397 14385 -12
======================================
- Hits 13286 13277 -9
+ Misses 1111 1108 -3 |
DataLoader
s with missing arguments in replace_sampler
DataLoader
s with missing arguments in replace_sampler
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.
Overall looks good, but I wonder if we can't do something simpler for modifying the DataLoader.
Hey @carmocca @awaelchli @justusschock, What do you think of this approach ? Currently, the custom DataLoader assumes the arguments are set as attributes which isn't correct to assume for all custom dataloaders.
|
What does this PR do?
Passing a
DataLoader
that did not define all thevars(DataLoader)
arguments produced an error. For example:(
dataloader.generator
exists butgenerator
is not in this custom DataLoader__init__
signature)This is not ideal as we should not error in this case if the existing attribute name is the default one. In this case, passing it should be optional.
Additionally, the error message is not clear about the problem.
This PR fixes it by rewriting the
replace_sampler
function and improving our coverage for this.Additional improvements:
*args, **kwargs
with different names is now allowed.Fixes #8518
Does your PR introduce any breaking changes? If yes, please list them.
No
Before submitting
PR review