Downloads · 30 days
0
yammdd/vietnamese-diacritic-restoration
vietnamese-diacritic-restoration is a machine learning model from yammdd. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as mit.
This model is a Fine-tuned version of vinai/bartpho-syllable using LoRA (Low-Rank Adaptation). It is specifically designed for Vietnamese Diacritic Restoration.
Downloads · 30 days
0
Access
Public
Updated Dec 22, 2025
Parameters
396M
797 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors792 MB · 99%
From the Hugging Face model README
This model is a Fine-tuned version of vinai/bartpho-syllable using LoRA (Low-Rank Adaptation). It is specifically designed for Vietnamese Diacritic Restoration.
Unlike general error correction systems, this model focuses on a single task only: Restoring missing Vietnamese diacritics in text written without tone marks (e.g., "trang phuc" → "trang phục").
The model does not attempt to correct teencode, slang, spelling mistakes, or grammatical errors beyond diacritic restoration.
The model was trained on a publicly available dataset subset, consisting of approximately 2,500,000 sentences split into training, validation, and test sets.
vinai/bartpho-syllableThe model is designed exclusively for Vietnamese diacritic restoration. It takes Vietnamese text written without diacritics as input and outputs the same text with correct Vietnamese tone marks restored.
Example:
You can use this model with the transformers libraries.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
path = "yammdd/vietnamese-diacritic-restoration"
tokenizer = AutoTokenizer.from_pretrained(path)
model = AutoModelForSeq2SeqLM.from_pretrained(path)
pipe = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
text = "hom nay toi rat vui khi hoc xu ly ngon ngu tu nhien"
out = pipe(text, max_new_tokens=256)
print(out[0]["generated_text"])
# Output: hôm nay tôi rất vui khi học xử lý ngôn ngữ tự nhiên
vinai/bartpho-syllableq_proj, v_proj, out_proj, fc1, fc2 (covering both attention and feed-forward layers).DataCollatorForSeq2Seq with label_pad_token_id=-100.Seq2SeqTrainer with predict_with_generate enabled for validation metrics.The model was evaluated on a held-out test set of 5,000 samples, covering a diverse range of Vietnamese sentence structures and lengths.
| Metric | Score | Note |
|---|---|---|
| BLEU | 92.41 | High linguistic and semantic fidelity |
| Word Accuracy | 97.06% | Robust word-level correction |
| Exact Match | 69.16% | Entire sentence perfectly restored |
| WER | 0.0475 | ~4.75% error rate per word |
| CER | 0.0232 | ~2.32% error rate per character |
The model's performance varies based on the complexity and length of the input:
| Category | Length (words) | Accuracy | Sample Count |
|---|---|---|---|
| Short | < 10 | 74.95% | 1,469 |
| Medium | 10 - 30 | 71.36% | 2,999 |
| Long | > 30 | 40.79% | 532 |