-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Change perturb rng for reproducing results easily #6042
Conversation
Signed-off-by: fayejf <[email protected]>
Signed-off-by: fayejf <[email protected]>
Signed-off-by: fayejf <[email protected]>
Signed-off-by: fayejf <[email protected]>
Signed-off-by: fayejf <[email protected]>
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 !
* add random seed in perturb Signed-off-by: fayejf <[email protected]> * small update Signed-off-by: fayejf <[email protected]> * update evaluator config Signed-off-by: fayejf <[email protected]> * update tutorial Signed-off-by: fayejf <[email protected]> * update add_noise Signed-off-by: fayejf <[email protected]> --------- Signed-off-by: fayejf <[email protected]>
|
||
for i in range(n_additions): | ||
noise_dur = self._rng.uniform(0.0, max_noise_dur) | ||
start_time = self._rng.uniform(0.0, noise.duration) | ||
noise_dur = random.uniform(0.0, max_noise_dur) |
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.
do I understand correctly that the random state is now global? is it more reproducible with global state rather than local? typically local state is preferrable, no?
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.
Yes the random state is now global (if no specific random seed is provided for each perturb), and from the results it seems that now it can fully reproduce the same results with the same random seed.
Could @fayejf please provide more explanations/details?
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.
Well, maybe it now reproduces, but it's then more brittle in how it interacts with other code potentially changing the global random state or resetting it...
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 your question and suggestion. In which case do you think it will potentially change the global random state or reset it? Could you elaborate more please?
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 meant that if some other aug in the pipeline also resets the seed, then it might break the reproducibility of this aug because they both affect the same global state.
In other places maybe I saw the other way around and torch rng generators are introduced as explicit arguments to fully control the randomness (e.g. this is being discussed in torchvision)
But it was just a question :) (based on some general aug pipeline experience in other contexts) I haven't read very deeply the NeMo pipeline, and I don't have good, well-based NeMo-specific arguments etc...
* add random seed in perturb Signed-off-by: fayejf <[email protected]> * small update Signed-off-by: fayejf <[email protected]> * update evaluator config Signed-off-by: fayejf <[email protected]> * update tutorial Signed-off-by: fayejf <[email protected]> * update add_noise Signed-off-by: fayejf <[email protected]> --------- Signed-off-by: fayejf <[email protected]> Signed-off-by: hsiehjackson <[email protected]>
What does this PR do?
Change perturb rng for reproducing results easily
Collection: ASR
Changelog
Usage
You can use rng (int) for Perturbations.
Before your PR is "Ready for review"
Pre checks:
PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.
Who can review?
Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.
Additional Information