-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Word boosting for Flashlight decoder #6367
Conversation
Signed-off-by: Daniel Egert <degert@nvidia.com>
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dunno why there's such a huge diff, but I'll assume the code works for now.
The docs needs to be part of the Nemo docs page - however to avoid duplication you can add a small section in the ASR LM docs section explaning that the docs for boosting are located in Riva - and then link there
It's because the flashlight_decoder.py file had Windows style EOL markings, and I changed them to UNIX to bring it into line with all other .py files in Nemo. Sorry about that. If Nemo is okay with Windows EOL markings, I can resubmit the Windows one which will then correctly show only the changes I made, the entire file won't be showing up red. |
import torch | ||
|
||
from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec | ||
from nemo.core.classes import NeuralModule, typecheck |
Check notice
Code scanning / CodeQL
Unused import
|
||
import itertools | ||
import math | ||
from typing import Iterable, List, Optional, Tuple, Union |
Check notice
Code scanning / CodeQL
Unused import
|
||
from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec | ||
from nemo.core.classes import NeuralModule, typecheck | ||
from nemo.core.neural_types import LengthsType, LogprobsType, NeuralType, PredictionsType |
Check notice
Code scanning / CodeQL
Unused import
Signed-off-by: Daniel Egert <degert@nvidia.com>
I have done this and updated the commit, please let me know if it is sufficient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ! Looks great
@@ -393,3 +392,45 @@ parameter, the plot of WER% for different values of the parameter is also shown. | |||
|
|||
It is recommended to first use the linear search for both parameters on a validation set by not providing any values for `--alpha` and `--beta`. | |||
Then check the WER curves and decide on the best values for each parameter. Finally, evaluate the best values on the test set. | |||
|
|||
|
|||
Word Boosting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks !
* Initial commit of word boosting for flashlight Signed-off-by: Daniel Egert <degert@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Updated docs for word boosting Signed-off-by: Daniel Egert <degert@nvidia.com> --------- Signed-off-by: Daniel Egert <degert@nvidia.com> Co-authored-by: Daniel Egert <degert@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: hsiehjackson <c2hsieh@ucsd.edu>
What does this PR do ?
Adds word boosting to the Flashlight decoder in Nemo to mirror this capability in Riva
For more info see here: https://docs.nvidia.com/deeplearning/riva/user-guide/docs/tutorials/asr-python-advanced-wordboosting.html
And here: https://docs.nvidia.com/deeplearning/riva/user-guide/docs/asr/asr-customizing.html#word-boosting
Collection: ASR
Changelog
(I noticed that flashlight_decoder.py had Windows EOLs, so I changed them to Unix, but unfortunately this makes git show as if I had changed the entire file which isn't the case, sorry about this)
Usage
For example, here is a valid format boost file on disk, not that it is a single tab separated file:
Positive scores boost words higher in the LM decoding step so they show up more frequently, whereas negative scores squelch words so they show up less frequently. The recommended range for the boost score is 20 to 100.
The boost file handles both in-vocabulary words and OOV words just fine, so feel free to mix and match.
You can then add it to your flashlight config object in Nemo like this:
Before your PR is "Ready for review"
Pre checks:
PR Type:
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.