-
Notifications
You must be signed in to change notification settings - Fork 395
[Test] Add e2e tests for Qwen3-TTS speech endpoint #1206
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
linyueqian
wants to merge
9
commits into
vllm-project:main
Choose a base branch
from
linyueqian:test/qwen3-tts-e2e
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.
+565
−1
Open
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
27db78d
Add e2e tests for Qwen3-TTS to prevent regression in audio output
linyueqian 79677e2
Add Speech API documentation and fix e2e test fixtures
linyueqian e31a8e8
Merge branch 'main' into test/qwen3-tts-e2e
linyueqian 7207e5b
Update port from 8000 to 8091 in Speech API documentation
linyueqian 555342f
Add Qwen3-TTS e2e test to Buildkite pipeline
linyueqian a92c32b
Merge branch 'main' into test/qwen3-tts-e2e
linyueqian 72a9c36
Format server commands with one argument per line
linyueqian 90bf05e
Address PR review: add hardware_test decorators and fix doc server flags
linyueqian 94e4089
Merge branch 'main' into test/qwen3-tts-e2e
linyueqian 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
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 |
|---|---|---|
| @@ -0,0 +1,254 @@ | ||
| # Speech API | ||
|
|
||
| vLLM-Omni provides an OpenAI-compatible API for text-to-speech (TTS) generation using Qwen3-TTS models. | ||
|
|
||
| Each server instance runs a single model (specified at startup via `vllm serve <model> --omni`). | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### Start the Server | ||
|
|
||
| ```bash | ||
| # CustomVoice model (predefined speakers) | ||
| vllm serve Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice \ | ||
| --stage-configs-path vllm_omni/model_executor/stage_configs/qwen3_tts.yaml \ | ||
| --omni --port 8000 --trust-remote-code --enforce-eager | ||
| ``` | ||
|
|
||
| ### Generate Speech | ||
|
|
||
| **Using curl:** | ||
|
|
||
| ```bash | ||
| curl -X POST http://localhost:8000/v1/audio/speech \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "input": "Hello, how are you?", | ||
| "voice": "vivian", | ||
| "language": "English" | ||
| }' --output output.wav | ||
| ``` | ||
|
|
||
| **Using Python:** | ||
|
|
||
| ```python | ||
| import httpx | ||
|
|
||
| response = httpx.post( | ||
| "http://localhost:8000/v1/audio/speech", | ||
| json={ | ||
| "input": "Hello, how are you?", | ||
| "voice": "vivian", | ||
| "language": "English", | ||
| }, | ||
| timeout=300.0, | ||
| ) | ||
|
|
||
| with open("output.wav", "wb") as f: | ||
| f.write(response.content) | ||
| ``` | ||
|
|
||
| **Using OpenAI SDK:** | ||
|
|
||
| ```python | ||
| from openai import OpenAI | ||
|
|
||
| client = OpenAI(base_url="http://localhost:8000/v1", api_key="none") | ||
|
|
||
| response = client.audio.speech.create( | ||
| model="Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice", | ||
| voice="vivian", | ||
| input="Hello, how are you?", | ||
| ) | ||
|
|
||
| response.stream_to_file("output.wav") | ||
| ``` | ||
|
|
||
| ## API Reference | ||
|
|
||
| ### Endpoint | ||
|
|
||
| ``` | ||
| POST /v1/audio/speech | ||
| Content-Type: application/json | ||
| ``` | ||
|
|
||
| ### Request Parameters | ||
|
|
||
| #### OpenAI Standard Parameters | ||
|
|
||
| | Parameter | Type | Default | Description | | ||
| |-----------|------|---------|-------------| | ||
| | `input` | string | **required** | The text to synthesize into speech | | ||
| | `model` | string | server's model | Model to use (optional, should match server if specified) | | ||
| | `voice` | string | "vivian" | Speaker name (e.g., vivian, ryan, aiden) | | ||
| | `response_format` | string | "wav" | Audio format: wav, mp3, flac, pcm, aac, opus | | ||
| | `speed` | float | 1.0 | Playback speed (0.25-4.0) | | ||
|
|
||
| #### vLLM-Omni Extension Parameters | ||
|
|
||
| | Parameter | Type | Default | Description | | ||
| |-----------|------|---------|-------------| | ||
| | `task_type` | string | "CustomVoice" | TTS task type: CustomVoice, VoiceDesign, or Base | | ||
| | `language` | string | "Auto" | Language (see supported languages below) | | ||
| | `instructions` | string | "" | Voice style/emotion instructions | | ||
| | `max_new_tokens` | integer | 2048 | Maximum tokens to generate | | ||
|
|
||
| **Supported languages:** Auto, Chinese, English, Japanese, Korean, German, French, Russian, Portuguese, Spanish, Italian | ||
|
|
||
| #### Voice Clone Parameters (Base task) | ||
|
|
||
| | Parameter | Type | Default | Description | | ||
| |-----------|------|---------|-------------| | ||
| | `ref_audio` | string | null | Reference audio (URL or base64 data URL) | | ||
| | `ref_text` | string | null | Transcript of reference audio | | ||
| | `x_vector_only_mode` | bool | null | Use speaker embedding only (no ICL) | | ||
|
|
||
| ### Response Format | ||
|
|
||
| Returns binary audio data with appropriate `Content-Type` header (e.g., `audio/wav`). | ||
|
|
||
| ### Voices Endpoint | ||
|
|
||
| ``` | ||
| GET /v1/audio/voices | ||
| ``` | ||
|
|
||
| Lists available voices for the loaded model. | ||
|
|
||
| ```json | ||
| { | ||
| "voices": ["aiden", "dylan", "eric", "ono_anna", "ryan", "serena", "sohee", "uncle_fu", "vivian"] | ||
| } | ||
| ``` | ||
|
|
||
| ## Examples | ||
|
|
||
| ### CustomVoice with Style Instruction | ||
|
|
||
| ```bash | ||
| curl -X POST http://localhost:8000/v1/audio/speech \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "input": "I am so excited!", | ||
| "voice": "vivian", | ||
| "instructions": "Speak with great enthusiasm" | ||
| }' --output excited.wav | ||
| ``` | ||
|
|
||
| ### VoiceDesign (Natural Language Voice Description) | ||
|
|
||
| ```bash | ||
| # Start server with VoiceDesign model first | ||
| vllm serve Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign \ | ||
| --stage-configs-path vllm_omni/model_executor/stage_configs/qwen3_tts.yaml \ | ||
| --omni --port 8000 --trust-remote-code --enforce-eager | ||
linyueqian marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| ```bash | ||
| curl -X POST http://localhost:8000/v1/audio/speech \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "input": "Hello world", | ||
| "task_type": "VoiceDesign", | ||
| "instructions": "A warm, friendly female voice with a gentle tone" | ||
| }' --output designed.wav | ||
| ``` | ||
|
|
||
| ### Base (Voice Cloning) | ||
|
|
||
| ```bash | ||
| # Start server with Base model first | ||
| vllm serve Qwen/Qwen3-TTS-12Hz-1.7B-Base \ | ||
| --stage-configs-path vllm_omni/model_executor/stage_configs/qwen3_tts.yaml \ | ||
| --omni --port 8000 --trust-remote-code --enforce-eager | ||
| ``` | ||
|
|
||
| ```bash | ||
| curl -X POST http://localhost:8000/v1/audio/speech \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "input": "Hello, this is a cloned voice", | ||
| "task_type": "Base", | ||
| "ref_audio": "https://example.com/reference.wav", | ||
| "ref_text": "Original transcript of the reference audio" | ||
| }' --output cloned.wav | ||
| ``` | ||
|
|
||
| ## Supported Models | ||
|
|
||
| | Model | Task Type | Description | | ||
| |-------|-----------|-------------| | ||
| | `Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice` | CustomVoice | Predefined speaker voices with optional style control | | ||
| | `Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign` | VoiceDesign | Natural language voice style description | | ||
| | `Qwen/Qwen3-TTS-12Hz-1.7B-Base` | Base | Voice cloning from reference audio | | ||
| | `Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice` | CustomVoice | Smaller/faster variant | | ||
| | `Qwen/Qwen3-TTS-12Hz-0.6B-Base` | Base | Smaller/faster variant for voice cloning | | ||
|
|
||
| ## Error Responses | ||
|
|
||
| ### 400 Bad Request | ||
|
|
||
| Invalid parameters: | ||
|
|
||
| ```json | ||
| { | ||
| "error": { | ||
| "message": "Input text cannot be empty", | ||
| "type": "BadRequestError", | ||
| "param": null, | ||
| "code": 400 | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### 404 Not Found | ||
|
|
||
| Model not found: | ||
|
|
||
| ```json | ||
| { | ||
| "error": { | ||
| "message": "The model `xxx` does not exist.", | ||
| "type": "NotFoundError", | ||
| "param": "model", | ||
| "code": 404 | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### "TTS model did not produce audio output" | ||
|
|
||
| Ensure you're using the correct model variant for your task type: | ||
| - CustomVoice task → CustomVoice model | ||
| - VoiceDesign task → VoiceDesign model | ||
| - Base task → Base model | ||
|
|
||
| ### Server Not Running | ||
|
|
||
| ```bash | ||
| # Check if server is responding | ||
| curl http://localhost:8000/v1/audio/voices | ||
| ``` | ||
|
|
||
| ### Out of Memory | ||
|
|
||
| If you encounter OOM errors: | ||
| 1. Use smaller model variant: `Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice` | ||
| 2. Reduce `--gpu-memory-utilization` | ||
|
|
||
| ### Unsupported Speaker | ||
|
|
||
| Use `/v1/audio/voices` to list available voices for the loaded model. | ||
|
|
||
| ## Development | ||
|
|
||
| Enable debug logging: | ||
|
|
||
| ```bash | ||
| vllm serve Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice \ | ||
| --stage-configs-path vllm_omni/model_executor/stage_configs/qwen3_tts.yaml \ | ||
| --omni --uvicorn-log-level debug | ||
| ``` | ||
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 |
|---|---|---|
|
|
@@ -203,5 +203,5 @@ extend-ignore-identifiers-re = [ | |
| ".*nothink.*", | ||
| ".*NOTHINK.*", | ||
| ".*nin.*", | ||
| "Ono_Anna", | ||
| ".*[Oo]no_[Aa]nna.*", | ||
| ] | ||
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.
Uh oh!
There was an error while loading. Please reload this page.