Instructions to use nineninesix/kani-tts-400m-zh with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nineninesix/kani-tts-400m-zh with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-speech", model="nineninesix/kani-tts-400m-zh")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nineninesix/kani-tts-400m-zh") model = AutoModelForCausalLM.from_pretrained("nineninesix/kani-tts-400m-zh", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 8,839 Bytes
e3426cf 27cf0b3 e3426cf 0ac9f98 e3426cf 2514716 e3426cf 5ab737a 2c828f9 e3426cf 76e5b7d e3426cf 76e5b7d e3426cf 89d6f43 e3426cf 89d6f43 e3426cf 89d6f43 e3426cf 89d6f43 e3426cf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | ---
license: other
license_name: lfm1.0
license_link: https://www.liquid.ai/lfm-license
language:
- zh
pipeline_tag: text-to-speech
library_name: transformers
base_model:
- nineninesix/kani-tts-400m-0.3-pt
---
<p>
<img src="https://cdn-uploads.huggingface.co/production/uploads/64fab67bd268b2f1ad8a826b/Ki5aExt7SmQwHYLuGyLdc.png" alt="Logo" width="200" height="200">
</p>
# KaniTTS Chinese
[](https://discord.gg/NzP3rjB4SB) [](https://opensource.org/licenses/Apache-2.0)
A high-speed, high-fidelity Text-to-Speech model optimized for real-time conversational AI applications.
## Overview
KaniTTS uses a two-stage pipeline combining a large language model with an efficient audio codec for exceptional speed and audio quality. The architecture generates compressed token representations through a backbone LLM, then rapidly synthesizes waveforms via neural audio codec, achieving extremely low latency.
**Key Specifications:**
- **Model Size:** 400M parameters
- **Sample Rate:** 22kHz
- **Language:** Chinese Mandarin and Cantonese
- **License:** Apache 2.0
## Performance
**On [NovitaAI](https://novita.ai/) RTX 5090 using vLLM:**
- **RTF:** ~0.2 (5 times faster than realtime)
- **Memory:** 16GB GPU VRAM used
- **Source Code:** https://github.com/nineninesix-ai/kanitts-vllm
#### GPU Benchmark Results
| GPU Model | VRAM | Cost ($/hr) | RTF |
|-----------|------|-------------|-----|
| RTX 5090 | 32GB | $0.423 | 0.190 |
| RTX 4080 | 16GB | $0.220 | 0.200 |
| RTX 5060 Ti | 16GB | $0.138 | 0.529 |
| RTX 4060 Ti | 16GB | $0.122 | 0.537 |
| RTX 3060 | 12GB | $0.093 | 0.600 |
*Lower RTF is better (< 1.0 means faster than real-time). Benchmarks conducted on [Vast AI](https://vast.ai/).*
## Quickstart: Install from PyPI & Run Inference
It’s a lightweight so you can install, load a model, and speak in minutes.
Designed for quick starts and simple workflows—no heavy setup, just pip install and run.
[More detailes...](https://pypi.org/project/kani-tts/)
### Install
```bash
pip install kani-tts
pip install -U "transformers==4.57.1" # for LFM2 !!!
```
### Quick Start
```python
from kani_tts import KaniTTS
model = KaniTTS('nineninesix/kani-tts-400m-zh')
# Generate audio from text
audio, text = model("大家好!很高兴你在这里。")
# Save to file (requires soundfile)
model.save_audio(audio, "output.wav")
```
### Working with Multi-Speaker Models
This model support multiple speakers. You can check if your model supports speakers and select a specific voice:
```python
from kani_tts import KaniTTS
model = KaniTTS('nineninesix/kani-tts-400m-zh')
# Check if model supports multiple speakers
print(f"Model type: {model.status}") # 'singlspeaker' or 'multispeaker'
# Display available speakers (pretty formatted)
model.show_speakers()
# Or access the speaker list directly
print(model.speaker_list)
# Generate audio with a specific speaker
audio, text = model("大家好!很高兴你在这里。", speaker_id="ming")
```
### Custom Configuration
```python
from kani_tts import KaniTTS
model = KaniTTS(
'nineninesix/kani-tts-400m-zh',
temperature=0.7, # Control randomness (default: 1.0)
top_p=0.9, # Nucleus sampling (default: 0.95)
max_new_tokens=2000, # Max audio length (default: 1200)
repetition_penalty=1.2, # Prevent repetition (default: 1.1)
suppress_logs=True, # Suppress library logs (default: True)
show_info=True, # Show model info on init (default: True)
)
audio, text = model("Your text here")
```
### Playing Audio in Jupyter Notebooks
You can listen to generated audio directly in Jupyter notebooks or IPython:
```python
from kani_tts import KaniTTS
from IPython.display import Audio as aplay
model = KaniTTS('nineninesix/kani-tts-400m-zh')
audio, text = model("Your text here")
# Play audio in notebook
aplay(audio, rate=model.sample_rate)
```
---
## Datasets
- https://huggingface.co/datasets/laion/Emolia
- https://huggingface.co/datasets/TingChen-ppmc/Shanghai_Dialect_TTS_openai
- https://huggingface.co/datasets/boniromou/zh-yue-tts-dataset
## Voices:
- `ming` - Mandarin
- `mei` - Cantonese
## Audio Examples
| Text | Audio |
|---|---|
| 有一眼阳光晒到脸上,暖洋洋个,好舒服呃。 | <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/64fab67bd268b2f1ad8a826b/svFaIJQELPwaUUPKLfZln.wav"></audio> |
| 今朝心情好得来,连天色都看得欢喜咯。 | <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/64fab67bd268b2f1ad8a826b/wB4Exc0A9cwQ9E5T6p_wo.wav"></audio> |
| 啊哟,真格个,听到介话心里一热咯! | <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/64fab67bd268b2f1ad8a826b/TCG6uNKsHQ0kwJwSg9zPE.wav"></audio> |
| 有辰光一个人坐着,想东想西,真是闲不牢呃。| <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/64fab67bd268b2f1ad8a826b/cGH2xkbF0inVNWSIEdfc3.wav"></audio> |
## Use Cases
- **Conversational AI:** Real-time speech for chatbots and virtual assistants
- **Edge/Server Deployment:** Resource-efficient inference on affordable hardware
- **Accessibility:** Screen readers and language learning applications
- **Research:** Fine-tuning for specific voices, accents, or emotions
## Limitations
- Performance degrades with inputs exceeding 15 seconds (need to use sliding window chunking)
- Limited expressivity without fine-tuning for specific emotions
- May inherit biases from training data in prosody or pronunciation
- Optimized primarily for English; other languages may require additional training
## Optimization Tips
- **Multilingual Performance:** Continually pretrain on target language datasets and fine-tune NanoCodec
- **Batch Processing:** Use batches of 8-16 for high-throughput scenarios
- **Hardware:** Optimized for NVIDIA Blackwell architecture GPUs
## Resources
**Models:**
- **Pretrained Model:** https://huggingface.co/nineninesix/kani-tts-500m-0.3-pt
- **Space:** https://huggingface.co/spaces/nineninesix/KaniTTS
**Examples:**
- **OpenAI compatible API Example**: https://github.com/nineninesix-ai/kanitts-vllm
- **Finetuning code pipeline:** https://github.com/nineninesix-ai/KaniTTS-Finetune-pipeline
- **Dataset preparation pipeline:** https://github.com/nineninesix-ai/nano-codec-dataset-pipeline
- **Example Dataset:** https://huggingface.co/datasets/nineninesix/expresso-conversational-en-nano-codec-dataset
- **GitHub Repository:** https://github.com/nineninesix-ai/kani-tts
- **ComfyUI node:** https://github.com/wildminder/ComfyUI-KaniTTS by [WildAi](https://github.com/wildminder)
- **NextJS basic app:** https://github.com/nineninesix-ai/open-audio. It uses the OpenAI npm package to connect to the OpenAI-compatible server API provided by [kanitts-vllm](https://github.com/nineninesix-ai/kanitts-vllm).
**Links:**
- **Website:** https://www.nineninesix.ai
- **Contact Form:** https://airtable.com/appX2G2TpoRk4M5Bf/pagO2xbIOjiwulPcP/form
## Acknowledgments
Built on top of [LiquidAI LFM2 350M](https://huggingface.co/LiquidAI/LFM2-350M) as the backbone and [Nvidia NanoCodec](https://huggingface.co/nvidia/nemo-nano-codec-22khz-0.6kbps-12.5fps) for audio processing.
## Responsible Use
**Prohibited activities include:**
- Illegal content or harmful, threatening, defamatory, or obscene material
- Hate speech, harassment, or incitement of violence
- Generating false or misleading information
- Impersonating individuals without consent
- Malicious activities such as spamming, phishing, or fraud
By using this model, you agree to comply with these restrictions and all applicable laws.
## Contact
Have a question, feedback, or need support? Please fill out our [contact form](https://airtable.com/appX2G2TpoRk4M5Bf/pagO2xbIOjiwulPcP/form) and we'll get back to you as soon as possible.
## Citation
```
@inproceedings{emilialarge,
author={He, Haorui and Shang, Zengqiang and Wang, Chaoren and Li, Xuyuan and Gu, Yicheng and Hua, Hua and Liu, Liwei and Yang, Chen and Li, Jiaqi and Shi, Peiyang and Wang, Yuancheng and Chen, Kai and Zhang, Pengyuan and Wu, Zhizheng},
title={Emilia: A Large-Scale, Extensive, Multilingual, and Diverse Dataset for Speech Generation},
booktitle={arXiv:2501.15907},
year={2025}
}
```
```
@article{emonet_voice_2025,
author={Schuhmann, Christoph and Kaczmarczyk, Robert and Rabby, Gollam and Friedrich, Felix and Kraus, Maurice and Nadi, Kourosh and Nguyen, Huu and Kersting, Kristian and Auer, Sören},
title={EmoNet-Voice: A Fine-Grained, Expert-Verified Benchmark for Speech Emotion Detection},
journal={arXiv preprint arXiv:2506.09827},
year={2025}
}
``` |