Text-to-Speech
Transformers
Safetensors
Zonos
zonos3_mini
text-generation
tts
speech-synthesis
multilingual
voice-cloning
zonos3
zyphra
Instructions to use Zyphra/ZONOS3-Mini-transformers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Zyphra/ZONOS3-Mini-transformers with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-speech", model="Zyphra/ZONOS3-Mini-transformers")# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForSeq2SeqLM model = AutoModelForSeq2SeqLM.from_pretrained("Zyphra/ZONOS3-Mini-transformers", device_map="auto") - Zonos
How to use Zyphra/ZONOS3-Mini-transformers 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("Zyphra/ZONOS3-Mini-transformers", 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
Download chat_template.jinja from Zyphra/ZONOS3-Mini-transformers: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/Zyphra/ZONOS3-Mini-transformers/resolve/main/chat_template.jinja
- Command line
-
hf download hf://Zyphra/ZONOS3-Mini-transformers/chat_template.jinja
-
curl -L -o chat_template.jinja https://huggingface.co/Zyphra/ZONOS3-Mini-transformers/resolve/main/chat_template.jinja
1.16 kB
| {%- set training = messages | length == 2 -%} | |
| {%- if messages | length > 2 or messages[0]['role'] != 'user' or (training and messages[1]['role'] != 'assistant') -%} | |
| {{- raise_exception('ZONOS3-Mini takes one `user` message per conversation, optionally followed by the `assistant` target audio to train on.') -}} | |
| {%- endif -%} | |
| {%- if training -%} | |
| {%- set target = messages[1]['content'] -%} | |
| {%- if target is string or target | length != 1 or target[0]['type'] != 'audio' -%} | |
| {{- raise_exception('The `assistant` turn holds one `audio` item, the target.') -}} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- set content = messages[0]['content'] -%} | |
| {%- if content is string -%} | |
| {%- set texts = [content] -%} | |
| {%- set num_audio = 0 -%} | |
| {%- else -%} | |
| {%- set texts = content | selectattr('type', 'equalto', 'text') | map(attribute='text') | list -%} | |
| {%- set num_audio = content | selectattr('type', 'equalto', 'audio') | list | length -%} | |
| {%- endif -%} | |
| {%- if texts | length != 1 or num_audio > 1 -%} | |
| {{- raise_exception('The `user` turn holds one `text` item and at most one `audio` item (the voice).') -}} | |
| {%- endif -%} | |
| {{- texts[0] -}} | |