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

Add Numba CPU+CUDA support for RNNT Loss #1854

Merged
merged 32 commits into from
Mar 29, 2021

Conversation

titu1994
Copy link
Collaborator

@titu1994 titu1994 commented Mar 6, 2021

Changelog

Todo:

  • Add documentation for all kernels and wrapped modules
  • Add Typing information to RNNTLossNumba (Done by resolver)
  • Rename this module to avoid clash with original warprnnt_pytorch loss
  • Add WarpRNNT LICENSE header in all files that implement functionality as ported.
  • Fix imports inside __init__.py
  • Enable loss switching for RNNT / RNNTBPE models via config (done in next PR)

@titu1994 titu1994 marked this pull request as draft March 6, 2021 03:19
@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2021

This pull request introduces 1 alert when merging 9de7bc5 into 74a1ed8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2021

This pull request introduces 1 alert when merging 8f8a275 into 74a1ed8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2021

This pull request introduces 1 alert when merging e454c4c into 74a1ed8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2021

This pull request introduces 1 alert when merging 4946314 into 74a1ed8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2021

This pull request introduces 1 alert when merging ea51c3b into 74a1ed8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2021

This pull request introduces 1 alert when merging aea2b72 into 74a1ed8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2021

This pull request introduces 1 alert when merging bcb683a into 74a1ed8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2021

This pull request introduces 1 alert when merging 5addd50 into 74a1ed8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2021

This pull request introduces 1 alert when merging af028e9 into 74a1ed8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2021

This pull request introduces 1 alert when merging 8edd7f1 into 74a1ed8 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 9, 2021

This pull request introduces 1 alert when merging 5bf8f3d into e8912ca - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 23, 2021

This pull request introduces 1 alert when merging b3f93ae into aaab317 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@titu1994 titu1994 marked this pull request as ready for review March 25, 2021 22:53
@lgtm-com
Copy link

lgtm-com bot commented Mar 25, 2021

This pull request introduces 1 alert when merging 9cdc539 into d623109 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@titu1994 titu1994 requested a review from VahidooX March 25, 2021 23:11
nemo/collections/asr/losses/rnnt.py Show resolved Hide resolved
nemo/collections/asr/losses/rnnt.py Show resolved Hide resolved
nemo/collections/asr/parts/numba/__init__.py Outdated Show resolved Hide resolved
#
# Copyright 2018-2019, Mingkun Huang
#
# Licensed under the Apache License, Version 2.0 (the "License");
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it necessary to have this license here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, here its needed since the 2 functions and the class is ported from that codebase.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But this is the init file which just contains the imports.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed

reinstall.sh Outdated Show resolved Hide resolved
nemo/collections/asr/parts/numba/__init__.py Show resolved Hide resolved
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: smajumdar <titu1994@gmail.com>
@lgtm-com
Copy link

lgtm-com bot commented Mar 26, 2021

This pull request introduces 1 alert when merging 19215a1 into 480bbc3 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@titu1994 titu1994 merged commit bb01dbb into NVIDIA:main Mar 29, 2021
@titu1994 titu1994 deleted the add_rnnt_numba_loss branch March 29, 2021 05:59
vadam5 pushed a commit to vadam5/NeMo that referenced this pull request Apr 9, 2021
* Initial code merge

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update reduce kernel tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add tests and remove log messages

Signed-off-by: smajumdar <titu1994@gmail.com>

* Improve documentation

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add alpha beta kernel tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Remove unused imports

Signed-off-by: smajumdar <titu1994@gmail.com>

* Remove unused imports

Signed-off-by: smajumdar <titu1994@gmail.com>

* Document warp reduce.py

Signed-off-by: smajumdar <titu1994@gmail.com>

* Style fixes

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add NeMo licenses

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Force update

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add docs for gpu rnnt kernel

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add docs for gpu rnnt kernel gradient

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update docs for cpu and gpu rnnt kernels + helpers

Signed-off-by: smajumdar <titu1994@gmail.com>

* Correct backward for numpy rnnt

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update name of RNNT loss

Signed-off-by: smajumdar <titu1994@gmail.com>

* Formatting

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss License

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add __init__.py correctly and improve rnnt loss resolution

Signed-off-by: smajumdar <titu1994@gmail.com>

* Address reviewer comments

Signed-off-by: smajumdar <titu1994@gmail.com>

* Address comments

Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: Virginia Adams <vadams@nvidia.com>
vadam5 pushed a commit to vadam5/NeMo that referenced this pull request Apr 12, 2021
* Initial code merge

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update reduce kernel tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add tests and remove log messages

Signed-off-by: smajumdar <titu1994@gmail.com>

* Improve documentation

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add alpha beta kernel tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Remove unused imports

Signed-off-by: smajumdar <titu1994@gmail.com>

* Remove unused imports

Signed-off-by: smajumdar <titu1994@gmail.com>

* Document warp reduce.py

Signed-off-by: smajumdar <titu1994@gmail.com>

* Style fixes

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add NeMo licenses

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Force update

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add docs for gpu rnnt kernel

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add docs for gpu rnnt kernel gradient

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update docs for cpu and gpu rnnt kernels + helpers

Signed-off-by: smajumdar <titu1994@gmail.com>

* Correct backward for numpy rnnt

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update name of RNNT loss

Signed-off-by: smajumdar <titu1994@gmail.com>

* Formatting

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss License

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add __init__.py correctly and improve rnnt loss resolution

Signed-off-by: smajumdar <titu1994@gmail.com>

* Address reviewer comments

Signed-off-by: smajumdar <titu1994@gmail.com>

* Address comments

Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: Virginia Adams <vadams@nvidia.com>
michalivne pushed a commit to michalivne/NeMo that referenced this pull request Jun 23, 2021
* Initial code merge

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update reduce kernel tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add tests and remove log messages

Signed-off-by: smajumdar <titu1994@gmail.com>

* Improve documentation

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add alpha beta kernel tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Remove unused imports

Signed-off-by: smajumdar <titu1994@gmail.com>

* Remove unused imports

Signed-off-by: smajumdar <titu1994@gmail.com>

* Document warp reduce.py

Signed-off-by: smajumdar <titu1994@gmail.com>

* Style fixes

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add NeMo licenses

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Force update

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add docs for gpu rnnt kernel

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add docs for gpu rnnt kernel gradient

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update docs for cpu and gpu rnnt kernels + helpers

Signed-off-by: smajumdar <titu1994@gmail.com>

* Correct backward for numpy rnnt

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update name of RNNT loss

Signed-off-by: smajumdar <titu1994@gmail.com>

* Formatting

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss License

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add __init__.py correctly and improve rnnt loss resolution

Signed-off-by: smajumdar <titu1994@gmail.com>

* Address reviewer comments

Signed-off-by: smajumdar <titu1994@gmail.com>

* Address comments

Signed-off-by: smajumdar <titu1994@gmail.com>
Signed-off-by: Micha Livne <mlivne@nvidia.com>
mousebaiker pushed a commit to mousebaiker/NeMo that referenced this pull request Jul 8, 2021
* Initial code merge

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update reduce kernel tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add tests and remove log messages

Signed-off-by: smajumdar <titu1994@gmail.com>

* Improve documentation

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add alpha beta kernel tests

Signed-off-by: smajumdar <titu1994@gmail.com>

* Remove unused imports

Signed-off-by: smajumdar <titu1994@gmail.com>

* Remove unused imports

Signed-off-by: smajumdar <titu1994@gmail.com>

* Document warp reduce.py

Signed-off-by: smajumdar <titu1994@gmail.com>

* Style fixes

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add NeMo licenses

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add Numba to dependencies

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Use safetynet api in case numba version is too old

Signed-off-by: smajumdar <titu1994@gmail.com>

* Force update

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add docs for gpu rnnt kernel

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add docs for gpu rnnt kernel gradient

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update docs for cpu and gpu rnnt kernels + helpers

Signed-off-by: smajumdar <titu1994@gmail.com>

* Correct backward for numpy rnnt

Signed-off-by: smajumdar <titu1994@gmail.com>

* Update name of RNNT loss

Signed-off-by: smajumdar <titu1994@gmail.com>

* Formatting

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add RNNT Loss License

Signed-off-by: smajumdar <titu1994@gmail.com>

* Add __init__.py correctly and improve rnnt loss resolution

Signed-off-by: smajumdar <titu1994@gmail.com>

* Address reviewer comments

Signed-off-by: smajumdar <titu1994@gmail.com>

* Address comments

Signed-off-by: smajumdar <titu1994@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants