Skip to content

Streaming transducer inference: fix memory usage, improve WER#15148

Merged
artbataev merged 8 commits intomainfrom
vbataev/fix_streaming_infer_rnnt
Dec 6, 2025
Merged

Streaming transducer inference: fix memory usage, improve WER#15148
artbataev merged 8 commits intomainfrom
vbataev/fix_streaming_infer_rnnt

Conversation

@artbataev
Copy link
Copy Markdown
Collaborator

@artbataev artbataev commented Dec 4, 2025

Important

The Update branch button 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 ?

Fix streaming inference pipeline introduced in #9106

  • fix memory consumption when using small chunks
    • fix memory used by BatchedHyps when merging (extend only if necessary)
    • use PYTORCH_CUDA_ALLOC_CONF with expandable_segments:True: this can improve memory usage (reserved memory) by >3x (in some cases, where chunk=1 frame (0.08s) – more than 10x)
  • fix number of frames to decode in the last chunk: improves WER on datasets where end of the audio still contains speech (no silence)

Streaming results comparison

Configuration:

  • model: nvidia/parakeet-rnnt-1.1b
  • contexts: left=10, chunk=0.16, right=0.8
  • batch size: 32
  • compute dtype: bfloat16
LS test-other AMI
WER before 3.77 17.90
WER this PR 3.77 17.79
time before 2:57 3:45
time this PR 2:53 3:40
GPU memory allocated before 8.02 GB 8.02 GB
GPU memory allocated this PR 8.01 GB 8.01 GB
GPU memory reserved before 26.17 GB 26.17 GB
GPU memory reserved this PR 8.05 GB 8.05 GB

Collection: [ASR]

Changelog

  • Add specific line by line info of high level changes in this PR.

Usage

  • You can potentially add a usage example below
 python examples/asr/asr_chunked_inference/rnnt/speech_to_text_streaming_infer_rnnt.py \
    pretrained_name="nvidia/parakeet-rnnt-1.1b" \
    audio_dir="<dir_with_audio>" \
    output_filename="decoded.jsonl" \
    right_context_secs=1 \
    chunk_secs=0.16 \
    left_context_secs=10 \
    batch_size=32

GitHub 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:

  • 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)

Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>
Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>
Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>
Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>
@github-actions github-actions bot added the ASR label Dec 4, 2025
Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>
Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>
Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>
@artbataev artbataev marked this pull request as ready for review December 5, 2025 13:15
@github-actions github-actions bot removed the Run CICD label Dec 5, 2025
@artbataev artbataev changed the title Fix streaming transducer inference Streaming transducer inference: fix memory usage, improve WER Dec 5, 2025
Copy link
Copy Markdown
Collaborator

@andrusenkoau andrusenkoau left a comment

Choose a reason for hiding this comment

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

Great work, thank you!

@github-actions github-actions bot removed the Run CICD label Dec 5, 2025
@artbataev artbataev enabled auto-merge (squash) December 5, 2025 22:56
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 6, 2025

[🤖]: Hi @artbataev 👋,

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.

//cc @chtruong814 @ko3n1g @pablo-garay @thomasdhc

@artbataev artbataev merged commit 18e9286 into main Dec 6, 2025
861 of 918 checks passed
@artbataev artbataev deleted the vbataev/fix_streaming_infer_rnnt branch December 6, 2025 12:57
quapham pushed a commit to quapham/NeMo that referenced this pull request Dec 16, 2025
…-NeMo#15148)

* Fix last batch
* Fix merging batched hyps
* Fix PyTorch memory reservation

Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>

---------

Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>
Signed-off-by: quanpham <youngkwan199@gmail.com>
AkCodes23 pushed a commit to AkCodes23/NeMo that referenced this pull request Jan 28, 2026
…-NeMo#15148)

* Fix last batch
* Fix merging batched hyps
* Fix PyTorch memory reservation

Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>

---------

Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>
Signed-off-by: Akhil Varanasi <akhilvaranasi23@gmail.com>
nune-tadevosyan pushed a commit to nune-tadevosyan/NeMo that referenced this pull request Mar 13, 2026
…-NeMo#15148)

* Fix last batch
* Fix merging batched hyps
* Fix PyTorch memory reservation

Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>

---------

Signed-off-by: Vladimir Bataev <vbataev@nvidia.com>
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.

2 participants