← all repositories
KiaBush/persian-text-to-ipa-byt5

Teaching ByT5 to Sound Out Persian Text

It exists because Persian TTS and linguistics tools need a modern, learned grapheme-to-phoneme converter that outputs standard IPA without brittle hand-written rules.

651 stars Python Language ModelsML Frameworks
persian-text-to-ipa-byt5
Collecting fresh signals — velocity needs a few days of history.
collecting data…
star history

What it does This repository provides Python inference code for a fine-tuned google/byt5-small model that converts Persian (Farsi) text into International Phonetic Alphabet phoneme sequences. It is essentially a lightweight client: the weights, tokenizer, and model card live on Hugging Face, while this repo handles translation and batch inference. The output is meant for TTS pipelines or linguistic analysis.

The interesting bit Persian G2P is tricky because the script omits many vowels and relies on an unwritten ezafe construction to link words, yet the model attempts to infer these missing phonetic cues from context alone. That makes it a learned alternative to hand-crafted pronunciation rules, though the README admits the results are uneven.

Key highlights

  • Built on the google/byt5-small transformer checkpoint.
  • Supports single and batch inference with automatic fallback from GPU to CPU.
  • Weights are fetched from Hugging Face on first run; a PERSIAN_G2P_MODEL environment variable lets you redirect to a local checkpoint.
  • Apache 2.0 license covers the code and model artifacts, though the training dataset is withheld from public redistribution.

Caveats

  • No official benchmarks or evaluation metrics are published, so accuracy is essentially anecdotal.
  • Expect trouble with names, loanwords, abbreviations, numbers, code-switching, and the unwritten ezafe constructions that link Persian words.
  • The model outputs phoneme strings but no timestamps or forced-alignment data.

Verdict Worth a look if you are building Persian TTS or phonetic dictionaries; skip it if you need benchmarked, production-hardened G2P or phoneme-level alignment.

Frequently asked

What is KiaBush/persian-text-to-ipa-byt5?
It exists because Persian TTS and linguistics tools need a modern, learned grapheme-to-phoneme converter that outputs standard IPA without brittle hand-written rules.
Is persian-text-to-ipa-byt5 open source?
Yes — KiaBush/persian-text-to-ipa-byt5 is open source, released under the Apache-2.0 license.
What language is persian-text-to-ipa-byt5 written in?
KiaBush/persian-text-to-ipa-byt5 is primarily written in Python.
How popular is persian-text-to-ipa-byt5?
KiaBush/persian-text-to-ipa-byt5 has 651 stars on GitHub.
Where can I find persian-text-to-ipa-byt5?
KiaBush/persian-text-to-ipa-byt5 is on GitHub at https://github.com/KiaBush/persian-text-to-ipa-byt5.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.