[Edge][WP5] Add codec-token streaming mode with on-device decoding

* qwen3_tts_talker_only pipeline (single terminal LLM_AR stage,
  final_output_type "latent") + vllm_omni/deploy/qwen3_tts_talker_only.yaml;
  a terminal talker publishes its per-step codes.audio rows to the client
  (omni_client_multimodal_output_keys).
* /v1/audio/speech/stream: session.config.output_mode="codec_tokens" streams
  codec.start (JSON) + binary frames (<IHB seq/n_frames/flags + int16 rows,
  vllm_omni/entrypoints/openai/codec_stream.py) + codec.done; new input.cancel
  message aborts an in-flight generation for both codec and PCM sessions
  (single reader task + session inbox replaces direct socket reads); optional
  session.config.seed; audio.done gains "cancelled" only when it happened.
* serving_speech._generate_codec_chunks aligns the cumulative code tensor to
  output token ids (drops prefill placeholder/EOS rows) and emits deltas.
* TTS adapters: supports_codec_stream / codec_stream_spec (Qwen3-TTS: 16
  codebooks, 2048 ids, 12.5 Hz, 24 kHz, decoder qwen3_tts_tokenizer_v2_12hz).
* examples/online_serving/text_to_speech/qwen3_tts/edge_decoder_client.py
  decodes locally with Qwen3TTSTokenizerV2Decoder (ramp schedule, 72-frame
  context, cancel/reset), codec_parity_check.py and
  benchmarks/tts/codec_stream_e2e.py compare against the two-stage server.
* docs/serving/codec_token_streaming.md; CPU unit tests for the wire format,
  alignment, session config and handler (frames, unsupported adapter, cancel);
  L3 e2e tests/e2e/online_serving/test_qwen3_tts_codec_stream.py.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
tzhouamandClaude Fable 5.1 committed 2026-09-09 11:10:13 +08:00
1 parent 35e43b9983
commit 49a839ecf9
16 files changed
+1533 -6

No files matched your search

@@ -578,9 +578,26 @@ class StreamingSpeechSessionConfig(BaseModel):
"frames (existing behavior)."
),
)
seed: int | None = Field(default=None, description="Random seed forwarded to each utterance request.")
output_mode: Literal["pcm", "codec_tokens"] = Field(
default="pcm",
description=(
"'pcm' streams decoded audio. 'codec_tokens' streams the talker's codec frames "
"(binary frames described by a 'codec.start' message) for decoding on the client "
"device; requires a talker-only deployment (e.g. deploy config qwen3_tts_talker_only.yaml), "
"stream_audio=true, response_format='pcm' and word_timestamps=false."
),
)
@model_validator(mode="after")
def validate_streaming_constraints(self) -> "StreamingSpeechSessionConfig":
if self.output_mode == "codec_tokens":
if not self.stream_audio:
raise ValueError("output_mode='codec_tokens' requires stream_audio=true.")
if self.word_timestamps:
raise ValueError("output_mode='codec_tokens' does not support word_timestamps.")
if self.response_format != "pcm":
raise ValueError("output_mode='codec_tokens' requires response_format='pcm'.")
if self.stream_audio:
if self.response_format != "pcm":
raise ValueError(