-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix LightningDataModule zero-length attribute #21383
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
Fix LightningDataModule zero-length attribute #21383
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #21383 +/- ##
=========================================
- Coverage 89% 82% -7%
=========================================
Files 269 266 -3
Lines 22063 22009 -54
=========================================
- Hits 19737 18072 -1665
- Misses 2326 3937 +1611 |
SkafteNicki
left a comment
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.
Is this really necessary? Having super().__init__() in the __init__ of child classes is a requirement
class MyDataModule(L.LightningDataModule):
def __init__(self):
super().__init__() # ← REQUIRED!
# ... rest of initialization
You’re right that calling
We could instead add a strict runtime check that says “You must call |
|
@littlebullGit while I can agree with some of your points, some of them are also not true:
This PR only introduces a small change therefore I am somewhat okay with approving it. That said, this is not a bug but it is an user error. The real solution is either enforcing that |
Agree with you that this is likely an user error. I also commented on the Issue. |
What does this PR do?
allow_zero_length_dataloader_with_multiple_devicesso custom [LightningDataModule] subclasses remain compatible even if they skipsuper().__init__().Fixes #21358
Before submitting
📚 Documentation preview 📚: https://pytorch-lightning--21383.org.readthedocs.build/en/21383/