Instructions to use coutMinh/mbart-large-50 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use coutMinh/mbart-large-50 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="coutMinh/mbart-large-50")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("coutMinh/mbart-large-50") model = AutoModelForSeq2SeqLM.from_pretrained("coutMinh/mbart-large-50", device_map="auto") - Notebooks
- Google Colab
- Kaggle
ViDia2Std mBART-large-50
This model normalizes Vietnamese regional and dialectal expressions into Standard Vietnamese while preserving the original meaning.
It accompanies the Dialectal Robustness of LLMs under Meaning-Preserving Vietnamese Variation project. The project studies whether language-model decisions remain stable when Vietnamese task content is rewritten in regional dialects. This normalizer supports experiments that compare direct dialect input with input normalized before downstream inference.
The model was fine-tuned from
facebook/mbart-large-50
using Vietnamese dialect/standard sentence pairs from
Biu3010/ViDia2Std.
Intended use
- Normalize Vietnamese dialect text before downstream NLP or LLM inference.
- Study the effect of dialect-to-standard normalization on model robustness.
- Provide a reproducible baseline for Vietnamese text normalization research.
This model is a research artifact. Its output should be reviewed before use in high-stakes or production workflows, especially for dialects or expressions that are underrepresented in the training data.
Inference with Transformers
Install the required packages:
pip install torch transformers sentencepiece
Run inference:
import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
MODEL_ID = "coutMinh/mbart-large-50"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
tokenizer.src_lang = "vi_VN"
tokenizer.tgt_lang = "vi_VN"
model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_ID)
model.to(device).eval()
@torch.inference_mode()
def normalize(text: str) -> str:
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True,
max_length=128,
)
inputs.pop("token_type_ids", None)
inputs = {key: value.to(device) for key, value in inputs.items()}
generation_args = {
"max_new_tokens": 64,
"do_sample": False,
"num_beams": 1,
"pad_token_id": tokenizer.pad_token_id,
"eos_token_id": tokenizer.eos_token_id,
}
if "vi_VN" in tokenizer.lang_code_to_id:
generation_args["forced_bos_token_id"] = (
tokenizer.lang_code_to_id["vi_VN"]
)
output = model.generate(**inputs, **generation_args)
return tokenizer.decode(output[0], skip_special_tokens=True)
print(normalize("mi đi mô rứa mi, tau không biết"))
Expected output:
mày đi đâu vậy mày, tao không biết
Space API
The accompanying
Gradio demo
exposes a /normalize API endpoint when its runtime is enabled:
pip install gradio_client
from gradio_client import Client
client = Client("coutMinh/mbart-large-50-demo")
result = client.predict(
text="mi đi mô rứa mi, tau không biết",
api_name="/normalize",
)
print(result)
The model is not currently hosted by a Hugging Face Inference Provider. Therefore, use the local Transformers example above or enable the linked Space runtime before calling the Space API.
Test results
| Metric | Score |
|---|---|
| ROUGE-L | 0.9382 |
| BLEU | 0.8152 |
| METEOR | 0.8923 |
| WER | 0.1192 |
| CER | 0.0752 |
These scores were measured on the held-out ViDia2Std test split used in the project notebook.
- Downloads last month
- 46
Model tree for coutMinh/mbart-large-50
Base model
facebook/mbart-large-50