Text-to-Speech
MLX
Safetensors
Zonos
English
apple-silicon
tts
voice-cloning
zonos2
Mixture of Experts
Instructions to use shraey/zonos2-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use shraey/zonos2-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir zonos2-mlx shraey/zonos2-mlx
- Zonos
How to use shraey/zonos2-mlx with Zonos:
# pip install git+https://github.com/Zyphra/Zonos.git import torchaudio from zonos.model import Zonos from zonos.conditioning import make_cond_dict model = Zonos.from_pretrained("shraey/zonos2-mlx", device="cuda") wav, sr = torchaudio.load("speaker.wav") # 5-10s reference clip speaker = model.make_speaker_embedding(wav, sr) cond = make_cond_dict(text="Hello, world!", speaker=speaker, language="en-us") codes = model.generate(model.prepare_conditioning(cond)) audio = model.autoencoder.decode(codes)[0].cpu() torchaudio.save("sample.wav", audio, model.autoencoder.sampling_rate) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: mlx
|
| 4 |
+
pipeline_tag: text-to-speech
|
| 5 |
+
base_model: drbaph/ZONOS2-BF16
|
| 6 |
+
tags:
|
| 7 |
+
- mlx
|
| 8 |
+
- apple-silicon
|
| 9 |
+
- text-to-speech
|
| 10 |
+
- tts
|
| 11 |
+
- voice-cloning
|
| 12 |
+
- zonos
|
| 13 |
+
- zonos2
|
| 14 |
+
- moe
|
| 15 |
+
language:
|
| 16 |
+
- en
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# zonos2-mlx β ready-to-run MLX weights
|
| 20 |
+
|
| 21 |
+
Pre-converted, pre-quantized [MLX](https://github.com/ml-explore/mlx) weights for Zyphra's
|
| 22 |
+
[**ZONOS2**](https://github.com/Zyphra/ZONOS2) β an **8B-parameter Mixture-of-Experts**
|
| 23 |
+
autoregressive text-to-speech model β running natively on Apple Silicon.
|
| 24 |
+
|
| 25 |
+
**Download and run. No PyTorch in the inference path, no conversion step.**
|
| 26 |
+
|
| 27 |
+
- π§ **Model:** 16-expert top-1 MoE AR trunk (layer 26 routes top-2) β DAC 44.1 kHz neural codec for the waveform, with an ECAPA-TDNN speaker encoder (+ LDA) for zero-shot voice cloning from a short reference clip.
|
| 28 |
+
- π **Runtime:** [`sb1992/mlx-zonos2`](https://github.com/sb1992/mlx-zonos2) β a clean-room MLX reimplementation of the inference runtime, gated per-stage against the original PyTorch model.
|
| 29 |
+
- π¦ **This repo:** the weights only. Three precision tiers, each a **self-contained folder**.
|
| 30 |
+
|
| 31 |
+
## Tiers
|
| 32 |
+
|
| 33 |
+
Each folder (`bf16/`, `int8/`, `int4/`) is **self-contained** β it bundles the quantized trunk
|
| 34 |
+
plus the (tier-independent) DAC codec and ECAPA speaker encoder, so you download **one folder**
|
| 35 |
+
and it just runs.
|
| 36 |
+
|
| 37 |
+
| Folder | what's quantized | folder size | peak RAM | target Macs |
|
| 38 |
+
|---|---|---|---|---|
|
| 39 |
+
| `bf16/` | nothing (reference) | ~14 GB | ~44 GB | 64 GB |
|
| 40 |
+
| `int8/` | attention/FFN/lm_head + experts int8; router/embeddings/norms bf16 | ~7.9 GB | ~13 GB | 32 GB |
|
| 41 |
+
| `int4/` | attention/FFN/lm_head int8; experts gate/up int4, down int8; router/embeddings/norms bf16 | ~5.7 GB | ~10.6 GB | 16 GB |
|
| 42 |
+
|
| 43 |
+
<sub>Folder size includes the bundled ~315 MB DAC codec + ECAPA speaker encoder (identical across
|
| 44 |
+
tiers β Hugging Face Xet de-dups them, so they cost storage only once).</sub>
|
| 45 |
+
|
| 46 |
+
The MoE experts (the bulk of the 8B) carry the int4; the **router/gate**, the **`lm_head`**, and
|
| 47 |
+
the sensitive expert **`down`** projection stay int8/bf16 β the MoE-quant recipe that keeps the
|
| 48 |
+
model intact. All three tiers produce **full, intelligible audio** β they're equal options, pick
|
| 49 |
+
by the RAM you have.
|
| 50 |
+
|
| 51 |
+
## Quick start
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
# 1. get the runtime
|
| 55 |
+
git clone https://github.com/sb1992/mlx-zonos2.git
|
| 56 |
+
cd mlx-zonos2
|
| 57 |
+
uv sync --extra oracle # `oracle` extra = torchaudio, for enrolling a voice from raw audio
|
| 58 |
+
|
| 59 |
+
# 2. download one tier (self-contained: trunk + DAC + speaker encoder)
|
| 60 |
+
hf download shraey/zonos2-mlx --include "int8/*" --local-dir ./zonos2-mlx-weights
|
| 61 |
+
|
| 62 |
+
# 3. clone a voice + synthesize
|
| 63 |
+
python scripts/zonos2_cli.py \
|
| 64 |
+
--model-dir ./zonos2-mlx-weights/int8 \
|
| 65 |
+
--text "The quick brown fox jumps over the lazy dog." \
|
| 66 |
+
--ref ref.wav \
|
| 67 |
+
--out out.wav
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
Swap `int8` β `int4` (16 GB Macs) or `bf16` (64 GB Macs) β same flow, just point `--model-dir`
|
| 71 |
+
at the folder you downloaded. To grab every tier at once, drop the `--include` filter.
|
| 72 |
+
|
| 73 |
+
`--ref` enrolls a reference clip on the fly (needs the `oracle` extra for the mel front-end). You
|
| 74 |
+
can also enroll a voice **once** into a small `.zonos` profile and reuse it β then generation is
|
| 75 |
+
pure-MLX with no torch. See the [runtime repo](https://github.com/sb1992/mlx-zonos2) for the
|
| 76 |
+
Python API, the enroll-once flow, and the full parity report.
|
| 77 |
+
|
| 78 |
+
## Responsible use
|
| 79 |
+
|
| 80 |
+
This performs **zero-shot voice cloning** β it can reproduce a person's voice from a few seconds
|
| 81 |
+
of audio. Use it responsibly: no impersonation, fraud, or disinformation; only clone voices you
|
| 82 |
+
own or have explicit consent for; disclose AI-generated audio wherever it's published. See the
|
| 83 |
+
[runtime repo](https://github.com/sb1992/mlx-zonos2) for the full policy.
|
| 84 |
+
|
| 85 |
+
## Attribution + license
|
| 86 |
+
|
| 87 |
+
This is a derivative port. The components it builds on are each independently licensed:
|
| 88 |
+
|
| 89 |
+
- **ZONOS2** β **Apache-2.0**, Β© [Zyphra](https://www.zyphra.com/). The 8B-MoE model, the DAC
|
| 90 |
+
44.1 kHz codec, and the speaker encoder are Zyphra's. [Code](https://github.com/Zyphra/ZONOS2)
|
| 91 |
+
- **Released checkpoint** β this port converts the [`drbaph/ZONOS2-BF16`](https://huggingface.co/drbaph/ZONOS2-BF16)
|
| 92 |
+
release (its speaker encoder is an ECAPA-TDNN, 2048-d).
|
| 93 |
+
- **Porting oracle** β the clean plain-torch [Zonos2_TTS-ComfyUI](https://github.com/Saganaki22/Zonos2_TTS-ComfyUI)
|
| 94 |
+
fork by Saganaki22 (Apache-2.0), used as the op-for-op reference.
|
| 95 |
+
- **MLX** β Apple's [ml-explore/mlx](https://github.com/ml-explore/mlx).
|
| 96 |
+
|
| 97 |
+
The MLX port code is licensed **Apache-2.0**. You must comply with the upstream ZONOS2 license and
|
| 98 |
+
usage terms for the model weights. **Full credit to Zyphra** for the model, its training, and the
|
| 99 |
+
open release β this repo only re-expresses their runtime in MLX.
|