add support of seed_everything#2654
Merged
pplantinga merged 27 commits intospeechbrain:developfrom Sep 12, 2024
Merged
Conversation
…tils.seed.seed_everything
pplantinga
reviewed
Sep 11, 2024
Collaborator
pplantinga
left a comment
There was a problem hiding this comment.
Looks like a good PR that better follows PyTorch recommendations about randomness. I have a few minor comments but it is good enough that it could be merged now.
|
|
||
| However, due to the differences in how GPU and CPU executions work, results may not be fully reproducible even with identical seeds, especially when training models. This issue primarily affects training experiments. | ||
|
|
||
| On the other hand, when preparing data using data preparation scripts, the output of these scripts is independent of the global seeds. This ensures that you will get identical outputs on different setups, even if different seeds are used. No newline at end of file |
Collaborator
There was a problem hiding this comment.
Maybe we could expand this to explain important details about distributed experiments, that different seeds will be set on different machines which will affect things like augmentations, but not things like initial model parameters or data loaders.
Collaborator
Author
There was a problem hiding this comment.
Done. Let me know what you think
This file contains hidden or 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
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?
This PR add the support of a new function called
seed_everythingwhich tries to maximize reproducibility.When using two processes it does print:
While for one:
As a matters of fact, we offset the seed by the rank of the current process.
Before submitting
PR review
Reviewer checklist