This model is a
full fine-tuned version of
vinai/bartpho-syllable specifically designed for
Vietnamese Diacritic Restoration.
The model focuses exclusively on restoring missing Vietnamese diacritics in text written without tone marks (e.g., "trang phuc" → "trang phục"). It does not handle teencode, slang, spelling mistakes, or grammatical errors beyond diacritic restoration.
The model takes Vietnamese text without diacritics as input and outputs text with correct tone marks restored.
1from transformers import AutoTokenizer, TFAutoModelForSeq2SeqLM, pipeline
2
3path = "yammdd/vietnamese-diacritic-restoration-v2"
4
5tokenizer = AutoTokenizer.from_pretrained(path)
6model = TFAutoModelForSeq2SeqLM.from_pretrained(path, from_pt=False)
7
8pipe = pipeline(
9 task="text2text-generation",
10 model=model,
11 tokenizer=tokenizer,
12 framework="tf",
13)
14
15text = "hom nay toi rat vui khi hoc xu ly ngon ngu tu nhien"
16out = pipe(text, max_new_tokens=256)
17
18print(out[0]["generated_text"])
19# Output: hôm nay tôi rất vui khi học xử lý ngôn ngữ tự nhiên