PhoTextNormalization: Text normalization model for Vietnamese

PhoTextNormalization converts Vietnamese text from written to spoken form. For example, "Một tháng có 30 hoặc 31 ngày, riêng tháng 2 có 28 ngày." will be converted to "một tháng có ba mươi hoặc ba mươi mốt ngày, riêng tháng hai có hai tám ngày."

Details of the training can be found in our ACL 2025 paper:

@inproceedings{vu2025zeroshottexttospeechvietnamese,
      title={Zero-Shot Text-to-Speech for Vietnamese}, 
      author={Thi Vu and Linh The Nguyen and Dat Quoc Nguyen},
      year={2025},
      booktitle={Proceedings of ACL},
}

Usage

import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

device = "cuda:0" if torch.cuda.is_available() else "cpu"

model_name = "thivux/PhoTextNormalization"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name).to(device)

text = 'Một tháng có 30 hoặc 31 ngày, riêng tháng 2 có 28 ngày.'
inputs = tokenizer(text, return_tensors="pt", padding=True,
                    truncation=True, max_length=1024).to(device)

# Generate translations
with torch.no_grad():
    translated_tokens = model.generate(
        **inputs, max_length=1024, num_beams=5)

# Decode 
decoded_outputs = [tokenizer.decode(output, skip_special_tokens=True)
                    for output in translated_tokens]

# decoded_outputs: ['một tháng có ba mươi hoặc ba mươi mốt ngày, riêng tháng hai có hai tám ngày.']
print(f'decoded_outputs: {decoded_outputs}')
Downloads last month
16
Safetensors
Model size
611M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for thivux/PhoTextNormalization

Finetuned
(234)
this model