-
Notifications
You must be signed in to change notification settings - Fork 204
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
Fix randomness in CutMix transform #1316
Conversation
test/dataset/test_cut_transforms.py
Outdated
noise_cuts = DummyManifest(CutSet, begin_id=100, end_id=102) | ||
|
||
# called twice on the same input, expecting different results | ||
tfnm = CutMix(noise_cuts, snr=None, p=1.0, seed=0, preserve_id=True) |
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.
nit: tnfm
tfnm = CutMix(noise_cuts, snr=None, p=1.0, seed=0, preserve_id=True) | ||
out1 = tfnm(speech_cuts) | ||
out2 = tfnm(speech_cuts) | ||
assert list(out1) != list(out2) |
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 adding this test. I ran this using v1.17 which is stateless, but I still got different outputs (i.e., out1
and out2
are different). This is counterintuitive because CutMix
passes the same seed in every __call__
to cuts.mix
. can you please help me understand this?
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.
It used CutSet.sample which was not seeded and used the global RNG. If I start any new library from scratch I’ll keep it in mind to have a methodical approach to RNG handling from the beginning.
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.
ah, you're right. I forgot about that. Thanks again.
No description provided.