Skip to content

Add voxtral tts - #51233

Open
shadril238 wants to merge 3 commits into
huggingface:mainfrom
shadril238:add-voxtral-tts
Open

shadril238 wants to merge 3 commits into
huggingface:mainfrom
shadril238:add-voxtral-tts

Conversation

@shadril238

@shadril238 shadril238 commented Nov 25, 2026 •

Copy link
Copy Markdown

🤗 Transformers CI

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 as mistral_common and loads the voice presets. Batched generation is supported, with left padding and one generator per row.
  • A conversion script from the original checkpoint, plus tests: model, processor, conversion and @slow integration.

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).

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.
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution 🤗!

CI Security Gate — waiting for maintainer approval

CI 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.

@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: auto, voxtral_tts

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Voxtral-4B-TTS-2603 on transformers library

1 participant