add streaming beam search for cache aware models to NeMo inference#15768
add streaming beam search for cache aware models to NeMo inference#15768lilithgrigoryan wants to merge 30 commits into
Conversation
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
|
[🤖]: Hi @lilithgrigoryan 👋, We wanted to let you know that a CICD pipeline for this PR just finished successfully. So it might be time to merge this PR or get some approvals. |
…/streaming-beam-search-niva-cache-aware
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
naymaraq
left a comment
There was a problem hiding this comment.
This is really great work. Thanks @lilithgrigoryan
I’ll do another round of review after this one, since I see the PR is still a work in progress.
| prompt_vectors: (Tensor | None) Optional prompt vectors of shape [B, num_prompts]. | ||
| Returns: | ||
| (tuple[list[Hypothesis], CacheAwareContext]) best hypothesis and new context. | ||
| Run the cache-aware encoder for one streaming chunk, returning the (trimmed) |
There was a problem hiding this comment.
For consistency, please bring back the argument descriptions in the docstring.
There was a problem hiding this comment.
I believe, I kept the original docstring for execute_step unchanged. Git’s diff makes the execute_step and encoder_step (a new function) docstrings look confusing for some reason.
LMK, if I miss something.
There was a problem hiding this comment.
Argument descriptions are missing for encoder_step
| options: (ASRRequestOptions) Request options for particular stream. | ||
| Returns: | ||
| (CacheAwareRNNTStreamingState) New empty state. | ||
| (CacheAwareRNNTStreamingState) New empty state. New empty state. |
There was a problem hiding this comment.
Removed. Thanks!
|
[🤖]: Hi @lilithgrigoryan 👋, We wanted to let you know that a CICD pipeline for this PR just finished successfully. So it might be time to merge this PR or get some approvals. |
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
…/streaming-beam-search-niva-cache-aware
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
Signed-off-by: lilithgrigoryan <lgrigoryan@nvidia.com>
|
[🤖]: Hi @lilithgrigoryan 👋, We wanted to let you know that a CICD pipeline for this PR just finished successfully. So it might be time to merge this PR or get some approvals. |
| @@ -0,0 +1,105 @@ | |||
| # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. | |||
There was a problem hiding this comment.
I assume, 2025 should be 2026
| self.init_decoding_computer() | ||
| strategy = str(getattr(cfg.asr.decoding, "strategy", "greedy_batch")) | ||
| if strategy not in {"greedy_batch", "malsd_batch"}: | ||
| raise ValueError( |
There was a problem hiding this comment.
The error should be raised as early as possible, before the model is loaded.
|
The rest looks good to me! Just 2–3 minor comments. Ideally, for completeness, you could also add a comparison of greedy decoding, beam search, and beam search with nGPULM, but that's up to you. |
Important
The
Update branchbutton must only be pressed in very rare occassions.An outdated branch is never blocking the merge of a PR.
Please reach out to the automation team before pressing that button.
What does this PR do ?
Add a one line overview of what this PR aims to accomplish.
Collection: [Note which collection this PR will affect]
Changelog
Usage
# Add a code snippet demonstrating how to use thisGitHub Actions CI
The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.
The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".
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.
Additional Information