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

Make TDT inference not require duration params #8207

Merged
merged 4 commits into from
Jan 24, 2024

Conversation

hainan-xv
Copy link
Collaborator

@hainan-xv hainan-xv commented Jan 20, 2024

What does this PR do ?

Making it so that TDT inference doesn't require --duration params to be passed.

Collection: [Note which collection this PR will affect]
ASR

Changelog

The model now infers the duration params from model's loss configs.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

Jenkins CI

To run Jenkins, a NeMo User with write access must comment jenkins on the PR.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

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

  • Related to # (issue)

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.

Overall it looks great! Minor comment about moving the new additional to RNNT char base class.

@@ -91,6 +91,11 @@ def __init__(self, cfg: DictConfig, trainer: Trainer = None):
else:
self.spec_augmentation = None

if loss_name == 'tdt':
Copy link
Collaborator

Choose a reason for hiding this comment

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

This part should be closer to the loss definition above. Colocation of similar things

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -208,15 +208,17 @@ def __init__(self, decoding_cfg, decoder, joint, blank_id: int):
self.compute_timestamps = self.cfg.get('compute_timestamps', None)
self.word_seperator = self.cfg.get('word_seperator', ' ')

if self.durations is not None: # this means it's a TDT model.
if self.durations is not None and self.durations != []: # this means it's a TDT model.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I personally prefer checking for bool, which is more idiomatic and follows PEP8

For sequences (strings, lists, tuples), use the fact that empty sequences are false
https://peps.python.org/pep-0008/#programming-recommendations

But the current approach is also acceptable for me since it works.

@artbataev
Copy link
Collaborator

@hainan-xv Thanks for the PR; I think it makes it more convenient to use decoding with TDT models. One minor comment about style.

@hainan-xv
Copy link
Collaborator Author

jenkins

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 perfect, great work ! This should make it trivial for users to switch between rnnt and TDT

@hainan-xv hainan-xv merged commit f10d694 into NVIDIA:main Jan 24, 2024
11 checks passed
@hainan-xv hainan-xv deleted the tdt_eval_fix branch January 24, 2024 22:54
yaoyu-33 pushed a commit that referenced this pull request Jan 31, 2024
* Make TDT inference not require duration params

Signed-off-by: Hainan Xu <[email protected]>

* addressed review comments

Signed-off-by: Hainan Xu <[email protected]>

* stylistic change

Signed-off-by: Hainan Xu <[email protected]>

---------

Signed-off-by: Hainan Xu <[email protected]>
Co-authored-by: Hainan Xu <[email protected]>
stevehuang52 pushed a commit that referenced this pull request Jan 31, 2024
* Make TDT inference not require duration params

Signed-off-by: Hainan Xu <[email protected]>

* addressed review comments

Signed-off-by: Hainan Xu <[email protected]>

* stylistic change

Signed-off-by: Hainan Xu <[email protected]>

---------

Signed-off-by: Hainan Xu <[email protected]>
Co-authored-by: Hainan Xu <[email protected]>
Signed-off-by: stevehuang52 <[email protected]>
ssh-meister pushed a commit to ssh-meister/NeMo that referenced this pull request Feb 15, 2024
* Make TDT inference not require duration params

Signed-off-by: Hainan Xu <[email protected]>

* addressed review comments

Signed-off-by: Hainan Xu <[email protected]>

* stylistic change

Signed-off-by: Hainan Xu <[email protected]>

---------

Signed-off-by: Hainan Xu <[email protected]>
Co-authored-by: Hainan Xu <[email protected]>
Signed-off-by: Sasha Meister <[email protected]>
pablo-garay pushed a commit that referenced this pull request Mar 19, 2024
* Make TDT inference not require duration params

Signed-off-by: Hainan Xu <[email protected]>

* addressed review comments

Signed-off-by: Hainan Xu <[email protected]>

* stylistic change

Signed-off-by: Hainan Xu <[email protected]>

---------

Signed-off-by: Hainan Xu <[email protected]>
Co-authored-by: Hainan Xu <[email protected]>
Signed-off-by: Pablo Garay <[email protected]>
rohitrango pushed a commit to rohitrango/NeMo that referenced this pull request Jun 25, 2024
* Make TDT inference not require duration params

Signed-off-by: Hainan Xu <[email protected]>

* addressed review comments

Signed-off-by: Hainan Xu <[email protected]>

* stylistic change

Signed-off-by: Hainan Xu <[email protected]>

---------

Signed-off-by: Hainan Xu <[email protected]>
Co-authored-by: Hainan Xu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants