tiny-voca-persian

A Persian (Farsi) text-to-speech model with two voices, male (fa_male) and female (fa_female). It has 4.53M parameters and was trained from scratch, with no pretrained weights, on oddadmix/tiny-voca-persian-dataset (145 h after alignment checks, synthetic speech). It is built on the architecture and training code of tiny-voca by Muhammed Nazeem (Apache-2.0). Demo: oddadmix/tiny-voca-persian.

Input is ordinary Persian text. The front end writes numbers out in words, normalizes letter forms and half-spaces, gets the pronunciation (including ezafe) from mehdi-hf/persian-g2p-tiny (MIT), and adds word stress by rule. The model then produces 24 kHz audio. The speech model runs about 90× faster than real time on one CPU thread; the G2P adds roughly 0.15–0.2 s for each new sentence on CPU.

Evaluation

Speech from the model was transcribed with Whisper large-v3 and compared with the text. The held-out texts were never seen in training. "Recordings" means the training-voice audio of the same texts, transcribed the same way.

voice word error char error word error, recordings char error, recordings duration vs recordings
test (50 per voice) male 11.4% 2.7% 16.2% 4.0% 1.01
test (50 per voice) female 12.5% 2.6% 18.4% 4.2% 1.00
validation (50 per voice) male 14.6% 2.9% 19.5% 4.5% 1.00
validation (50 per voice) female 13.3% 2.8% 18.0% 4.2% 1.00

Whisper's Persian spelling (half-spaces, joined words) differs from the reference text in many places, so word error is high even on the recordings; character error is the more telling number.

Files

  • tiny-voca-persian.pt: the checkpoint (weights, config, front-end fingerprint, duration calibration phone +0.05 / pause −0.06).
  • code/tiny_voca/: inference code and the Persian front end (text.py, fa_normalize.py).
  • samples/: the same texts in both voices (texts.txt).

Use

pip install torch transformers soundfile huggingface_hub
import os, sys, soundfile as sf
os.environ["TV_FA_G2P_REVISION"] = "3f6994c82e52628fe948102a7009d281fc9aa99d"  # the G2P revision used in training
sys.path.insert(0, "code")
from tiny_voca.infer import load_model, speak_text

model = load_model("tiny-voca-persian.pt")
wave, spoken = speak_text(model, "سلام، وقت بخیر. سفارش شما با موفقیت ثبت شد.", "fa_female")  # or "fa_male"
sf.write("out.wav", wave.numpy(), 24000)

speak_text reads text of any length sentence by sentence and also takes speed (1.0 = normal), pitch_shift and seed. The G2P runs on CUDA when available; set TV_FA_G2P_DEVICE=cpu to force CPU.

Limitations

  • Persian in Arabic script only. Latin-script words are skipped.
  • The G2P sometimes adds an ezafe where none belongs, or misses one; stress is rule-based (last syllable; first for می/نمی verbs).
  • ONNX export is not available for this model yet.
  • All voices are synthetic.
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using oddadmix/tiny-voca-persian 1