-
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
Improve mechanism to reset the seed after sanity check #11870
Merged
Merged
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
awaelchli
force-pushed
the
bugfix/reset-seed
branch
from
February 11, 2022 02:16
49392f8
to
ee1f749
Compare
awaelchli
force-pushed
the
bugfix/reset-seed
branch
from
February 11, 2022 06:25
ca85903
to
a7168e4
Compare
carmocca
reviewed
Feb 11, 2022
awaelchli
commented
Feb 14, 2022
awaelchli
requested review from
williamFalcon,
tchaton,
Borda,
SeanNaren,
justusschock,
kaushikb11 and
rohitgr7
as code owners
February 14, 2022 01:30
tchaton
approved these changes
Feb 14, 2022
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.
Super neat !
carmocca
approved these changes
Feb 14, 2022
tchaton
approved these changes
Feb 20, 2022
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 !
@awaelchli Pushed a commit fixing mypy. I think we can treat the rng keys as required. @rohitgr7 mind reviewing? |
carmocca
reviewed
Mar 1, 2022
rohitgr7
approved these changes
Mar 1, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
An improvement to #7014
Fixes #11840
The previous approach was to reset the seed to the global seed value that was previously set with
seed_everything
.https://github.com/PyTorchLightning/pytorch-lightning/blob/6f22b3623c28028026b3cb8bb534c1ebca9c5ac8/pytorch_lightning/trainer/trainer.py#L1375-L1377
However, this would lead to multiple subsequent fits to produce identical results. The expected behavior however is:
This PR enables both scenarios to work as expected. An existing test was modified to enable scenario 2.
In addition, there is a test
test_multiple_lr_find_calls_gives_same_results
for the LR finder that was relying on the previous behavior. To preserve that, we now also properly reset the random state after tuning.Does your PR introduce any breaking changes? If yes, please list them.
Theoretically yes. Anyone who relied on the previous behavior will get different results now.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
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 🙃
cc @Borda