|
Download README.md from mehdi-hf/tiny-ava: direct link, hf CLI and curl.
- Browser
- Download file 9.5 kB
-
https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/README.md
- Command line
-
hf download hf://mehdi-hf/tiny-ava/README.md
-
curl -L -o README.md https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/README.md
9.5 kB
| license: cc-by-4.0 | |
| language: | |
| - fa | |
| pipeline_tag: text-to-speech | |
| tags: | |
| - text-to-speech | |
| - persian | |
| - farsi | |
| - onnx | |
| - tiny-voca | |
| - cpu | |
| # tiny-ava | |
| **tiny-ava** is a tiny **4.5M-parameter** Persian (Farsi) text-to-speech model trained from scratch on top of the [`tiny-voca`](https://github.com/n4ze3m/tiny-voca) architecture. Including the built-in waveform generator, the complete model is **~18 MB (PyTorch) / ~20 MB (ONNX)** and runs **38× faster than real time on 1 CPU thread** (**77× real time on 4 CPU threads**). | |
| <audio controls src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/01_greeting.wav"></audio> | |
| - **Try it in your browser (Live Demo):** https://huggingface.co/spaces/mehdi-hf/tiny-ava-demo | |
| - **Code & release repo:** https://github.com/mallahyari/tiny-ava | |
| - **Persian G2P frontends:** [`mehdi-hf/persian-g2p-tiny`](https://huggingface.co/mehdi-hf/persian-g2p-tiny) (16 MB, MIT) · `mehdi-hf/persian-g2p-0.6b` (596M, Apache-2.0) | |
| - **Base architecture:** [`n4ze3m/tiny-voca`](https://github.com/n4ze3m/tiny-voca) (Apache-2.0) | |
| | | | | |
| |---|---| | |
| | Parameters | 4,531,147 | | |
| | Voice | `parisa` (Persian female) | | |
| | Output | 24 kHz mono | | |
| | Input | Persian IPA tokens (46 symbols) + 3-class stress/ezafe channel | | |
| | CPU speed (acoustic + vocoder) | **38.5× real time** (1 thread) · **77.4× real time** (4 threads) | | |
| | Pretrained weights in the model | None (trained from scratch) | | |
| | License | CC BY 4.0 (free for all use, including commercial, with attribution) | | |
| --- | |
| ## Files | |
| | File | Size | Contents | | |
| |---|---:|---| | |
| | `tiny-ava-parisa.pt` | 18.2 MB | PyTorch inference weights, float32 | | |
| | `onnx/tiny-ava-parisa.onnx` | 20.4 MB | ONNX export, float32, opset 17 | | |
| | `onnx/tiny-ava-parisa.json` | 761 B | Symbol table (46 symbols), voice map, and runtime metadata | | |
| | `config.json` | 674 B | Model & acoustic DSP configuration | | |
| | `samples/` | 2.5 MB | 12 sample 24 kHz WAVs | | |
| | `charts/training_curves.png` | — | 104k-step training & validation curves | | |
| SHA256: | |
| - `tiny-ava-parisa.pt`: `698d43ea896eaa95bb6a444218097187fffb34b861710bd81a44a069eb4ab3d7` | |
| - `onnx/tiny-ava-parisa.onnx`: `4e387b2f28a6d65916ed7c33ecdac4428135e9adfc13e1734b77592e6993a340` | |
| --- | |
| ## Samples (24 kHz, Parisa Voice) | |
| | Category | Persian Text | Audio | | |
| |---|---|---| | |
| | Greeting & question | سلام، حال شما چطور است؟ امروز هوای تهران آفتابی است. | <audio controls preload="none" src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/01_greeting.wav"></audio> | | |
| | Ezafe chain | نشست سران سیاسی کشورهای عضو به خوبی پیش رفت. | <audio controls preload="none" src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/02_ezafe_chain.wav"></audio> | | |
| | Explicit kasra (`ـِ`) | بارانِ ریزی روی آسفالتِ خیسِ خیابان میبارد. | <audio controls preload="none" src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/03_ezafe_kasra.wav"></audio> | | |
| | Homograph (`تست` → *tost*) | من هر روز صبح نان تست داغ با کره و عسل میخورم. | <audio controls preload="none" src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/04_homo_tost.wav"></audio> | | |
| | Homograph (`گل` → *gol*) | گل قرمز زیبایی را روی میز گذاشت و لبخند زد. | <audio controls preload="none" src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/05_homo_gol.wav"></audio> | | |
| | Homograph + diacritic (`گِل`) | کفشهایم بعد از باران پر از گِل و لای شد. | <audio controls preload="none" src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/06_homo_gel.wav"></audio> | | |
| | Homograph (`مرد` → *mord*) | حیوان خانگی من دیروز در اثر گرمای شدید بیهوش شد و مرد. | <audio controls preload="none" src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/07_homo_mord.wav"></audio> | | |
| | Question (`؟`) | آیا واقعاً فکر کردی که تولد تو را فراموش میکنم؟ | <audio controls preload="none" src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/08_question.wav"></audio> | | |
| | Persian uvulars (`ق/غ/خ/ع`) | قصر قدیم در کنار غار خاموش و عمیق کوهستان قرار دارد. | <audio controls preload="none" src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/09_uvulars.wav"></audio> | | |
| | Long sentence | توسعه مدلهای کوچک هوش مصنوعی باعث میشود که فناوری تبدیل متن به گفتار بدون نیاز به سرور و اینترنت روی دستگاههای معمولی اجرا شود. | <audio controls preload="none" src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/10_long.wav"></audio> | | |
| | Colloquial Persian | سلام، چطوری؟ دیگه باید برم، نمیتونم بیشتر بمونم. | <audio controls preload="none" src="https://huggingface.co/mehdi-hf/tiny-ava/resolve/main/samples/11_colloq_1.wav"></audio> | | |
| --- | |
| ## ONNX Interface | |
| The ONNX graph (`onnx/tiny-ava-parisa.onnx`) takes Persian IPA token IDs and stress/ezafe values and directly outputs a 24 kHz waveform. Text-to-phoneme conversion runs outside the graph using either [`mehdi-hf/persian-g2p-tiny`](https://huggingface.co/mehdi-hf/persian-g2p-tiny) (16 MB) or `mehdi-hf/persian-g2p-0.6b` (596M), mapped to the 46-symbol table in `onnx/tiny-ava-parisa.json`. | |
| ### Inputs | |
| | Input | Type | Shape | Meaning | | |
| |---|---|---|---| | |
| | `tokens` | `int64` | `[1, N]` | Persian IPA & punctuation IDs (`0..45`), wrapped with `<bos>` and `<eos>` | | |
| | `stress` | `int64` | `[1, N]` | `0` unstressed, `1` word-final primary lexical stress, `2` explicit ezafe (`-e`/`-ye`) | | |
| | `voice` | `int64` | `[1]` | `0` (`parisa`) | | |
| | `speed` | `float32` | `[1]` | Speaking rate (`1.0` default; larger is faster) | | |
| | `pitch_shift` | `float32` | `[1]` | Added to log F0 (`0.058` ≈ +1 semitone) | | |
| | `pitch_range` | `float32` | `[1]` | Scales pitch movement around utterance mean (`1.0`–`1.1` recommended) | | |
| ### Outputs | |
| | Output | Type | Shape | Meaning | | |
| |---|---|---|---| | |
| | `audio` | `float32` | `[1, samples]` | 24 kHz mono waveform (scale peak to ≤ `0.99` before 16-bit WAV export) | | |
| | `durations` | `int64` | `[1, N]` | Predicted duration per token in frames (`256` samples = `10.67 ms` per frame) | | |
| --- | |
| ## Architecture | |
| Built on the exact `tiny-voca` feed-forward transformer + complex-cepstrum source-filter architecture, adapted for Persian: | |
| - **46-symbol Persian vocabulary:** 5 specials, 12 Persian/standard punctuation pause carriers (`،`, `.`, `؟`, `!`, `؛`, `:`, `«`, `»`, `(`, `)`, `—`, `…`), 23 consonants, and 6 vowels (`a, e, o, i, u, ɑ`). | |
| - **Text encoder:** 4 Conformer-style RoPE blocks (`192` channels, `4` heads, kernel-7 depthwise conv, `640` FFN). | |
| - **Duration & pause predictor:** Separate duration regression + binary pause-presence head for commas, periods, and word boundaries. | |
| - **Prosody & acoustic stacks:** 2 frame blocks predicting log-F0, voicing, and energy + 5 frame blocks predicting harmonic & noise filter cepstra. | |
| - **Source-filter waveform head (`25.9k` params):** Anti-aliased float64 harmonic pulse train + causal/anticausal complex-cepstrum filtering + 4-subframe noise branch (no neural vocoder required). | |
| --- | |
| ## Training & Evaluation | |
| - **Training data:** 8,033 clean punctuated Parisa clips (**19.97 hours**, 24 kHz), annotated with `mehdi-hf/persian-g2p-0.6b` and offline CTC forced alignment (`facebook/wav2vec2-lv-60-espeak-cv-ft`, 99.73% QC acceptance, `88.6%` fricative-to-vowel voicing flip within 2 frames). | |
| - **Training schedule:** 104,000 steps on 1× NVIDIA A100-80GB (~5.5 hours). Spectral + prosody losses for the first 8,000 steps, followed by multi-period and multi-resolution GAN discriminators (`--gan-ratio 0.7`, `--teacher-final 0`). | |
| ### Held-Out Test Evaluation (50 clips, `faster-whisper large-v3`, `language="fa"`) | |
| | Model | Persian CER ↓ | Persian WER ↓ | CPU Speed (1 thread / 4 threads) | | |
| |---|---:|---:|---:| | |
| | **tiny-ava (`parisa`, 4.53M)** | **6.95%** *(0.85× teacher)* | **36.96%** *(0.92× teacher)* | **38.5× / 77.4× real time** | | |
| | Teacher recordings (reference floor) | 8.20% | 40.22% | — | | |
|  | |
| --- | |
| ## Limitations | |
| - Single fixed female voice (`parisa`); no voice cloning. | |
| - Pronunciation accuracy on rare homographs, numbers, and out-of-vocabulary loanwords depends on the upstream Persian G2P frontend (typing explicit `ـَ`, `ـِ`, `ـُ` diacritics lets you override pronunciation deterministically). | |
| - Deterministic prosody: the same input text is always spoken with the same cadence. | |
| - Utterance-level generation (not frame-streaming), though a 5-second Persian sentence synthesizes in ~65 ms on 4 CPU threads. | |
| --- | |
| ## License & Credits | |
| - **Model Weights License:** **CC BY 4.0** (Creative Commons Attribution 4.0 International) — free for personal, research, and commercial use as long as you give credit. | |
| - **Required Attribution:** Please include *"Powered by tiny-ava (Mehdi Allahyari / OncillaAI)"* with a link to [`mehdi-hf/tiny-ava`](https://huggingface.co/mehdi-hf/tiny-ava). | |
| - **Architecture:** Based on [`n4ze3m/tiny-voca`](https://github.com/n4ze3m/tiny-voca) (Apache-2.0) by Muhammed Nazeem. | |
| - **Offline Aligner (annotation only):** `facebook/wav2vec2-lv-60-espeak-cv-ft` (Apache-2.0). | |