-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[speechlm2] Add streaming inference pipeline for NemotronVoiceChat #15571
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
Open
erastorgueva-nv
wants to merge
39
commits into
NVIDIA-NeMo:main
Choose a base branch
from
erastorgueva-nv:duplex-realtime-inference-rebase
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
85f9406
add changes from duplex-realtime-inference branch, except duplex_stt_…
erastorgueva-nv 98da1ad
add on: asr_logits boosts, speaker embedding, fc head
erastorgueva-nv 52813de
add use_llm_cache option, will use HybridMambaAttentionDynamicCache, …
erastorgueva-nv a65916a
add tts inference speedups: vectorize depthsum, precompute rvq schedu…
erastorgueva-nv 2b21753
allow using speaker_latent with vllm (need to update vllm eartts.py)
erastorgueva-nv 11abaa0
add flag for speaker_name if doing standalone inference
erastorgueva-nv 0b506b2
remove standalone code path; add parity check for offline vs streamin…
erastorgueva-nv a7c61d9
skip pretrained ASR/LLM downloads in from_pretrained; simplify infere…
erastorgueva-nv 40475f0
quickfix for parity harness regarding speaker name / reference in tts
erastorgueva-nv 1449183
speed up model loading: use meta device, dont get codec silence token…
erastorgueva-nv ef06833
normalize indentation to 4-space
erastorgueva-nv a485dcc
remove hardcoded env var, simple tidy: remove dead code atc
erastorgueva-nv dd88987
always use codec cache => remove use_codec_cache flag and codec_token…
erastorgueva-nv adc42f7
remove newlines in logs
erastorgueva-nv 8babc04
further tidying: pass StreamingDecodeState directly, return Inference…
erastorgueva-nv 0285589
Add pytest-based offline vs. incremental inference parity test with l…
erastorgueva-nv a918f7f
refactor streaming S2S pipeline: extract helpers, factor infer_one_st…
erastorgueva-nv 277511b
in test: use existing audio file, allow system prompt, specify params…
erastorgueva-nv dc6a759
Refactor voicechat tests: shared fixtures, no-crash sweep, determinis…
erastorgueva-nv 6e98c85
Fix byte-level BPE decoding in raw output: unify tokens_to_str and to…
erastorgueva-nv 819e5f4
use whisper normalizer for wer calculation
erastorgueva-nv e8e7151
remove unnecessary logging in perception cache step
erastorgueva-nv eebea30
vectorize rep penalty; fix sampling - nan/inf check before top-p filt…
erastorgueva-nv de230d9
Preserve BOS/EOS as literal strings in decoded text output
erastorgueva-nv 8b849c1
update triton code; bugfix for vllm dtype/device
erastorgueva-nv d3db700
Always send prefill before audio streaming; fix bfloat16 audio output
erastorgueva-nv 81a752e
remove triton code to keep PR simple
erastorgueva-nv b7673a4
add missing __init__.py
erastorgueva-nv df2e3bb
use built-in type hints (X | None, dict, list) instead of typing imports
erastorgueva-nv c3c0d7e
use nemo_asr.metrics.wer.word_error_rate for wer calc
erastorgueva-nv 770efb4
use SimpleTimer in s2s_streaming_infer.py script
erastorgueva-nv 89f818f
simplify flow for prefill and use per-stream options, including sampl…
erastorgueva-nv 3e9e3e1
perception_cache: check all three fields in is_initialized
erastorgueva-nv 84eeec5
move silence padding from pipeline run-loop into streamer classes
erastorgueva-nv 800bcc2
return incremental GenerateStepOutput from generate_step
erastorgueva-nv 88543cf
refactor: split model_factory into backend/ modules; unify vLLM engin…
erastorgueva-nv e0db2ca
address CodeQL errors
erastorgueva-nv 65d14e6
Clean up debug/logging: logger pattern, keep logits on GPU, per-frame…
erastorgueva-nv c3af8fa
Add per-step progress bar, timing summary, and pad-visible logging
erastorgueva-nv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -246,7 +246,35 @@ You can evaluate and run full-duplex inference using the `NemotronVoiceChat` pip | |
|
|
||
| print(f"Agent response: {generated_text}") | ||
| # generated_speech can now be saved or played (sampled at model.target_sample_rate) | ||
|
|
||
|
|
||
| NemotronVoiceChat Streaming Inference | ||
| ************************************* | ||
|
|
||
| For real-time, chunk-by-chunk inference (as opposed to the offline mode shown | ||
| above), use the Streaming S2S Pipeline: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from nemo.collections.speechlm2.inference import S2SPipelineBuilder | ||
|
|
||
| pipeline = S2SPipelineBuilder.build_pipeline(cfg) | ||
| output = pipeline.run(audio_filepaths, options=options) | ||
|
|
||
| Or from the command line: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| python examples/speechlm2/nemo_inference_pipelines/s2s_streaming_infer.py \ | ||
| audio_file=/path/to/audio \ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both examples here showcase |
||
| s2s.model_path=/path/to/checkpoint \ | ||
| s2s.speaker_name="<speaker>" \ | ||
| s2s.engine_type=native \ | ||
| s2s.system_prompt="You are a helpful assistant." \ | ||
| streaming.chunk_size_in_secs=0.24 \ | ||
| streaming.buffer_size_in_secs=1.68 | ||
|
|
||
| See :doc:`streaming_inference` for full details on configuration, architecture, | ||
| and server integration. | ||
|
|
||
| Training a Model | ||
| ---------------- | ||
|
|
@@ -341,3 +369,4 @@ For more information, see additional sections in the SpeechLM2 docs: | |
| datasets | ||
| configs | ||
| training_and_scaling | ||
| streaming_inference | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does this assume a single-turn evaluation? Or the audio file can have multiple turns and the agent is expected to handle that correctly? Let's clarify this in the docs.
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.
Not sure what you mean - it's full-duplex, so it just generates one frame of output for every frame of audio input. Audio input can contain single-turn, muti-turn, whatever.
Or if you're asking about "evaluation" - the code doesn't support detailed "evaluation". We just generate text & audio for the full audio file (plus with an option to add silence padding at the end, so the agent can finish speaking). The one bit of "evaluation" we have is WER
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.
Let's write these in here - it's not obvious for outside reader what characterizes the inputs and outputs in this API.