Translation
Transformers
Safetensors
Vietnamese
mbart
text2text-generation
dialect-normalization
vietnamese-dialect
social-media
low-resource
Instructions to use Biu3010/dialect-normalizer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Biu3010/dialect-normalizer with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="Biu3010/dialect-normalizer")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Biu3010/dialect-normalizer") model = AutoModelForSeq2SeqLM.from_pretrained("Biu3010/dialect-normalizer", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
language:
|
| 4 |
+
- vi
|
| 5 |
+
pipeline_tag: translation
|
| 6 |
+
tags:
|
| 7 |
+
- dialect-normalization
|
| 8 |
+
- vietnamese-dialect
|
| 9 |
+
- mbart
|
| 10 |
+
- social-media
|
| 11 |
+
- low-resource
|
| 12 |
+
datasets:
|
| 13 |
+
- Biu3010/ViDia2Std
|
| 14 |
+
base_model: facebook/mbart-large-50
|
| 15 |
+
library_name: transformers
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# mBART-ViDia2Std
|
| 19 |
+
|
| 20 |
+
<p align="center">
|
| 21 |
+
<a href="https://huggingface.co/datasets/Biu3010/ViDia2Std">ViDia2Std Dataset</a> |
|
| 22 |
+
<a href="https://ojs.aaai.org/index.php/AAAI/article/view/40247">AAAI-26 Paper</a>
|
| 23 |
+
</p>
|
| 24 |
+
|
| 25 |
+
This is a version of [mBART-large-50](https://huggingface.co/facebook/mbart-large-50) fine-tuned on the entire [ViDia2Std](https://huggingface.co/datasets/Biu3010/ViDia2Std) corpus (13,657 pairs, all 63 Vietnamese provinces) plus data augmentation, to translate Vietnamese dialects and non-standard social media text into standard Vietnamese. It is released as the strongest version for real-world use, e.g. as a preprocessing step for downstream Vietnamese NLP tasks.
|
| 26 |
+
|
| 27 |
+
> **Warning — data leakage.** This model was trained on **all splits of ViDia2Std, including `test`**. Do not use it as a baseline on the ViDia2Std test set; to reproduce the paper's baselines, train on the `train` split only.
|
| 28 |
+
|
| 29 |
+
## Usage
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
import torch
|
| 33 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 34 |
+
|
| 35 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 36 |
+
|
| 37 |
+
model_path = "Biu3010/dialect-normalizer"
|
| 38 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 39 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_path).to(device)
|
| 40 |
+
|
| 41 |
+
def normalize_text(text):
|
| 42 |
+
inputs = tokenizer(text, return_tensors="pt", max_length=128, truncation=True)
|
| 43 |
+
input_ids = inputs.input_ids.to(device)
|
| 44 |
+
attention_mask = inputs.attention_mask.to(device)
|
| 45 |
+
|
| 46 |
+
with torch.no_grad():
|
| 47 |
+
outputs = model.generate(
|
| 48 |
+
input_ids=input_ids,
|
| 49 |
+
attention_mask=attention_mask,
|
| 50 |
+
max_length=128,
|
| 51 |
+
num_beams=3,
|
| 52 |
+
early_stopping=True,
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 56 |
+
|
| 57 |
+
dialect_text = "răng mà bựa ni trời nắng rứa hề"
|
| 58 |
+
print(f"Dialect : {dialect_text}")
|
| 59 |
+
print(f"Standard: {normalize_text(dialect_text)}")
|
| 60 |
+
# Expected output: "sao mà hôm nay trời nắng thế nhỉ"
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
If you encounter language-token issues, set `tokenizer.src_lang = "vi_VN"` and pass `forced_bos_token_id=tokenizer.lang_code_to_id["vi_VN"]` to `model.generate()`.
|
| 64 |
+
|
| 65 |
+
## Reference results
|
| 66 |
+
|
| 67 |
+
The paper's mBART-large-50 baseline (trained on the `train` split only) achieves **BLEU 0.8166 · ROUGE-L 0.9384 · METEOR 0.8925** on ViDia2Std. This full-corpus model cannot be legitimately evaluated on that test set.
|
| 68 |
+
|
| 69 |
+
## Citation
|
| 70 |
+
|
| 71 |
+
```bibtex
|
| 72 |
+
@article{Anh_Ta_Van_Dinh_Nguyen_2026,
|
| 73 |
+
title = {ViDia2Std: A Parallel Corpus and Methods for Low-Resource Vietnamese Dialect-to-Standard Translation},
|
| 74 |
+
author = {Anh Ta, Khoa and Van Dinh, Nguyen and Nguyen, Kiet Van},
|
| 75 |
+
journal = {Proceedings of the AAAI Conference on Artificial Intelligence},
|
| 76 |
+
volume = {40},
|
| 77 |
+
number = {36},
|
| 78 |
+
pages = {29995--30004},
|
| 79 |
+
year = {2026},
|
| 80 |
+
month = {Mar.},
|
| 81 |
+
url = {https://ojs.aaai.org/index.php/AAAI/article/view/40247},
|
| 82 |
+
doi = {10.1609/aaai.v40i36.40247}
|
| 83 |
+
}
|
| 84 |
+
```
|