Skip to content
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

GPU-based vectorized Specaug Version 2 #9155

Merged
merged 15 commits into from May 15, 2024

Conversation

amorari-nvidia
Copy link
Contributor

What does this PR do ?

This PR proposes a faster version of the Spectrogram Augmentation module for time and frequency masking.

@github-actions github-actions bot added the ASR label May 9, 2024
pzelasko
pzelasko previously approved these changes May 9, 2024
Copy link
Collaborator

@pzelasko pzelasko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I visually inspected that the masks look correct on random spectrograms. I also ran a training with this variant in Nsight profiler and noticed the specaug computation mostly disappeared from the profile. It is estimated to be about 4-5x faster than the variant proposed in #9041 which would make it 8-10x faster than the original version (still available as the "legacy" setting).

LGTM!

@pzelasko pzelasko requested a review from titu1994 May 9, 2024 18:55
@pzelasko pzelasko mentioned this pull request May 9, 2024
8 tasks
@pzelasko pzelasko dismissed their stale review May 9, 2024 19:06

requested update to another version with some extra fixes

Copy link
Collaborator

@titu1994 titu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great ! Minor comments

@amorari-nvidia
Copy link
Contributor Author

After this I think that we may also have to add the flag in the audio processing module:
https://github.com/amorari-nvidia/NeMo/blob/d26eab45d54e9e00e74c68ea4b0bbbf7b48a7a50/nemo/collections/asr/modules/audio_preprocessing.py#L494

And also we may have to add a test, adding the pytest run_only_on('GPU') flag the same it is done for the numba code:
#https://github.com/amorari-nvidia/NeMo/blob/d26eab45d54e9e00e74c68ea4b0bbbf7b48a7a50/tests/collections/asr/test_asr_modules.py#L71

Signed-off-by: Alessandro Morari <amorari@nvidia.com>
Signed-off-by: Alessandro Morari <amorari@nvidia.com>
Signed-off-by: Alessandro Morari <amorari@nvidia.com>
@pzelasko
Copy link
Collaborator

@amorari-nvidia As a last thing, could you remove the numba specaug implementation altogether in this PR? IIRC it will automatically kick in with numba 0.58 (or when numba+cuda versions are compatible for earlier versions), overriding the implementation here. CC @titu1994 pls double check if I'm right about this.

@amorari-nvidia
Copy link
Contributor Author

Waiting for confirmation from @titu1994

@titu1994
Copy link
Collaborator

You can remove it entirely, or set the default flag of numba cuda to false. I think that's sufficient for the time being.

If you can remove it cleanly, then that's fine too

@amorari-nvidia
Copy link
Contributor Author

I will just set the Numba version default flag to false for now

pzelasko and others added 2 commits May 13, 2024 16:26
Signed-off-by: pzelasko <pzelasko@users.noreply.github.com>
@amorari-nvidia
Copy link
Contributor Author

amorari-nvidia commented May 13, 2024

I will just set the Numba version default flag to false for now

The Numba SpecAugment version is already set to false, while the vectorized version is set to true and is the default code.

@pzelasko
Copy link
Collaborator

great, re-triggered tests, LGTM as soon as it's green

@pablo-garay
Copy link
Collaborator

great, re-triggered tests, LGTM as soon as it's green

CI passed

@pzelasko pzelasko self-requested a review May 15, 2024 16:04
@pzelasko pzelasko merged commit 061cc45 into NVIDIA:main May 15, 2024
248 checks passed
@pzelasko
Copy link
Collaborator

Congrats @amorari-nvidia on the first contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants