klebster/g2p_multilingual_byT5_tiny_onnx
Multilingual G2P ByT5 Tiny — ONNX
ONNX export of charsiu/g2p_multilingual_byT5_tiny_16_layers_100. Converts written words to IPA transcriptions across 100 languages.
Quick Start
import onnxruntime as ort
from optimum.onnxruntime import ORTModelForSeq2SeqLM
from transformers import AutoTokenizer
so = ort.SessionOptions()
so.intra_op_num_threads = 8 # ~cores/4
so.inter_op_num_threads = 1
model = ORTModelForSeq2SeqLM.from_pretrained(
"klebster/g2p_multilingual_byT5_tiny_onnx",
provider="CPUExecutionProvider",
session_options=so,
)
tokenizer = AutoTokenizer.from_pretrained("klebster/g2p_multilingual_byT5_tiny_onnx")
inputs = tokenizer("<eng-us>: hello", padding=True, add_special_tokens=False, return_tensors="pt")
preds = model.generate(**inputs, num_beams=1, max_length=50)
print(tokenizer.decode(preds[0], skip_special_tokens=True))
# Output: ˈhɛɫoʊInput format: <language_code>: word (e.g. <fra>: bonjour, <ger>: Straße). See CharsiuG2P for all 100 language codes.
Benchmark Summary
Tested on 10 languages, 300 words, greedy decoding. Hardware: Intel i9-13900KS, 128 GB DDR5.
Key findings: Thread tuning is critical (default ONNX is 3x slower than PyTorch). INT8 quantization + threads=8 is the best config. GPU provides no benefit for this model size. Beam search provides negligible improvement (PER 0.0812 → 0.0808) at 3–8x latency cost.
Correctness: ONNX FP32 output is bit-identical to PyTorch. INT8 degrades PER by only 0.0005.
Evaluation
100 languages, 500 words each (50,000 total), CharsiuG2P test set:
<details> <summary>PER by language (click to expand)</summary>
</details>
<details> <summary>WER by language (click to expand)</summary>
</details>
Links
- Paper: Zhu et al. (2022), Interspeech
- Original repo: CharsiuG2P
- Base model: charsiu/g2p_multilingual_byT5_tiny_16_layers_100
- ONNX export by: klebster for phone-similarity
Citation
If you use this ONNX model, please cite both the original paper and the ONNX export:
@misc{zhu2022byt5modelmassivelymultilingual,
title={ByT5 model for massively multilingual grapheme-to-phoneme conversion},
author={Jian Zhu and Cong Zhang and David Jurgens},
year={2022},
eprint={2204.03067},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2204.03067},
}@misc{noel2025g2pmultilingualbyT5tinyonnx,
title={Multilingual G2P ByT5 Tiny — ONNX export},
author={Kleber Noel},
year={2026},
month={apr},
note={Published 2026-04-07},
url={https://huggingface.co/klebster/g2p_multilingual_byT5_tiny_onnx},
}Known Issues
German IPA quality: non-standard dialect
The model does not reliably produce Standard German (Hochdeutsch). Observed issues include use of alveolar flap /ɾ/ where Standard German uses uvular fricative /ʁ/, among other systematic deviations. See CharsiuG2P issue #20.
Spanish dialect dictionaries: spa and spa-me are identical
The spa (European Spanish) and spa-me (Mexican Spanish) dictionaries are identical in the upstream CharsiuG2P repository. They should differ in the /s/–/θ/ distinction (ceceo/seseo). See CharsiuG2P issue #15.
