Repository navigation
[BugFix][OmniVoice] Add ASR for missing reference text and match audio preprocessing #5784
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
Changes from all commits
cdf1f58
9870d55
dd65a76
fb2e41f
96c2b7c
14583c4
a781e90
bc0b094
2b9c2a4
88203c6
7bc3813
85bcc61
137b33d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -449,15 +449,15 @@ bash examples/online_serving/text_to_speech/glm_tts/run_gradio_demo.sh | |
|
|
||
| ## OmniVoice | ||
|
|
||
| Zero-shot multilingual TTS (600+ languages). Online serving currently exposes **auto voice** only; voice cloning and voice design are available offline. | ||
| OmniVoice creates speech in more than 600 languages. It supports text-to-speech without a reference clip, voice cloning, and voice design. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| ```bash | ||
| huggingface-cli download k2-fsa/OmniVoice | ||
|
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. [P2] The new clone-without-ref-text path Hub-loads openai/whisper-large-v3-turbo (`_… Evidence and suggested fixThe new clone-without-ref-text path Hub-loads openai/whisper-large-v3-turbo ( Evidence: Trigger: follow the rewritten Prerequisites, then the new copy-paste clone-without-ref-text example, with Whisper absent from the HF cache (airgapped / HF_HUB_OFFLINE). Adverse effect: Suggestion: huggingface-cli download k2-fsa/OmniVoice |
||
| ``` | ||
|
|
||
| Voice cloning (offline) needs `transformers>=5.3.0`; auto voice works with `transformers>=4.57.0`. | ||
| Voice cloning needs `transformers>=5.3.0`. When `ref_text` is omitted, OmniVoice loads `openai/whisper-large-v3-turbo` on the worker device to transcribe the reference audio. Set `additional_config.omnivoice_asr.load_asr_on_startup` to `true` to load Whisper during worker startup, or set `additional_config.omnivoice_asr.asr_device` to use another GPU or the CPU. | ||
|
|
||
| ### Launch | ||
|
|
||
|
|
@@ -473,13 +473,35 @@ vllm serve k2-fsa/OmniVoice --omni --port 8091 --trust-remote-code | |
| cd examples/online_serving/text_to_speech/omnivoice | ||
| python speech_client.py --text "Hello, how are you?" | ||
| python speech_client.py --text "Bonjour, comment allez-vous?" --language French | ||
| python speech_client.py --text "hello" --ref-audio /path/to/ref_audio.wav | ||
| ``` | ||
|
|
||
| The client supports `--api-base`, `--model`, `--text`, `--response-format`, `--language`, `--output`. | ||
| The client supports `--api-base`, `--model`, `--text`, `--response-format`, | ||
| `--language`, `--voice`, `--ref-audio`, `--ref-text`, `--instructions`, | ||
| `--seed`, and `--output`. | ||
|
|
||
| ### Notes | ||
|
|
||
| - Voice cloning and voice design require offline inference; see the [offline OmniVoice section](https://github.com/vllm-project/vllm-omni/tree/main/examples/offline_inference/text_to_speech/README.md#omnivoice). | ||
| - The explicit `--ref-text` path is faster because it does not load Whisper. | ||
| - By default, the first request with reference audio and no reference text loads | ||
| `openai/whisper-large-v3-turbo` on the worker device, which adds latency and | ||
| device memory use. Set `additional_config.omnivoice_asr.load_asr_on_startup` to | ||
| `true` to move that load to worker startup. Generated audio is mono at 24 kHz. | ||
|
|
||
| ### Reference audio and output processing | ||
|
|
||
| When a request includes `ref_audio`, OmniVoice prepares the reference clip before it transcribes the clip or builds the voice cloning input. It performs these steps: | ||
|
|
||
| - It converts the clip to mono and resamples it to 24 kHz. | ||
| - It measures the original root mean square (RMS) level. When the RMS is greater than zero and below `0.1`, it raises the waveform level to `0.1` and keeps the original RMS for output volume control. | ||
| - When `ref_text` is omitted, it trims a clip longer than 20 seconds at a detected silence. | ||
| - It removes middle silence and trims silence at both edges whether the transcript is automatic or supplied by the caller. | ||
| - It aligns the sample count down to the audio tokenizer hop size. | ||
| - When `ref_text` is omitted, it sends the prepared waveform to Whisper. | ||
| - It adds a final period for English text or a Chinese full stop for Chinese text when the reference text has no ending punctuation. | ||
| - It sends the same prepared waveform to the audio tokenizer. | ||
|
|
||
| After decoding, OmniVoice processes voice cloning output by removing middle gaps of at least 500 milliseconds and trimming edge silence while keeping 100 milliseconds at each edge. It uses the original reference RMS when the RMS is below `0.1`, and it leaves the level unchanged when the RMS is at least `0.1`. It fades the first and last 100 milliseconds, then adds 100 milliseconds of silence at both edges. Text only output returns the decoder tensor without this processing. | ||
|
|
||
| --- | ||
|
|
||
|
|
||
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.
[suggestion] "removes middle gaps of at least 500 milliseconds" reads as if a 600 ms gap is removed. In
audio.pythe threshold is 500 ms and 500 ms is kept on each side, so only gaps longer than 1 s shrink, and they shrink to 1 s. The same sentence appears in the offline and online text-to-speech example docs. It would also help to say there that the ASR model is downloaded on first use, so offline (HF_HUB_OFFLINE=1) setups need to pre-download it likek2-fsa/OmniVoice.