CoolFace
Modelpublic

B-K/umt5-thai-g2p-v2-0.5k

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
2likes247downloads
Model Card

umt5-thai-g2p-v2-0.5k

This model is a fine-tuned version of B-K/umt5-thai-g2p-v2-pretraining-0.5k on the B-K/thai-g2p dataset for Thai Grapheme-to-Phoneme (G2P) conversion.. It achieves the following results on the evaluation set:

  • —Loss: 1.0480
  • —Cer: 0.0369

Model description

umt5-thai-g2p-v2-0.5k is designed to convert Thai text (words or sentences) into their corresponding phonemic International Phonetic Alphabet (IPA) representations.

Intended uses & limitations

Intended Uses

  • —Thai Grapheme-to-Phoneme (G2P) Conversion: The primary use of this model is to generate phonemic transcriptions (IPA) for Thai text.
  • —Speech Synthesis Preprocessing: Can be used as a component in a Text-to-Speech (TTS) pipeline to convert input text into phonemes before acoustic model processing.

Limitations

  • —Accuracy: While the model achieves a Character Error Rate (CER) of approximately 0.0369 on the evaluation set, it is not 100% accurate. Users should expect some errors in the generated phonemes.
  • —Out-of-Distribution Data: Performance may degrade on words, phrases, or sentence structures significantly different from those present in the B-K/thai-g2p training dataset. This includes very rare words, neologisms, or complex named entities.
  • —Ambiguity: Thai orthography can sometimes be ambiguous, and the model might not always resolve such ambiguities correctly to the intended pronunciation in all contexts.
  • —Sentence-Level vs. Word-Level: While trained on a dataset that includes sentences, its robustness for very long or highly complex sentences might vary.
  • —Inherited Limitations: As a fine-tuned version of google/umt5-small, it inherits the general architectural limitations and scale of the base model.

How to use

python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("B-K/umt5-thai-g2p-v2-0.5k")
model = AutoModelForSeq2SeqLM.from_pretrained("B-K/umt5-thai-g2p-v2-0.5k")

thai_text = "สวัสดีครับนี่คือโมเดลจีทูพีขนาดสี่สิบห้าล้านพารามิเตอร์มันเล็กมาก" # Example Thai text
inputs = tokenizer(thai_text, return_tensors="pt", padding=True, truncation=True)

outputs = model.generate(**inputs, num_beams=3, max_new_tokens=256)
phonemes = tokenizer.decode(outputs[0], skip_special_tokens=True)

print(f"Thai Text: {thai_text}")
# สวัสดีครับนี่คือโมเดลจีทูพีขนาดสี่สิบห้าล้านพารามิเตอร์มันเล็กมาก
print(f"Phonemes: {phonemes.replace(" ", "")}") # <-- Removing the space to make it more readable
# sa˨˩.wat̚˨˩.diː˧.kʰrap̚˦˥.niː˥˩.kʰɯː˧.moː˧.deːl˧.t͡ɕiː˧.tʰuː˧.pʰiː˧.kʰa˨˩.naːt̚˨˩.siː˨˩.sip̚˨˩.haː˥˩.laːn˦˥.pʰaː˧.raː˧.mi˦˥.tɤː˥˩.man˧.lek̚˦˥.maːk̚˥˩

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • —learning_rate: 0.0003
  • —trainbatchsize: 128
  • —evalbatchsize: 128
  • —seed: 42
  • —optimizer: Use OptimizerNames.ADAMWTORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizerargs=No additional optimizer arguments
  • —lrschedulertype: cosine
  • —lrschedulerwarmup_steps: 500
  • —num_epochs: 50
  • —labelsmoothingfactor: 0.1

Training results

Training LossEpochStepValidation LossCerGen LenMax Gen Len
1.99894.05121.29080.25328.850896
1.99895.06401.23100.262230.979396
1.99896.07681.20740.162427.767396
1.99897.08961.16200.140428.912296
1.20988.010241.14440.123528.910896
1.20989.011521.14610.103527.194196
1.209810.012801.11990.094128.58696
1.209811.014081.11910.08928.34996
1.132212.015361.10950.085928.266296
1.132213.016641.09930.072428.491196
1.132214.017921.09840.074928.283496
1.132215.019201.09430.063828.268496
1.096116.020481.09150.06528.224196
1.096117.021761.08450.061328.34996
1.096118.023041.08300.062628.140696
1.096119.024321.08030.05828.381296
1.072920.025601.07490.056228.545396
1.072921.026881.07440.068329.083596
1.072922.028161.07340.053428.501896
1.072923.029441.06890.056228.865896
1.058124.030721.06720.053428.476896
1.058125.032001.06140.046928.683896
1.058126.033281.05980.044828.606796
1.058127.034561.05770.044328.649596
1.045828.035841.05680.042928.461196
1.045829.037121.06010.045428.516896
1.045830.038401.05790.04628.63696
1.045831.039681.05590.046428.533996
1.037232.040961.05320.042328.633896
1.037233.042241.05190.043228.647496
1.037234.043521.05330.037828.398396
1.037235.044801.05210.0428.373396
1.030736.046081.05110.0428.60196
1.030737.047361.05070.040128.528296
1.030738.048641.05070.041428.568296
1.030739.049921.04880.037628.538296
1.025640.051201.04880.038228.54696
1.025641.052481.04910.038628.502596
1.025642.053761.04830.037328.511896
1.022943.055041.04790.037828.518296
1.022944.056321.04810.037628.540396
1.022945.057601.04800.039128.553296
1.022946.058881.04850.037428.533996
1.021147.060161.04820.037128.512596
1.021148.061441.04800.037228.516896
1.021149.062721.04790.037628.525396
1.021150.064001.04800.036928.503296

Framework versions

  • —Transformers 4.47.0
  • —Pytorch 2.5.1
  • —Datasets 3.6.0
  • —Tokenizers 0.21.0