Zonos2 support - #202
Open
stephen-dwq wants to merge 24 commits into
Open
Conversation
…rocessing for vocode in zonos to avoid token-boundary audio spikes
ZONOS2 (mstar/model/zonos2/*, test/modular/zonos2/*, test/scratch/*):
- Split the sampler so its host-side lifecycle (register / per-step
gather / write-back) runs in preprocess, outside the graph, while the
fixed-shape sample itself is captured inside forward_batched. Decode
now replays as one graph including sampling (H200: 3-8x per step).
- Added get_cuda_graph_configs to declare the decode capture, a
graph-safe sampler ring buffer, and parity tests (deferred-split,
slot-reuse ordering, and eager-vs-captured token-for-token).
Shared engine (mstar/engine/cuda_graph_runner.py, mstar/model/
submodule_base.py):
- Added an optional real_request_ids field to ModelInputsFromEngine,
which the graph runner fills in on the replay path.
Why: when replaying a captured graph the runner hands the submodule a
set of fixed placeholder request ids (one per capture slot), not the
ids of the requests actually running. That's fine for submodules that
keep no per-request state, but any submodule that looks up state by
request id would find the wrong rows. The new field carries the real
ids alongside the placeholders so those lookups stay correct. It's
optional and defaults to unset, so every other model and both eager
paths are completely unaffected.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…and non-safetensor loading into greater m* or kept as special handling in zonos
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.
This PR adds the ZONOS2 TTS model as a served model.
Components
ZONOS2 has three nodes:
LLM,dac_decoder, andspeaker_encoder.LLMKV_CACHELLMprefill,prefill_clone,decode[cb0..cb8, text]per step. Maintains per-request repetition history and performs delayed-EOS detection.dac_decoderSTATELESS(audio_codec)DACdac_chunkLLM, undoes codebook shear, and decodes incrementally through DAC with a 4-frame crossfade overlap. Emits int16 PCM.speaker_encoderSTATELESS(audio_codec)LLMprefill_cloneEach component is small, and thus can be placed on the same node; if we do not colocate we prefer to have
dac_decoderandLLMon the same node. These two have higher traffic thanspeaker_encoderandLLM. The latter two sharing a node gives a shorter TTFT, butdac_decoderandLLMon the same node gives a more consistent ITL.Graph Capturing
We only capture the decode loop of the
LLM, including the multi-codebook sampler. This covers embedding, 28 layers of (QK-norm attention with per-head temperature and headwise gating, and stateful MoE), computation of per-codebook logits, multi-codebook sampling, and repetition penalization.We place a ring buffer for repetition penalty, temperature, top-k, min-p, and per-request RNG state in static slot-indexed buffers for CUDA-capturability of batched sampling.
EOS detection is not captured.
Performance
ZONOS2 ships with a Mini-SGLang server.
We compare batches of 1-8 by steps of x2 with voice cloning:
The above numbers are obtained with the shipped Mini-SGLang server running the
speaker_encoderon CPU as-shipped. For fairness, we also run the shipped Mini-SGLang server withspeaker_encoderon GPU. The below table has M* speed-up values against the shipped Mini-SGLang server in the form (as-shipped /speaker_encoderon GPU):