CoolFace
Modelpublic

mlx-community/Zyphra-ZONOS2

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
3likes126downloads
Model Card

ZONOS2

ZONOS2 is Zyphra's autoregressive text-to-speech model with multi-codebook audio generation, 44.1 kHz DAC decode, and speaker conditioning from reference audio.

Original model: Zyphra/ZONOS2

Supported Repositories

RepositoryFormatNotes
mlx-community/Zyphra-ZONOS2BF16Official MLX conversion for mlx-audio

Installation

pip install mlx-audio

Usage

Python API:

python
from mlx_audio.audio_io import write as audio_write
from mlx_audio.tts import load

model = load("mlx-community/Zyphra-ZONOS2", lazy=True)

result = next(model.generate(
    text="Hello, this is ZONOS two running locally with MLX audio.",
    max_tokens=220,
))

audio_write("zonos2.wav", result.audio, result.sample_rate)

Voice Cloning

Pass a short reference clip with ref_audio. Clean speech-only clips work best.

python
result = next(model.generate(
    text="This text will be spoken with the reference speaker.",
    ref_audio="speaker.wav",
    max_tokens=220,
))

You can also compute the speaker embedding once and reuse it from the Python API:

python
speaker = model.extract_speaker_embedding("speaker.wav")

result = next(model.generate(
    text="This reuses a precomputed speaker embedding.",
    speaker_embedding=speaker,
    max_tokens=220,
))

CLI

bash
python -m mlx_audio.tts.generate \
  --model mlx-community/Zyphra-ZONOS2 \
  --text "Hello, this is ZONOS two running with MLX audio." \
  --output_path outputs \
  --file_prefix zonos2

Voice cloning:

bash
python -m mlx_audio.tts.generate \
  --model mlx-community/Zyphra-ZONOS2 \
  --text "This text will use the voice from the reference clip." \
  --ref_audio speaker.wav \
  --output_path outputs \
  --file_prefix zonos2_clone

Generation Parameters

ParameterDefaultDescription
ref_audioNoneReference audio path or array for voice cloning
speaker_embeddingNonePrecomputed 2048-D speaker embedding, Python API only
max_tokens1024Maximum number of audio token frames
temperature1.15Sampling temperature
top_k106Top-k sampling filter
top_p0.0Nucleus sampling filter, disabled at 0
min_p0.18Minimum-probability sampling filter
repetition_penalty1.2Repetition penalty applied to recent audio tokens
seedNoneSeed for deterministic sampling
text_normalizationTrueEnglish text normalization toggle, Python API only

Notes

License

See the Zyphra/ZONOS2 model card for upstream license and usage details.