--- license: apache-2.0 language: - tr pipeline_tag: text-to-speech library_name: onnx tags: - text-to-speech - tts - turkish - onnx - safetensors - on-device - tiny-voca base_model: n4ze3m/tiny-voca base_model_relation: finetune --- # clarvia-tts-tiny **A 4.5M-parameter Turkish text-to-speech model that reads numbers, dates, money and addresses from context.** It is small enough to run on a phone or in a browser tab, at about 25× real time on one CPU thread. clarvia-tts-tiny is the Turkish version of [tiny-voca](https://huggingface.co/n4ze3m/tiny-voca): the same compact acoustic model and waveform generator, trained on Turkish speech, with a new Turkish phonemizer in front of it. (It keeps tiny-voca's architecture and training recipe; the weights were trained from scratch on Turkish, since the English phoneme inventory does not carry over.) The phonemizer does the work a separate text-normalization step usually does. It reads | You write | It says | |---|---| | `Randevunuz 18.11.2026 saat 14:30'da.` | Randevunuz on sekiz Kasım iki bin yirmi altı saat on dört otuzda. | | `Borcunuz 1.250,50 TL.` | Borcunuz bin iki yüz elli lira elli kuruş. | | `0555 123 45 67` | sıfır beş yüz elli beş, yüz yirmi üç, kırk beş, altmış yedi | | `Tesisat numaranız 04815162.` | Tesisat numaranız sıfır dört sekiz bir, beş bir altı iki. | | `Cumhuriyet Cad. No: 12/4` | Cumhuriyet Caddesi numara on iki bölü dört | | `2,46 TL/kWh` | kilovat saat başına iki lira kırk altı kuruş | ## Quick start ```bash git clone https://huggingface.co/wite-tech/clarvia-tts-tiny && cd clarvia-tts-tiny pip install onnxruntime numpy soundfile git+https://huggingface.co/wite-tech/clarvia-phonemizer python speak.py "Merhaba! Randevunuz 18 Kasım saat 14:30'da." --voice female_1 --output merhaba.wav ``` In Python: ```python from speak import ClarviaTiny import soundfile as sf tts = ClarviaTiny() audio = tts.speak("Son ödeme tarihi 25.11.2026, tutar 1.284,50 TL.", voice="male_2", speed=1.0) sf.write("fatura.wav", audio, tts.config["sample_rate"]) ``` The phonemizer, [clarvia-phonemizer](https://huggingface.co/wite-tech/clarvia-phonemizer), is pure Python with no dependencies, so it also runs under Pyodide. The ONNX model runs in onnxruntime-web, which is how the browser demo works. ## Voices | Voice | Description | |---|---| | `male_1`, `male_2`, `female_1`, `female_2` | Assistant voices | | `female_3`, `female_4`, `female_5`, `male_3`, `male_4`, `male_5` | Additional synthetic voices | All voices read at 24 kHz mono. `speed`, `pitch_shift` and `pitch_range` adjust delivery at inference time. ## Model | | | |---|---| | Parameters | 4,536,907, waveform generator included | | Files | `onnx/model.onnx` (21 MB, float32) for inference; `model.safetensors` (18 MB, float32) with the PyTorch weights | | Input | 56 phone symbols with stress marks, from `clarvia_phonemizer` | | Output | 24 kHz mono audio | | Architecture | tiny-voca: FastSpeech2-style acoustic model with duration, pitch, voicing and energy predictors, and a small source-filter waveform generator trained with adversarial losses | | Training | 190,000 steps on one GPU, the last 40,000 on corrected clips (see Training data) | ### PyTorch weights `model.safetensors` holds the same weights as the ONNX file, for fine-tuning or for running the model in PyTorch. The architecture settings are under `"model"` in `config.json`, and the tensor names follow tiny-voca's `TinyVoca` module, so the file loads into it directly: ```python import json from safetensors.torch import load_file from tiny_voca.config import Config from tiny_voca.model import TinyVoca config = json.load(open("config.json")) model = TinyVoca(Config.from_dict(config["model"])) model.load_state_dict(load_file("model.safetensors"), strict=True) ``` ### Phonemizer `clarvia_phonemizer` turns text into Turkish phones in one pass: - **Text rules** for what an assistant says on the phone: identifiers read in groups (phone, account and installation numbers), dates, times and ranges, money (lira and kuruş), percentages, units, ordinals, house numbers and floors, abbreviations, e-mail and web addresses, and Turkish suffixes after numbers ("14:30'da" → "on dört otuzda", with vowel harmony). - **Letter rules** for Turkish: palatal k and g before front vowels, light and dark l, soft g (ğ) lengthening, circumflex vowels, and the velar nasal. - **Stress rules**: final stress by default, unstressed suffixes, the Sezer rule for place names, and an exception list for loanwords and brand names. It lives in its own repository, [wite-tech/clarvia-phonemizer](https://huggingface.co/wite-tech/clarvia-phonemizer), and can be used on its own: ```bash pip install git+https://huggingface.co/wite-tech/clarvia-phonemizer clarvia-phonemizer "Borcunuz 1.250,50 TL." ``` ```python import clarvia_phonemizer clarvia_phonemizer.normalize("Saat 14:30'da.") # "Saat on dört otuzda." (the words it will read) result = clarvia_phonemizer.phonemize("Saat 14:30'da.") result.symbols, result.ids, result.stress # phones, model token ids, stress marks ``` The word lists it uses (`data/exceptions.txt`, `data/places.txt`, `data/function_words.txt`) are plain text and easy to extend. ## Training data About 190 hours of synthetic Turkish speech, in two parts: - **41 hours from pocket-tts-turkish** in the four assistant voices: general sentences from Mozilla Common Voice Turkish (CC0) and customer-service templates with made-up names, numbers, dates and addresses. - **150 hours from Trendyol-TTS** in the six designed voices: general Turkish sentences. Every clip was force-aligned to its phones with `facebook/wav2vec2-lv-60-espeak-cv-ft` and kept only if the alignment was confident (154,000 clips). Clips where the teacher mispronounced a word or the first word of a sentence were found with Whisper and replaced or dropped before the final fine-tune. ## Evaluation Word error rate measured with Whisper large-v3 on audio the model generates from text alone. Numbers written as digits are compared digit for digit, so "4012-3987" and "40123987" count as the same. | Set | clarvia-tts-tiny | Teacher audio | |---|---|---| | Held-out validation sentences | 2.7% | 6.6% | | Held-out test sentences | 2.0% | 2.7% | | New customer-service sentences (numbers, dates, money, times) | 4.7% | – | The held-out sets are small (16 sentences each), so treat differences of a few points as noise. ## Limitations - **Turkish only.** Foreign words outside the exception list are read with Turkish letter rules. - **It inherits its teachers' mistakes.** Where a teacher voice mispronounced a word consistently, the model learned it too. We fixed the ones we found; tell us about others. - **Sentence-initial vowels** are sometimes blurred in `male_1` and `female_1` ("Ahşap" can sound like "şap"). - **Synthetic training data.** The model has never heard a human recording, so its delivery is as natural as its teachers', not more. - **No voice cloning.** The voices are fixed; there is no reference-audio input. ## Responsible use Do not use this model to impersonate real people, to deceive listeners about whether they are hearing a machine, or for fraud or harassment. Tell people when they are talking to a synthetic voice. ## Credits and licence - Model and inference script: Apache-2.0. - Built on [tiny-voca](https://github.com/n4ze3m/tiny-voca) by n4ze3m (Apache-2.0). - Teacher models: [pocket-tts-turkish](https://huggingface.co/wite-tech/pocket-tts-turkish) and [Trendyol-TTS](https://huggingface.co/Trendyol/Trendyol-TTS) (MIT), itself built on [VoxCPM2](https://huggingface.co/openbmb/VoxCPM2) (Apache-2.0). - Sentences from [Mozilla Common Voice](https://commonvoice.mozilla.org/tr) Turkish (CC0). - Alignment with [wav2vec2-lv-60-espeak-cv-ft](https://huggingface.co/facebook/wav2vec2-lv-60-espeak-cv-ft); evaluation with [faster-whisper](https://github.com/SYSTRAN/faster-whisper).