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

added return_grad for all types of rnnt loss #29

Merged
merged 6 commits into from
Aug 25, 2023
Merged

Conversation

durson
Copy link
Contributor

@durson durson commented Aug 22, 2023

Grad tensors can be useful for the full (ordinary and pruned) rnnt losses.

@pkufool
Copy link
Contributor

pkufool commented Aug 23, 2023

Can you also fix this issue (#25 (comment)), thanks!

@durson durson force-pushed the master branch 3 times, most recently from b48d47e to 46eb2b0 Compare August 23, 2023 12:38
@durson
Copy link
Contributor Author

durson commented Aug 23, 2023

I fixed #25 (comment)
However I preserved S > 0 requirement since otherwise it is not compatible with torchaudio and unittest was not passing.

Summary of the changes:

  • Added return_grad for all rnnt losses.
  • Lifted T >= S requirement for regular case. That included making sure that shapes match not only for the whole tensor but for batch instances as well (testing boundaries if provided).
  • Added s_range adjustment as per D.Povey suggestion and added unit test to check for correctness.
  • Nitpicks - torch.Tensor -> Tensor, making bonudaries optional in appropriate cases.

@pkufool
Copy link
Contributor

pkufool commented Aug 24, 2023

@durson I have added the github actions to this repo, could you sync the PR with the latest master, thanks!

@durson
Copy link
Contributor Author

durson commented Aug 24, 2023

Merged latest master to fork and tests are passing.

@pkufool
Copy link
Contributor

pkufool commented Aug 25, 2023

Thanks! merging! I would be very nice if you can also make a PR to https://github.com/k2-fsa/k2 (k2/python/k2/rnnt_loss.py).

@pkufool pkufool merged commit 83e4637 into k2-fsa:master Aug 25, 2023
7 checks passed
@pkufool pkufool mentioned this pull request Aug 25, 2023
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