Text Generation
MLX
Safetensors
multilingual
t5
g2p
grapheme-to-phoneme
byt5
apple-silicon
ipa
phonetics
Instructions to use mlx-community/g2p-multilingual-byT5-tiny-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/g2p-multilingual-byT5-tiny-mlx with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("mlx-community/g2p-multilingual-byT5-tiny-mlx") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use mlx-community/g2p-multilingual-byT5-tiny-mlx with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "mlx-community/g2p-multilingual-byT5-tiny-mlx" --prompt "Once upon a time"
- Atomic Chat
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- multilingual
|
| 5 |
+
tags:
|
| 6 |
+
- g2p
|
| 7 |
+
- grapheme-to-phoneme
|
| 8 |
+
- byt5
|
| 9 |
+
- mlx
|
| 10 |
+
- apple-silicon
|
| 11 |
+
- ipa
|
| 12 |
+
- phonetics
|
| 13 |
+
library_name: mlx
|
| 14 |
+
base_model: charsiu/g2p_multilingual_byT5_tiny_16_layers_100
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# g2p-multilingual-byT5-tiny-mlx
|
| 19 |
+
|
| 20 |
+
MLX-compatible weights for [charsiu/g2p_multilingual_byT5_tiny_16_layers_100](https://huggingface.co/charsiu/g2p_multilingual_byT5_tiny_16_layers_100) — a ByT5-based multilingual grapheme-to-phoneme converter supporting 100 languages.
|
| 21 |
+
|
| 22 |
+
Converted from PyTorch to SafeTensors format for use with [mlx-swift](https://github.com/ml-explore/mlx-swift) and [MLX](https://github.com/ml-explore/mlx).
|
| 23 |
+
|
| 24 |
+
## Model Details
|
| 25 |
+
|
| 26 |
+
| Property | Value |
|
| 27 |
+
|---|---|
|
| 28 |
+
| Architecture | T5ForConditionalGeneration (ByT5) |
|
| 29 |
+
| Parameters | 20.8M |
|
| 30 |
+
| Encoder layers | 12 |
|
| 31 |
+
| Decoder layers | 4 |
|
| 32 |
+
| d_model | 256 |
|
| 33 |
+
| d_ff | 1024 |
|
| 34 |
+
| Vocab size | 384 (byte-level) |
|
| 35 |
+
| Format | SafeTensors (float32) |
|
| 36 |
+
| Size | ~83 MB |
|
| 37 |
+
|
| 38 |
+
## Performance
|
| 39 |
+
|
| 40 |
+
| Metric | Score |
|
| 41 |
+
|---|---|
|
| 42 |
+
| PER (Phoneme Error Rate) | 0.096 |
|
| 43 |
+
| WER (Word Error Rate) | 0.281 |
|
| 44 |
+
|
| 45 |
+
## Usage with CharsiuG2PKit (Swift)
|
| 46 |
+
|
| 47 |
+
```swift
|
| 48 |
+
import CharsiuG2PKit
|
| 49 |
+
|
| 50 |
+
let g2p = try G2P(modelDirectory: modelURL)
|
| 51 |
+
let ipa = g2p.convert("hello", language: "eng-us")
|
| 52 |
+
// "ˈhɛɫoʊ"
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
See [CharsiuG2PKit](https://github.com/beshkenadze/CharsiuG2PKit) for full documentation.
|
| 56 |
+
|
| 57 |
+
## Usage with Python MLX
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
import mlx.core as mx
|
| 61 |
+
from mlx.utils import tree_unflatten
|
| 62 |
+
from safetensors import safe_open
|
| 63 |
+
|
| 64 |
+
tensors = {}
|
| 65 |
+
with safe_open("model.safetensors", framework="numpy") as f:
|
| 66 |
+
for key in f.keys():
|
| 67 |
+
tensors[key] = mx.array(f.get_tensor(key))
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
## Conversion
|
| 71 |
+
|
| 72 |
+
Converted from `pytorch_model.bin` using:
|
| 73 |
+
```bash
|
| 74 |
+
uv run scripts/convert_weights.py --model charsiu/g2p_multilingual_byT5_tiny_16_layers_100
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
Shared tensor aliases (`encoder.embed_tokens.weight`, `decoder.embed_tokens.weight`) are deduplicated — only `shared.weight` is kept.
|
| 78 |
+
|
| 79 |
+
## Citation
|
| 80 |
+
|
| 81 |
+
```bibtex
|
| 82 |
+
@inproceedings{zhu2022byt5,
|
| 83 |
+
title={ByT5 model for massively multilingual grapheme-to-phoneme conversion},
|
| 84 |
+
author={Zhu, Jian and Zhang, Cong and Jurgens, David},
|
| 85 |
+
booktitle={Interspeech},
|
| 86 |
+
year={2022}
|
| 87 |
+
}
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## License
|
| 91 |
+
|
| 92 |
+
MIT
|