[Fix] VoxCPM2: support raw audio for voice cloning via OpenAI API#2720
Merged
hsliuustc0106 merged 3 commits intoApr 13, 2026
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
f253551 to
4cb3d9c
Compare
The OpenAI speech API's _resolve_ref_audio returns decoded audio samples [list[float], int] but build_prompt_cache expects a file path string for librosa.load(). This causes voice cloning to fail silently when using the /v1/audio/speech endpoint with ref_audio. Add _encode_raw_audio() that mirrors native _encode_wav but accepts in-memory samples, and _build_prompt_cache() that auto-detects the input format (file path vs raw [samples, sr]) and routes accordingly. Signed-off-by: Yueqian Lin <linyueqian@outlook.com>
4cb3d9c to
59aa005
Compare
Collaborator
Author
Tested on H20 (single GPU, enforce_eager=true, vllm 0.19.0)All three voice cloning modes verified:
The raw audio path simulates what |
Add OpenAI-compatible speech client and README for VoxCPM2 online serving, demonstrating zero-shot synthesis and voice cloning via ref_audio (local file, URL, or base64 data URI). Signed-off-by: Yueqian Lin <linyueqian@outlook.com>
aa86a07 to
6c2dae7
Compare
- Move `import librosa` to top-level imports - Use `tts._encode_sample_rate` directly instead of getattr fallback - Use "sk-empty" as default API key in example client Signed-off-by: Yueqian Lin <linyueqian@outlook.com>
Collaborator
Author
|
@hsliuustc0106 should fix, check again? |
hsliuustc0106
approved these changes
Apr 13, 2026
daixinning
pushed a commit
to daixinning/vllm-omni
that referenced
this pull request
Apr 13, 2026
…lm-project#2720) Signed-off-by: Yueqian Lin <linyueqian@outlook.com>
5 tasks
lengrongfu
pushed a commit
to lengrongfu/vllm-omni
that referenced
this pull request
May 1, 2026
…lm-project#2720) Signed-off-by: Yueqian Lin <linyueqian@outlook.com>
clodaghwalsh17
pushed a commit
to clodaghwalsh17/nm-vllm-omni-ent
that referenced
this pull request
May 12, 2026
…lm-project#2720) Signed-off-by: Yueqian Lin <linyueqian@outlook.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
/v1/audio/speechendpoint withref_audioparameter_resolve_ref_audioreturns decoded audio as[samples_list, sr], butbuild_prompt_cacheexpects a file path string forlibrosa.load()-- this causes voice cloning to silently fail_encode_raw_audio()that mirrors native_encode_wavbut accepts in-memory samples_build_prompt_cache()that auto-detects the input format (file path vs raw[samples, sr]) and routes accordinglyTest plan