lao-ipa-nontonal / README.md
Ammonsh's picture
Update README.md
d6ea20c verified
|
Raw History Blame Contribute Delete
3 kB
---
language:
- lo
tags:
- lao
- ipa
- phonemization
- seq2seq
- text2text-generation
- encoder-decoder
license: apache-2.0
---
# Lao IPA (Non-tonal)
A sequence-to-sequence model that converts Lao script to IPA (International Phonetic Alphabet) transcriptions, **without tone markers**.
Trained from scratch using a BERT-based encoder-decoder architecture with character-level tokenizers for both input (Lao) and output (IPA).
For a version with tone markers, see [byumatrixlab/lao-ipa-tonal](https://huggingface.co/byumatrixlab/lao-ipa-tonal).
## Model Details
| Property | Value |
|---|---|
| Architecture | `EncoderDecoderModel` (BERT encoder + BERT decoder) |
| Hidden size | 512 |
| Layers (enc + dec) | 6 each |
| Attention heads | 8 |
| Feed-forward size | 1024 |
| Encoder vocab size | 1000 (Lao characters) |
| Decoder vocab size | 1000 (IPA characters, no tone diacritics) |
| Max sequence length | 128 |
| Best eval loss | 0.7419 (checkpoint 4000, ~6 epochs) |
## Usage
This model uses **two separate tokenizers** — one for Lao input and one for IPA output — stored in subfolders.
```python
from transformers import EncoderDecoderModel, AutoTokenizer
model = EncoderDecoderModel.from_pretrained("byumatrixlab/lao-ipa-nontonal")
encoder_tokenizer = AutoTokenizer.from_pretrained("byumatrixlab/lao-ipa-nontonal", subfolder="encoder_tokenizer")
decoder_tokenizer = AutoTokenizer.from_pretrained("byumatrixlab/lao-ipa-nontonal", subfolder="decoder_tokenizer")
def lao_to_ipa(text, num_beams=4):
inputs = encoder_tokenizer(
text,
return_tensors="pt",
truncation=True,
max_length=128,
)
output_ids = model.generate(
**inputs,
max_length=128,
num_beams=num_beams,
early_stopping=True,
)
return decoder_tokenizer.decode(output_ids[0], skip_special_tokens=True)
print(lao_to_ipa("ສະບາຍດີ"))
print(lao_to_ipa("ຂອບໃຈ"))
```
### Batched inference
```python
def lao_to_ipa_batch(texts, num_beams=4):
inputs = encoder_tokenizer(
texts,
return_tensors="pt",
padding=True,
truncation=True,
max_length=128,
)
output_ids = model.generate(
**inputs,
max_length=128,
num_beams=num_beams,
early_stopping=True,
)
return [decoder_tokenizer.decode(ids, skip_special_tokens=True) for ids in output_ids]
```
## Training Data and Repository
Developed by the BYU MATRIX Lab.
Training code and data processing scripts: [MekongPhon](https://github.com/byu-matrix-lab/MekongPhon)
## Citation
If you use this model, please cite:
```
@inproceedings{shurtz2026mekongphon,
title={MekongPhon: A Large-Scale Parallel IPA Corpus for Lao and Khmer},
author={Shurtz, Ammon and Richardson, Christian and Richardson, Stephen D},
booktitle={Proceedings of the Fifteenth Language Resources and Evaluation Conference (LREC 2026)},
volume={11},
number={16},
pages={1650--1658},
year={2026}
}
```