-
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
Move NaN/Inf detection to a separate utilities file #6834
Conversation
Hello @ananthsub! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-04-08 16:42:06 UTC |
Codecov Report
@@ Coverage Diff @@
## master #6834 +/- ##
========================================
- Coverage 91% 84% -7%
========================================
Files 192 194 +2
Lines 12191 13129 +938
========================================
- Hits 11145 11041 -104
- Misses 1046 2088 +1042 |
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.
maybe add a todo on top of the TrainingTricksMixin class that it should be removed in v1.5?
pytorch_lightning/utilities/nan.py
Outdated
log = logging.getLogger(__name__) | ||
|
||
|
||
def print_nan_gradients(model: nn.Module) -> None: |
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.
What do you think of these improvements? (my code)
https://github.com/jpuigcerver/PyLaia/blob/master/laia/utils/checks.py
- Optional exception
- Include non finite percentages
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.
It could be useful for some users with unstable losses. Worth to consider.
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.
I think it'd be useful! Maybe we can add it in a follow up PR? this one is mainly moving code around for parity
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.
If you prefer, sure
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.
LGTM !
pytorch_lightning/utilities/nan.py
Outdated
log = logging.getLogger(__name__) | ||
|
||
|
||
def print_nan_gradients(model: nn.Module) -> None: |
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.
It could be useful for some users with unstable losses. Worth to consider.
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
What does this PR do?
Fixes #6815
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃