fix: clamp shift perturbation for short audio instead of silently skipping#15561
Open
stanley1208 wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
Open
fix: clamp shift perturbation for short audio instead of silently skipping#15561stanley1208 wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
stanley1208 wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
Conversation
…pping Signed-off-by: stanley1208 <stanley.mei08@gmail.com> Made-with: Cursor
Contributor
Author
|
@nithinraok @pzelasko Ready for review — fixes a real bug where ShiftPerturbation silently skipped augmentation for short audio clips. Resolves the TODO at perturb.py line 442. Includes 7 unit tests. Thanks! |
pzelasko
approved these changes
Mar 30, 2026
Collaborator
pzelasko
left a comment
There was a problem hiding this comment.
Thanks! Looks good to me.
Contributor
Author
|
@pzelasko @nithinraok Friendly ping , this was approved but hasn't been merged yet. Is there anything else needed? Happy to address any feedback. Thanks! |
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?
Fix a bug in
ShiftPerturbation.perturb()where audio augmentation was silently skipped when the randomly sampled shift exceeded the audio duration. This caused short audio clips to receive no shift augmentation at all, with no warning to the user.Before: If
abs(shift_ms) / 1000 > data.duration, the method returned immediately — a silent no-op. Users with short utterances or largemax_shift_mshad their augmentation silently disabled.After: The shift is clamped to the audio duration so some shift is always applied. This resolves the TODO at line 442:
"do something smarter than just ignore this condition".Collection: ASR
Changelog
ShiftPerturbation.perturb()to clamp shift amount instead of silently skipping augmentation for short audioShiftPerturbationcovering normal operation, short audio clamping, length preservation, and zero-shift edge caseUsage