Repository navigation
Nemotron VoiceChat STT + TTS joint class - #15456
Conversation
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
272c3a0 to
b415a32
Compare
bfb6da8 to
f632cb5
Compare
0df6e7c to
8940647
Compare
32a1266 to
6c11f0b
Compare
| yield batch | ||
|
|
||
|
|
||
| def collate_and_tokenize_custom( |
There was a problem hiding this comment.
Can we re-use DuplexEarTTSDataset and simply run it on a batch? It looks to me like this data setup code could be sth like this instead:
from ... import DuplexEarTTSDataset
dataloader = torch.utils.data.DataLoader(
DuplexEarTTSDataset(...),
sampler=lhotse.dataset.DynamicCutSampler(load_jsonl(path), max_cuts=batch_size),
batch_size=None,
)There was a problem hiding this comment.
I think we cant do that, because on this script we are creating the target audio as a dummy silence audio and making the speech channel x times longer than text channel len. We are also emulating the silence between turns and so on. DuplexEarTTSDataset is a dataset ready for training and does not support it.
There was a problem hiding this comment.
Hm, how about DuplexEarTTSInferenceDataset (it can be defined locally in the script) so that you're able to hide all this overhead behind a dataloader's worker process (num_workers=1)?
There was a problem hiding this comment.
I can handle this, but I’d prefer to do it in a separate PR. Since this inference recipe won’t be used directly in the release, I’d rather not spend extra time on it now. I can submit a follow-up PR later if that works for you.
| OmegaConf.resolve(cfg) | ||
| torch.distributed.init_process_group(backend="nccl") | ||
| torch.distributed.init_process_group( | ||
| backend="nccl", timeout=datetime.timedelta(seconds=int(cfg.trainer.strategy.get("timeout", 3600))) |
There was a problem hiding this comment.
I can remove it, It was for debug purpose, I had some crashes on cluster so I wanted to set timeout to a small value to crash earlier, but just set on nemo config was not working, the only way to make it work was passing the argument directly to init_process_group.
Should I remove it?
There was a problem hiding this comment.
OK keep but please follow up later with a PR to make this change universal to speechlm2 scripts.
28b2a68 to
7c2f35b
Compare
Signed-off-by: Edresson Casanova <edresson1@gmail.com>
Signed-off-by: Edresson Casanova <edresson1@gmail.com>
Signed-off-by: Edresson Casanova <edresson1@gmail.com>
Signed-off-by: Edresson Casanova <edresson1@gmail.com>
Signed-off-by: Edresson Casanova <edresson1@gmail.com>
Signed-off-by: Edresson Casanova <edresson1@gmail.com>
Co-authored-by: Piotr Żelasko <petezor@gmail.com> Signed-off-by: Edresson Casanova <edresson1@gmail.com>
pzelasko
left a comment
There was a problem hiding this comment.
A few more comments, only the comment under from_pretrained may require a bit more involved work.
| .. code-block:: python | ||
|
|
||
| import torch | ||
| import torchaudio |
There was a problem hiding this comment.
All others models are using it. I think we need to do a full refresh on the docs removing it for all models.
|
|
||
| # Resample to the source_sample_rate (usually 16kHz for STT perception) | ||
| if sample_rate != 16000: | ||
| audio_signal = torchaudio.functional.resample(audio_signal, sample_rate, 16000) |
There was a problem hiding this comment.
Use nemo.collections.audio.parts.utils.transforms.resample instead (same API)
|
|
||
| # Load user audio prompt | ||
| audio_path = "path/to/user_audio.wav" | ||
| audio_signal, sample_rate = torchaudio.load(audio_path) |
There was a problem hiding this comment.
soundfile.read or re-write to leverage`lhotse.Recording.from_file(audio_path).resample(16000).load_audio()
|
|
||
| # Note: If an explicit audio reference is not passed into `offline_inference`, | ||
| # the model relies on the internal config parameters: | ||
| # 1. model.cfg.inference_speaker_name (Highest priority preset, e.g., 'Megan') |
There was a problem hiding this comment.
Show how to select a specific speaker?
Signed-off-by: Edresson Casanova <edresson1@gmail.com>
…sson/NeMo into nemotron_voice_chat_release
Signed-off-by: Edresson <Edresson@users.noreply.github.com>
…sson/NeMo into nemotron_voice_chat_release
Signed-off-by: Edresson Casanova <edresson1@gmail.com>
Signed-off-by: Edresson Casanova <edresson1@gmail.com>
* Add Nemotron VoiceChat inference Class Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Fix EARTTS loading Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Update EARTTS with system prompt Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Add smooth support for audio_prompt_latent Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Undo undesired changes Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Clean up inference script Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Undo undesired changes Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply black Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Rename eval recipe Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Remove unused functions Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Fix lint Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply isort and black reformatting Signed-off-by: Edresson <Edresson@users.noreply.github.com> * Fix Lint checks Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Fix import Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Remove unused imports Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Add Nemotron VoiceChat unit test Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Fix evaluation Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Add latent cache restore on checkpoint load Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Fix lint Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply isort and black reformatting Signed-off-by: Edresson <Edresson@users.noreply.github.com> * Add docs to NemotronVoiceChat class Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Overide from_pretrained to avoid OOM Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply isort and black reformatting Signed-off-by: Edresson <Edresson@users.noreply.github.com> * Remove Duplex EARTTS old eval script Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply isort and black reformatting Signed-off-by: Edresson <Edresson@users.noreply.github.com> * Update EARTTS inference docs Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Remove unused configs from NemotronVoiceChat test set Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Remove unused pretrained_s2s_model Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Update nemo/collections/speechlm2/models/nemotron_voicechat.py Co-authored-by: Piotr Żelasko <petezor@gmail.com> Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply isort and black reformatting Signed-off-by: Edresson <Edresson@users.noreply.github.com> * Remove workaround to support older models Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Update EARTTS inference script Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Update EARTTS dataloader Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply isort and black reformatting Signed-off-by: Edresson <Edresson@users.noreply.github.com> * Use cuts.truncate(keep_excessive_supervisions=False) Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Add Nemotron VoiceChat hugging face export Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply isort and black reformatting Signed-off-by: Edresson <Edresson@users.noreply.github.com> * Update export script Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Update evaluation script and config Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply isort and black reformatting Signed-off-by: Edresson <Edresson@users.noreply.github.com> * Update docs for Nemotron VoiceChat and Duplex EARTTS Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply black Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Fix Duplex EARTTS tests Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply isort and black reformatting Signed-off-by: Edresson <Edresson@users.noreply.github.com> * Fix lint Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply suggestion from @pzelasko Co-authored-by: Piotr Żelasko <petezor@gmail.com> Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Override _from_pretrained instead of from_pretrained Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Apply isort and black reformatting Signed-off-by: Edresson <Edresson@users.noreply.github.com> * Fix lint Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Add data format on docs Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Fix unit test Signed-off-by: Edresson Casanova <edresson1@gmail.com> --------- Signed-off-by: Edresson Casanova <edresson1@gmail.com> Signed-off-by: Edresson <Edresson@users.noreply.github.com> Co-authored-by: Edresson <Edresson@users.noreply.github.com> Co-authored-by: Piotr Żelasko <petezor@gmail.com>
What does this PR do ?
Implement Nemotron VoiceChat STT + TTS joint class to allows inference and also update Duplex EARTTS.
Collection: SpeechLM2
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