Repository navigation
Add voxtral tts - #51233
Open
shadril238 wants to merge 3 commits into
Open
Add voxtral tts#51233shadril238 wants to merge 3 commits into
shadril238 wants to merge 3 commits into
Conversation
Adds native support for Mistral's Voxtral 4B TTS model: - VoxtralTtsForTextToSpeech: a Mistral language model prompted with a voice preset, a flow-matching acoustic transformer predicting the 37 codes of each 80 ms frame (greedy semantic code, Euler integration with classifier-free guidance for the 36 acoustic values), and a causal codec decoder (sliding-window ALiBi transformers) producing 24 kHz audio. - VoxtralTtsProcessor: builds the same prompts as mistral_common's `encode_speech_request` and loads the 20 voice presets from `voice_embeddings.safetensors`. - Conversion script from the original checkpoint (weight norm folded, RoPE permutation for the language model). Validated against a transcription of the vllm-omni reference: the acoustic transformer and codec match it to ~1e-6 in fp32 (identical codes), and the bf16 language model hidden states to ~1.5%. Generated audio is transcribed correctly by Whisper (English and French, single and batched). Fixes huggingface#45027
…ion tests - `generate` decodes the codec in independent chunks of 375 frames (30 s), as the vllm-omni reference does. This bounds the dense ALiBi/sliding-window attention mask: decoding 80 s of audio goes from 4.2 GB to 1.8 GB peak RSS. - Integration tests check teacher-forced semantic codes, acoustic codes from fixed noise and a codec waveform slice against the reference, instead of free-running bf16 codes that are not reproducible across devices.
…r tests - `generate` accepts one `torch.Generator` per batch element, so the audio of a sequence does not depend on the rest of the batch (on the released model in bf16, batched and single generations give identical codes). - Sequences that emitted `[END_AUDIO]` are dropped from the KV cache and every per-row tensor, instead of running the model until the longest one ends. - Tests for the conversion script on a tiny checkpoint in the original layout: strict loading, tensor-to-parameter mapping, RoPE permutation against the interleaved formulation, and weight-norm folding.
Contributor
|
Thank you for your contribution 🤗! CI Security Gate — waiting for maintainer approvalCI is approved automatically only for authors who already have a contribution merged in this repository. A maintainer will review this PR and approve CI to run on it. |
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: auto, voxtral_tts |
This branch has not been deployed
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.
What does this PR do?
Adds native support for Voxtral-4B-TTS-2603 (Mistral's multilingual TTS model with 20 preset voices). Currently it only runs through vllm-omni.
Fixes #45027
VoxtralTtsForTextToSpeech(modular): a Mistral LM prompted with a voice preset, a flow-matching acoustic transformer that predicts the 37 codes of each 80 ms frame, and a causal codec decoder (sliding-window ALiBi attention) that outputs 24 kHz audio.VoxtralTtsProcessor: builds the same prompts asmistral_commonand loads the voice presets. Batched generation is supported, with left padding and one generator per row.@slowintegration.Validation against the vllm-omni reference: the acoustic transformer and codec match to ~1e-6 in fp32 (identical codes), and the LM hidden states to ~1.5% in bf16. Whisper transcribes the generated audio correctly (English and French, single and batched).