-
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
Make default implementation for train_dataloader in DataHooks raise NotImplementedError #8752
Comments
Sir can i work on this issue as I am a new contributor to open source. |
Definitely! Go ahead 😄 |
Sir as I am new so can you give me a bit context about the problem what I understand from the issue is that instead of giving warning when users forget to use hooks I should raise a NotImplementedError |
@ananthsub this issue looks orphaned, and I'm keen to pick it up; but I wanted to check in first since @Arnab1181412 had initially volunteered. I want to be cognizant of any potential etiquette and not step on any toes 🙏🏽 |
Please go ahead! Thank you for checking :) |
@ananthsub so the ticket states Surprisingly the docstring for the |
@awaelchli does removing ABC from the LightningModule's inheritance resolve this? https://github.com/PyTorchLightning/pytorch-lightning/blob/91ce0d0a99ec0a488e04e09997f6dd662ce217cd/pytorch_lightning/core/lightning.py#L56 |
no, since raising |
Given the documentation and recommended usage of NotImplementedError here, we should consider raising a different error. |
huh, I thought these would have to be marked with |
@ananthsub you are correct afaik. @awaelchli the difference is that for classes that inherit |
This is caused by a bug in PyCharm: #9529 (comment) |
Here's another issue about an user complaining about this: #10667 @justusschock proposed the following alternative:
|
And one more: #12176 |
I wanted to fix this a while ago with #9529. We can reconsider? |
I'd say yes since it seems like it's important to users. |
Discussed in #8734
We are auditing the Lightning components and APIs to assess opportunities for improvements:
The default implementation for these is logging a warning that nothing is implemented. https://github.com/PyTorchLightning/pytorch-lightning/blob/963c26764682fa4cf64c93c5a7572ae0040e9c32/pytorch_lightning/core/hooks.py#L529
The current default implementation logs a warning, which can be lost, and which forces the framework to perform is_overridden checks. Instead, having the default implementation raise a NotImplementedError will make errors clear to users in case users forget to implement these hooks.
This applies for all the dataloader hooks in DataHooks, not just train_dataloader
The text was updated successfully, but these errors were encountered: