-
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
Deprecate the default EarlyStopping
callback monitor value
#7907
Deprecate the default EarlyStopping
callback monitor value
#7907
Conversation
Hello @bamblebam! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-06-10 19:12:24 UTC |
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## master #7907 +/- ##
=======================================
- Coverage 88% 88% -1%
=======================================
Files 204 200 -4
Lines 13667 12839 -828
=======================================
- Hits 12047 11237 -810
+ Misses 1620 1602 -18 |
…github.com/bamblebam/pytorch-lightning into bugfix/7894-early_stopping_monitor_default
for more information, see https://pre-commit.ci
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.
thanks for working on this @bamblebam !
please add a test here: https://github.com/PyTorchLightning/pytorch-lightning/blob/master/tests/deprecated_api/test_remove_1-6.py
which instantiates an EarlyStopping callback without setting the monitor to confirm the warning appears as expected
@ananthsub can you tell me why my test is failing? |
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.
Be sure to add a CHANGELOG entry to the deprecated section of 1.4.0 with this PR:
See here for examples
https://github.com/PyTorchLightning/pytorch-lightning/blob/master/CHANGELOG.md#deprecated
Hey I updated the changelog. |
CHANGELOG.md
Outdated
- Deprecated `monitor` argument in EarlyStopping will be required. ([#7907](https://github.com/PyTorchLightning/pytorch-lightning/pull/7907)) | ||
|
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.
- Deprecated `monitor` argument in EarlyStopping will be required. ([#7907](https://github.com/PyTorchLightning/pytorch-lightning/pull/7907)) | |
- Deprecated default value of `monitor` argument in EarlyStopping callback to enforce `monitor` as a required argument ([#7907](https://github.com/PyTorchLightning/pytorch-lightning/pull/7907)) | |
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.
+1
yes this is ready for review |
@@ -120,6 +119,13 @@ def __init__( | |||
torch_inf = torch.tensor(np.Inf) | |||
self.best_score = torch_inf if self.monitor_op == torch.lt else -torch_inf | |||
|
|||
if monitor is None: | |||
rank_zero_deprecation( | |||
"The `monitor` argument will be required to be set starting in v1.6." |
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.
"The `monitor` argument will be required to be set starting in v1.6." | |
"The `EarlyStoppinf(monitor)` argument will be required starting in v1.6." |
EarlyStopping
callback monitor value
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.
we may want to consider making the change to our tests wherever the argument is missing.
CHANGELOG.md
Outdated
- Deprecated `monitor` argument in EarlyStopping will be required. ([#7907](https://github.com/PyTorchLightning/pytorch-lightning/pull/7907)) | ||
|
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.
+1
"The `monitor` argument will be required to be set starting in v1.6." | ||
" For backward compatibility, setting this to `early_stop_on`." | ||
) | ||
self.monitor = monitor or 'early_stop_on' |
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.
self.monitor = monitor or 'early_stop_on' | |
self.monitor = monitor or "early_stop_on" |
double quotes everywhere else it seems
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.
alright I will do the change
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.
you can just click the button "commit suggestion" here on github below my message. so you don't have to manually commit it. what you prefer!
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.
note quoting will get standardized with #7783
@awaelchli can you tell me why the tests might be failing? |
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.
great job @bamblebam !
Thanks for guiding me through this :) |
…ng-AI#7907) * removed monitor default value and added depreceation message * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * format change * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * requested changes * added test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * format changes * typehint change * Update CHANGELOG.md * requested changes * regex Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Adrian Wälchli <[email protected]>
What does this PR do?
Removes the default value for the monitor argument from the early stopping callback. Also adds the deprecation message.
Fixes #7894
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 🙃