minhmnq/byt5-vietnamese-restoration
0176
ByT5 Vietnamese Diacritic & Punctuation Restoration
Mô hình học sâu cấp độ byte (Byte-Level ByT5) được tinh chỉnh chuyên biệt cho bài toán khôi phục dấu thanh điệu và phục hồi khoảng trắng (phân đoạn từ) tiếng Việt.
Điểm nổi bật
- Phục hồi 100% mất khoảng trắng: Phục hồi chính xác các chuỗi dính liền không dấu (
homnaytroidep->hôm nay trời đẹp). - Khóa bảo toàn nội dung gốc (`BaseContentMatch ≈ 100%`): Đảm bảo không sinh từ ảo giác.
- Tích hợp Hybrid Lexical Trigram Reranking: Khử nhập nhằng từ đồng âm.
Cách sử dụng
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch
repo = "minhmnq/byt5-vietnamese-restoration"
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSeq2SeqLM.from_pretrained(repo).to(device)
model.eval()
text = "toidanghocxulyngonngutunhien"
inputs = tokenizer(text, return_tensors="pt").to(device)
output = model.generate(**inputs, max_new_tokens=256, num_beams=4)
print(tokenizer.decode(output[0], skip_special_tokens=True))
# Kết quả: tôi đang học xử lý ngôn ngữ tự nhiên