-
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
Enhance reduce_boolean_decision
to accommodate any
-analogous semantics expected by EarlyStopping
Callback
#15253
Merged
awaelchli
merged 8 commits into
Lightning-AI:master
from
speediedan:enhance_reduce_bool_decision
Nov 9, 2022
Merged
Enhance reduce_boolean_decision
to accommodate any
-analogous semantics expected by EarlyStopping
Callback
#15253
awaelchli
merged 8 commits into
Lightning-AI:master
from
speediedan:enhance_reduce_bool_decision
Nov 9, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ntics as expected EarlyStopping
speediedan
requested review from
awaelchli,
carmocca,
justusschock,
rohitgr7,
otaj,
kaushikb11 and
Borda
as code owners
October 22, 2022 20:31
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #15253 +/- ##
=========================================
+ Coverage 82% 84% +2%
=========================================
Files 413 288 -125
Lines 30463 22002 -8461
=========================================
- Hits 24938 18387 -6551
+ Misses 5525 3615 -1910 |
awaelchli
approved these changes
Oct 24, 2022
awaelchli
added
community
This PR is from the community
callback: early stopping
bug
Something isn't working
labels
Oct 24, 2022
…n docstring Co-authored-by: Adrian Wälchli <[email protected]>
Co-authored-by: Adrian Wälchli <[email protected]>
justusschock
approved these changes
Nov 9, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
callback: early stopping
community
This PR is from the community
pl
Generic label for PyTorch Lightning package
ready
PRs ready to be merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #15252
When
EarlyStopping
is used in a distributed context, early stopping conditions may be met in some processes before others (especially when thedivergence_threshold
is sufficiently low).Per the described intended behavior of
EarlyStopping
:https://github.com/Lightning-AI/lightning/blob/be1eb5e86d07fe22b53a59184089aac569875117/src/pytorch_lightning/callbacks/early_stopping.py#L204-L205
, all training processes should be stopped when an
EarlyStopping
threshold is reached in any process. The current behavior ofreduce_boolean_decision
is to only returnTrue
when all input process decisions areTrue
:https://github.com/Lightning-AI/lightning/blob/be1eb5e86d07fe22b53a59184089aac569875117/src/lightning_lite/strategies/parallel.py#L88-L92
Though this issue can be avoided when logging the monitored metric with
sync_dist=True
, since that configuration is not mandatory,reduce_boolean_decision
should be adapted to behave as theEarlyStopping
callback expects.This PR maintains the current
reduce_boolean_decision
behavior by default, but enhances the function to accommodateany
-analogous semantics as expected by theEarlyStopping
callback. This PR also includes an additional test to validate the aforementioned new behavior resolves the issue described.Does your PR introduce any breaking changes? If yes, please list them.
None
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃