Liberian English & Kolokwa G2P (Forward Transformer)

Fast non-autoregressive Grapheme-to-Phoneme (G2P) Forward Transformer model for Liberian English and Kolokwa, trained strictly on michsethowusu/kolokwa-text-ipa-jw (58,897 speech-aligned utterances).

Built with arcosoph/phonemize (DeepPhonemizer architecture).

Repository Contents

  • best_model.pt: 59 MB lightweight Forward Transformer checkpoint with built-in pronouncing dictionary.
  • config.yaml: Complete model hyperparameter and preprocessing specification.
  • lexicon.tsv: Extracted 12,161 word-phoneme pairs with empirical frequency-mode selections.
  • prepare_data.py: Standalone parallel monotonic dynamic-programming aligner that processes kolokwa-text-ipa-jw and outputs lexicon.tsv.
  • train.py: Modular training script to train the Forward Transformer on lexicon.tsv.
  • train_kolokwa_jw_g2p.py: Complete end-to-end all-in-one pipeline script (download $\rightarrow$ DP alignment $\rightarrow$ lexicon filtering $\rightarrow$ train $\rightarrow$ eval $\rightarrow$ release).
  • inference.py: Standalone CLI inference tool.

Model Details

  • Architecture: 6-layer Non-Autoregressive Forward Transformer
  • Hidden Dimension (d_model): 512
  • Feed-Forward Dimension (d_fft): 1024
  • Attention Heads: 4
  • Model Size: ~59 MB
  • Inference Speed: ~98,000 words/second (GPU) / ~25,000 words/second (CPU)
  • Language Code: en_lr
  • Trained on: 12,161 clean pronouncing lexicon entries extracted using monotonic DP sequence alignment from michsethowusu/kolokwa-text-ipa-jw.

Sample Outputs

Text Kolokwa IPA Prediction
da man dey go drink cold water ðæ mæ̃n de ko tɹɪ̃ŋk ko wɔtə˞
we want to talk about that wi wɑ̃nt tʰu tʰɔk əbaʊt ðæt
learn from those who continue to trust other people læ̃n fɹʌm ðoʊz hu kʰəntɪ̃nju tʰu tʰɹʌst ʌðə˞ pʰipəl
wetin we coming learn about our brother and sister them wɛtɪ̃ŋ wi kʰʌmɪ̃ŋ læ̃n əbaʊt aʊə˞ pɹʌðə˞ nd sɪstə˞ ðɛ̃m
you can trust your brothers in liberia ju kʰæ̃n tʰɹʌst jɔɹ pɹʌðə˞z ɪ̃n labirɔ

Quickstart & Inference

1. Installation

pip install phonemize huggingface_hub

2. Python Inference

from phonemize import Phonemizer
from huggingface_hub import hf_hub_download

# Download model from Hugging Face
model_path = hf_hub_download(repo_id="michsethowusu/kolokwa-g2p", filename="best_model.pt")

# Initialize Phonemizer
phonemizer = Phonemizer.from_checkpoint(model_path)

# Predict IPA phonemes
text = "da man dey go drink cold water"
phonemes = phonemizer(text, lang="en_lr")
print(phonemes)
# -> "ðæ mæ̃n de ko tɹɪ̃ŋk ko wɔtə˞"

3. CLI Inference (Using inference.py)

python inference.py "wetin we coming learn about our brother and sister them"
# Input : wetin we coming learn about our brother and sister them
# IPA   : wɛtɪ̃ŋ wi kʰʌmɪ̃ŋ læ̃n əbaʊt aʊə˞ pɹʌðə˞ nd sɪstə˞ ðɛ̃m

Reproducing / Retraining from Scratch

To reproduce the data alignment, lexicon extraction, and model training from raw Hugging Face data:

# 1. Clone repository
git clone https://huggingface.co/michsethowusu/kolokwa-g2p
cd kolokwa-g2p

# 2. Extract and align lexicon from michsethowusu/kolokwa-text-ipa-jw
python prepare_data.py

# 3. Train Forward Transformer model
python train.py --config config.yaml --lexicon lexicon.tsv

# Or run the all-in-one script:
python train_kolokwa_jw_g2p.py

Citation & Acknowledgments

Part of the Liberia Speech & Kolokwa Corpus initiative (michsethowusu/liberian-english-speech and michsethowusu/kolokwa-text-ipa-jw).

Downloads last month
27
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for michsethowusu/kolokwa-g2p

Quantizations
1 model