English | فارسی
pocket-tts-farsi-v2 — ONNX edition (no PyTorch)
An ONNX conversion of mehdi-hf/pocket-tts-farsi-v2 —
Persian text-to-speech with voice cloning, fully offline on CPU, with no PyTorch dependency.
This package is the output of the persian_tts project. The weights are a pure format conversion of the original model — no weights were modified.
Why this version?
| ONNX (this package) | Original (PyTorch) | |
|---|---|---|
| Dependencies | onnxruntime, numpy, scipy, soundfile, sentencepiece | torch, transformers, pocket-tts |
| Install size (Windows) | ~200MB | ~1.2GB |
| GPU required | No | No |
| Startup | Fast | Slower |
| Accuracy | waveform diff 7.5e-4 vs reference (inaudible) | reference |
| Speed (2.8s of audio, CPU) | 3283ms | 3423ms |
Package contents
flow_lm_step.onnx (+.data) unified FlowLM graph — three modes in one graph (voice/prompt/generation)
mimi_encoder.onnx (+.data) reference voice -> latent
mimi_decoder_step_kv.onnx (+.data) latent -> audio (1920 samples per step)
g2p_encoder.onnx G2P: T5 encoder stage
g2p_decoder.onnx (+.data) G2P: decoder (greedy loop runs host-side)
weights.npz host constants: LUT table, speaker_proj, normalize stats
decode_state_init.npz initial decoder state template
manifest.json input/output spec for every graph
Usage
Download and run with the ONNX engine from the persian_tts project:
git clone https://github.com/nimaone/persian_tts
cd persian_tts
# download this package
pip install -U "huggingface_hub[cli]"
hf download Nimaone/pocket-tts-farsi-v2-onnx --local-dir model/onnx
# install the lightweight dependencies (~200MB, no torch)
python -m venv env
./env/Scripts/python -m pip install onnxruntime numpy scipy soundfile sentencepiece
# run
./env/Scripts/python scripts/tts_onnx.py "سلام، حال شما چطور است؟"
License and credits
Important — non-commercial use only: the original TTS model is released under CC-BY-NC-4.0, and this restriction carries over to any format conversion of it, including this ONNX package. Commercial use requires a license from the original author.
| Component | Original model | Author | License |
|---|---|---|---|
| Persian TTS + voice cloning | mehdi-hf/pocket-tts-farsi-v2 |
mallahyari — training code/pipeline: mallahyari/pocket-tts |
CC-BY-NC-4.0 |
| Persian G2P (grapheme-to-phoneme) | mehdi-hf/Homo-GE2PE-Persian-HF |
repackaging of MahtaFetrat/Homo-GE2PE-Persian by Elnaz Rahmati et al. |
MIT |
| Base library and architecture | pocket-tts |
Kyutai | MIT |
This package contains a derivative of a CC-BY-NC-4.0 work and, per the terms of that license, is redistributed under the same license with attribution to the original author. The G2P portion remains under MIT.
All model credit belongs to the original authors — this repository only provides the format conversion (PyTorch -> ONNX) and a lightweight runtime.
Model tree for Nimaone/pocket-tts-farsi-v2-onnx
Base model
mehdi-hf/pocket-tts-farsi-v2