-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Default LightningDataModule.__init__
isn't called
#11225
Comments
Forgetting to call Also, we don't do the same for the |
but for the lightning module I guess AttributeError: cannot assign module before Module.__init__() call also might be a problem with using dataclass because they don't have any generic |
I agree with @carmocca @rohitgr7 When converting the module to a dataclass, one has to add: def __post_init__(self):
super().__init__() The Python docs for this: https://docs.python.org/3/library/dataclasses.html#post-init-processing |
yes, I understand that's the responsibility of the user. But my only request was to provide a meaningful error in such a case which I guess is not possible. |
🐛 Bug
To Reproduce
Default LightningDataModule init call was added here #9039 but was removed here #10350. Not sure if it was by mistake or intentional but the following code isn't working on master but working fine on the latest patch release. If it was intentional then I'd suggest we should somehow enforce users to always call
super().__init__()
in their LightningDataModule init methods because the following error isn't user-friendly.Code:
Error:
AttributeError: 'BoringData' object has no attribute 'prepare_data_per_node'
Expected behavior
Environment
conda
,pip
, source):torch.__config__.show()
:Additional context
cc @carmocca @awaelchli @Borda @ananthsub @ninginthecloud @jjenniferdai
The text was updated successfully, but these errors were encountered: