Instructions to use seanll95/chatterbox-nano-coreml with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Chatterbox
How to use seanll95/chatterbox-nano-coreml with Chatterbox:
# pip install chatterbox-tts import torchaudio as ta from chatterbox.tts import ChatterboxTTS model = ChatterboxTTS.from_pretrained(device="cuda") text = "Ezreal and Jinx teamed up with Ahri, Yasuo, and Teemo to take down the enemy's Nexus in an epic late-game pentakill." wav = model.generate(text) ta.save("test-1.wav", wav, model.sr) # If you want to synthesize with a different voice, specify the audio prompt AUDIO_PROMPT_PATH="YOUR_FILE.wav" wav = model.generate(text, audio_prompt_path=AUDIO_PROMPT_PATH) ta.save("test-2.wav", wav, model.sr) - Notebooks
- Google Colab
- Kaggle
Add model card and MIT licence
Browse files
LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2025 Resemble AI
|
| 4 |
+
|
| 5 |
+
The models in this repository are Core ML conversions of
|
| 6 |
+
ResembleAI/chatterbox-nano (https://huggingface.co/ResembleAI/chatterbox-nano),
|
| 7 |
+
which is distributed under the MIT License. The conversion scripts and the
|
| 8 |
+
resulting .mlpackage artifacts are redistributed under the same terms.
|
| 9 |
+
|
| 10 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 11 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 12 |
+
in the Software without restriction, including without limitation the rights
|
| 13 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 14 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 15 |
+
furnished to do so, subject to the following conditions:
|
| 16 |
+
|
| 17 |
+
The above copyright notice and this permission notice shall be included in all
|
| 18 |
+
copies or substantial portions of the Software.
|
| 19 |
+
|
| 20 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 21 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 22 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 23 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 24 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 25 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 26 |
+
SOFTWARE.
|
README.md
CHANGED
|
@@ -1,206 +1,82 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
| 3 |
language:
|
| 4 |
- en
|
|
|
|
| 5 |
pipeline_tag: text-to-speech
|
| 6 |
tags:
|
| 7 |
- text-to-speech
|
| 8 |
-
-
|
| 9 |
-
-
|
| 10 |
-
-
|
|
|
|
| 11 |
---
|
| 12 |
-

|
| 13 |
|
|
|
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
<img src="https://img.shields.io/badge/listen-demo_samples-blue" alt="Listen to Demo Samples" />
|
| 20 |
-
</a>
|
| 21 |
-
<a href="https://huggingface.co/spaces/ResembleAI/chatterbox-nano-demo">
|
| 22 |
-
<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/open-in-hf-spaces-sm.svg" alt="Open in HF Spaces" />
|
| 23 |
-
</a>
|
| 24 |
-
<a href="https://podonos.com/resembleai/chatterbox">
|
| 25 |
-
<img src="https://static-public.podonos.com/badges/insight-on-pdns-sm-dark.svg" alt="Insight on Podos" />
|
| 26 |
-
</a>
|
| 27 |
-
</div>
|
| 28 |
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
|
| 39 |
-
**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
| Chatterbox-Multilingual [(Language list)](#supported-languages) | 500M | 23+ | Zero-shot cloning, Multiple Languages | Global applications, Localization | [Demo](https://huggingface.co/spaces/ResembleAI/Chatterbox-Multilingual-TTS) | [Listen](https://resemble-ai.github.io/chatterbox_demopage/) |
|
| 54 |
-
| Chatterbox [(Tips and Tricks)](#original-chatterbox-tips) | 500M | English | CFG & Exaggeration tuning | General zero-shot TTS with creative controls | [Demo](https://huggingface.co/spaces/ResembleAI/Chatterbox) | [Listen](https://resemble-ai.github.io/chatterbox_demopage/) |
|
| 55 |
|
| 56 |
-
##
|
| 57 |
-
```shell
|
| 58 |
-
pip install chatterbox-tts
|
| 59 |
-
```
|
| 60 |
-
|
| 61 |
-
Alternatively, you can install from source:
|
| 62 |
-
```shell
|
| 63 |
-
# conda create -yn chatterbox python=3.11
|
| 64 |
-
# conda activate chatterbox
|
| 65 |
-
|
| 66 |
-
git clone https://github.com/resemble-ai/chatterbox.git
|
| 67 |
-
cd chatterbox
|
| 68 |
-
pip install -e .
|
| 69 |
-
```
|
| 70 |
-
We developed and tested Chatterbox on Python 3.11 on Debian 11 OS; the versions of the dependencies are pinned in `pyproject.toml` to ensure consistency. You can modify the code or dependencies in this installation mode.
|
| 71 |
-
|
| 72 |
-
## Usage
|
| 73 |
-
|
| 74 |
-
##### Chatterbox-Nano
|
| 75 |
-
|
| 76 |
-
Nano shares Turbo's architecture and is loaded through the same `ChatterboxTurboTTS` class by passing `nano=True`:
|
| 77 |
-
|
| 78 |
-
```python
|
| 79 |
-
import torchaudio as ta
|
| 80 |
-
import torch
|
| 81 |
-
from chatterbox.tts_turbo import ChatterboxTurboTTS
|
| 82 |
-
|
| 83 |
-
# Load the Nano model (also runs on CPU: device="cpu")
|
| 84 |
-
model = ChatterboxTurboTTS.from_pretrained(device="cuda", nano=True)
|
| 85 |
-
|
| 86 |
-
# Generate with Paralinguistic Tags
|
| 87 |
-
text = "Hi there, Sarah here from MochaFone calling you back [chuckle], have you got one minute to chat about the billing issue?"
|
| 88 |
-
|
| 89 |
-
# Generate audio (requires a reference clip for voice cloning)
|
| 90 |
-
wav = model.generate(text, audio_prompt_path="your_10s_ref_clip.wav")
|
| 91 |
-
|
| 92 |
-
ta.save("test-nano.wav", wav, model.sr)
|
| 93 |
-
```
|
| 94 |
-
|
| 95 |
-
##### Chatterbox-Turbo
|
| 96 |
-
|
| 97 |
-
```python
|
| 98 |
-
import torchaudio as ta
|
| 99 |
-
import torch
|
| 100 |
-
from chatterbox.tts_turbo import ChatterboxTurboTTS
|
| 101 |
-
|
| 102 |
-
# Load the Turbo model
|
| 103 |
-
model = ChatterboxTurboTTS.from_pretrained(device="cuda")
|
| 104 |
-
|
| 105 |
-
# Generate with Paralinguistic Tags
|
| 106 |
-
text = "Hi there, Sarah here from MochaFone calling you back [chuckle], have you got one minute to chat about the billing issue?"
|
| 107 |
-
|
| 108 |
-
# Generate audio (requires a reference clip for voice cloning)
|
| 109 |
-
wav = model.generate(text, audio_prompt_path="your_10s_ref_clip.wav")
|
| 110 |
-
|
| 111 |
-
ta.save("test-turbo.wav", wav, model.sr)
|
| 112 |
-
```
|
| 113 |
-
|
| 114 |
-
##### Chatterbox and Chatterbox-Multilingual
|
| 115 |
-
|
| 116 |
-
```python
|
| 117 |
-
|
| 118 |
-
import torchaudio as ta
|
| 119 |
-
from chatterbox.tts import ChatterboxTTS
|
| 120 |
-
from chatterbox.mtl_tts import ChatterboxMultilingualTTS
|
| 121 |
-
|
| 122 |
-
device = "cuda" # or "cpu" / "mps"
|
| 123 |
-
|
| 124 |
-
# English example
|
| 125 |
-
model = ChatterboxTTS.from_pretrained(device=device)
|
| 126 |
-
|
| 127 |
-
text = "Ezreal and Jinx teamed up with Ahri, Yasuo, and Teemo to take down the enemy's Nexus in an epic late-game pentakill."
|
| 128 |
-
wav = model.generate(text)
|
| 129 |
-
ta.save("test-english.wav", wav, model.sr)
|
| 130 |
-
|
| 131 |
-
# Multilingual examples
|
| 132 |
-
multilingual_model = ChatterboxMultilingualTTS.from_pretrained(device=device)
|
| 133 |
-
|
| 134 |
-
french_text = "Bonjour, comment ça va? Ceci est le modèle de synthèse vocale multilingue Chatterbox, il prend en charge 23 langues."
|
| 135 |
-
wav_french = multilingual_model.generate(french_text, language_id="fr")
|
| 136 |
-
ta.save("test-french.wav", wav_french, multilingual_model.sr)
|
| 137 |
-
|
| 138 |
-
chinese_text = "你好,今天天气真不错,希望你有一个愉快的周末。"
|
| 139 |
-
wav_chinese = multilingual_model.generate(chinese_text, language_id="zh")
|
| 140 |
-
ta.save("test-chinese.wav", wav_chinese, multilingual_model.sr)
|
| 141 |
-
|
| 142 |
-
# If you want to synthesize with a different voice, specify the audio prompt
|
| 143 |
-
AUDIO_PROMPT_PATH = "YOUR_FILE.wav"
|
| 144 |
-
wav = model.generate(text, audio_prompt_path=AUDIO_PROMPT_PATH)
|
| 145 |
-
ta.save("test-2.wav", wav, model.sr)
|
| 146 |
-
```
|
| 147 |
-
See `example_tts.py`, `example_tts_turbo.py`, `example_tts_nano.py`, and `example_vc.py` for more examples.
|
| 148 |
-
|
| 149 |
-
## Supported Languages
|
| 150 |
-
Arabic (ar) • Danish (da) • German (de) • Greek (el) • English (en) • Spanish (es) • Finnish (fi) • French (fr) • Hebrew (he) • Hindi (hi) • Italian (it) • Japanese (ja) • Korean (ko) • Malay (ms) • Dutch (nl) • Norwegian (no) • Polish (pl) • Portuguese (pt) • Russian (ru) • Swedish (sv) • Swahili (sw) • Turkish (tr) • Chinese (zh)
|
| 151 |
-
|
| 152 |
-
## Original Chatterbox Tips
|
| 153 |
-
- **General Use (TTS and Voice Agents):**
|
| 154 |
-
- Ensure that the reference clip matches the specified language tag. Otherwise, language transfer outputs may inherit the accent of the reference clip’s language. To mitigate this, set `cfg_weight` to `0`.
|
| 155 |
-
- The default settings (`exaggeration=0.5`, `cfg_weight=0.5`) work well for most prompts across all languages.
|
| 156 |
-
- If the reference speaker has a fast speaking style, lowering `cfg_weight` to around `0.3` can improve pacing.
|
| 157 |
-
|
| 158 |
-
- **Expressive or Dramatic Speech:**
|
| 159 |
-
- Try lower `cfg_weight` values (e.g. `~0.3`) and increase `exaggeration` to around `0.7` or higher.
|
| 160 |
-
- Higher `exaggeration` tends to speed up speech; reducing `cfg_weight` helps compensate with slower, more deliberate pacing.
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
## Built-in PerTh Watermarking for Responsible AI
|
| 164 |
-
|
| 165 |
-
Every audio file generated by Chatterbox includes [Resemble AI's Perth (Perceptual Threshold) Watermarker](https://github.com/resemble-ai/perth) - imperceptible neural watermarks that survive MP3 compression, audio editing, and common manipulations while maintaining nearly 100% detection accuracy.
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
## Watermark extraction
|
| 169 |
-
|
| 170 |
-
You can look for the watermark using the following script.
|
| 171 |
-
|
| 172 |
-
```python
|
| 173 |
-
import perth
|
| 174 |
-
import librosa
|
| 175 |
-
|
| 176 |
-
AUDIO_PATH = "YOUR_FILE.wav"
|
| 177 |
-
|
| 178 |
-
# Load the watermarked audio
|
| 179 |
-
watermarked_audio, sr = librosa.load(AUDIO_PATH, sr=None)
|
| 180 |
-
|
| 181 |
-
# Initialize watermarker (same as used for embedding)
|
| 182 |
-
watermarker = perth.PerthImplicitWatermarker()
|
| 183 |
-
|
| 184 |
-
# Extract watermark
|
| 185 |
-
watermark = watermarker.get_watermark(watermarked_audio, sample_rate=sr)
|
| 186 |
-
print(f"Extracted watermark: {watermark}")
|
| 187 |
-
# Output: 0.0 (no watermark) or 1.0 (watermarked)
|
| 188 |
-
```
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
## Official Discord
|
| 192 |
-
|
| 193 |
-
👋 Join us on [Discord](https://discord.gg/rJq9cRJBJ6) and let's build something awesome together!
|
| 194 |
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
- [HiFT-GAN](https://github.com/yl4579/HiFTNet)
|
| 199 |
-
- [Llama 3](https://github.com/meta-llama/llama3)
|
| 200 |
-
- [S3Tokenizer](https://github.com/xingchensong/S3Tokenizer)
|
| 201 |
|
| 202 |
-
## Citation
|
| 203 |
-
If you find this model useful, please consider citing.
|
| 204 |
```
|
| 205 |
@misc{chatterboxtts2025,
|
| 206 |
author = {{Resemble AI}},
|
|
@@ -210,5 +86,3 @@ If you find this model useful, please consider citing.
|
|
| 210 |
note = {GitHub repository}
|
| 211 |
}
|
| 212 |
```
|
| 213 |
-
## Disclaimer
|
| 214 |
-
Don't use this model to do bad things. Prompts are sourced from freely available data on the internet.
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
base_model: ResembleAI/chatterbox-nano
|
| 4 |
language:
|
| 5 |
- en
|
| 6 |
+
library_name: coreml
|
| 7 |
pipeline_tag: text-to-speech
|
| 8 |
tags:
|
| 9 |
- text-to-speech
|
| 10 |
+
- coreml
|
| 11 |
+
- ios
|
| 12 |
+
- neural-engine
|
| 13 |
+
- chatterbox
|
| 14 |
---
|
|
|
|
| 15 |
|
| 16 |
+
# Chatterbox Nano — Core ML
|
| 17 |
|
| 18 |
+
Core ML conversions of [ResembleAI/chatterbox-nano](https://huggingface.co/ResembleAI/chatterbox-nano),
|
| 19 |
+
built for on-device text-to-speech on iOS. Used by [Annologue](https://github.com/seanlaidlaw),
|
| 20 |
+
an iOS audiobook player, to synthesise chapters locally.
|
| 21 |
|
| 22 |
+
These run **faster than real time on an iPhone**, with the two heaviest stages executing
|
| 23 |
+
almost entirely on the Neural Engine.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
## Contents
|
| 26 |
|
| 27 |
+
| File | Precision | Size | Compute units | Measured device placement |
|
| 28 |
+
|---|---|---|---|---|
|
| 29 |
+
| `t3_prefill_ane.mlpackage` | fp16 | 173 MB | CPU + GPU | ANE cannot compile this graph (`ANECCompile() FAILED`); it is ~1 % of wall time |
|
| 30 |
+
| `t3_decode_ane.mlpackage` | fp16 | 173 MB | CPU + **ANE** | **525/537 ops = 97.8 % ANE** |
|
| 31 |
+
| `s3gen_flow.mlpackage` | fp16 | 230 MB | CPU + **ANE** | **3300/3317 ops = 99.5 % ANE** |
|
| 32 |
+
| `s3gen_vocoder.mlpackage` | fp16 (selective) | 41 MB | CPU + GPU | 179 convolutions over 288 000 samples exceed the ANE's per-dimension limits |
|
| 33 |
+
| `t3_embeddings.bin` | fp16 | 86 MB | — | Text/speech/positional embedding tables, gathered on the CPU |
|
| 34 |
+
| `nano_conds.bin` | — | 1.3 MB | — | Default speaker conditionals, with `cond_emb` precomputed |
|
| 35 |
+
| `tokenizer.json`, `tokenizer_config.json` | — | 3.4 MB | — | — |
|
| 36 |
|
| 37 |
+
`.mlpackage` files are uncompiled. Compile them on-device with
|
| 38 |
+
`MLModel.compileModel(at:)` and cache the result — compilation takes roughly a minute
|
| 39 |
+
in total and only needs to happen once per install.
|
| 40 |
|
| 41 |
+
## How this differs from upstream
|
| 42 |
|
| 43 |
+
**T3 is split into two packages.** Upstream is one autoregressive transformer; here prefill
|
| 44 |
+
and decode are separate `MLModel`s with independent `MLState`s, and the KV prefix is copied
|
| 45 |
+
across per utterance. This costs +173 MB of disk (the two halves do not share weights) and
|
| 46 |
+
buys decode its own compute-unit placement, which is the entire reason decode can reach the
|
| 47 |
+
Neural Engine while prefill cannot.
|
| 48 |
|
| 49 |
+
**Decode's attention is written out rather than fused.** A fused
|
| 50 |
+
`scaled_dot_product_attention` places on the ANE but the ANE **silently ignores its mask
|
| 51 |
+
operand**, so attention runs over the whole KV cache including the ~500 slots holding
|
| 52 |
+
nothing. The output stays fluent and is simply the wrong words. Spelling attention as
|
| 53 |
+
`matmul → scale → add → softmax → matmul` makes the mask an ordinary `add` the compiler
|
| 54 |
+
cannot drop. This cost no latency and lost no ANE placement.
|
| 55 |
|
| 56 |
+
**S3Gen is split into flow and vocoder halves** so the flow half can be fp16 on the ANE
|
| 57 |
+
while the vocoder stays on the GPU. The vocoder's HiFi-GAN upsamplers are re-expressed as
|
| 58 |
+
sub-pixel (reshape + convolution) rather than transposed convolutions, which is numerically
|
| 59 |
+
exact and removes ops that fell back to the CPU. Its `cumsum` phase accumulator is kept in
|
| 60 |
+
fp32 — that one is a genuine fp16 hazard.
|
| 61 |
|
| 62 |
+
**Quantisation stops at fp16.** int8 on S3Gen was measured and rejected: log-spectral
|
| 63 |
+
distance against fp32 went from 0.034 to 0.354, and `MLComputePlan` stopped loading the
|
| 64 |
+
model. int8 on T3 halves the weights but was measured at 0.95×/0.99× — a RAM lever, not a
|
| 65 |
+
speed one.
|
| 66 |
|
| 67 |
+
## ⚠️ No watermarking
|
| 68 |
|
| 69 |
+
Upstream Chatterbox applies [Resemble AI's PerTh watermarker](https://github.com/resemble-ai/perth)
|
| 70 |
+
to every generated file. **These conversions are the T3 and S3Gen models only — audio
|
| 71 |
+
generated from them is not watermarked.** If you need the watermark, apply `perth` to the
|
| 72 |
+
output yourself. Please use these responsibly.
|
|
|
|
|
|
|
| 73 |
|
| 74 |
+
## Licence and attribution
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
+
MIT, inherited from the upstream model. Copyright © 2025 Resemble AI — see `LICENSE`.
|
| 77 |
+
The underlying model, training and weights are Resemble AI's work; this repository
|
| 78 |
+
contributes only the Core ML conversion.
|
|
|
|
|
|
|
|
|
|
| 79 |
|
|
|
|
|
|
|
| 80 |
```
|
| 81 |
@misc{chatterboxtts2025,
|
| 82 |
author = {{Resemble AI}},
|
|
|
|
| 86 |
note = {GitHub repository}
|
| 87 |
}
|
| 88 |
```
|
|
|
|
|
|