Views
No views yet
homnaytroidep -> hôm nay trời đẹp).BaseContentMatch ≈ 100%): Đảm bảo không sinh từ ảo giác.1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2import torch
3
4repo = "minhmnq/byt5-vietnamese-restoration"
5device = "cuda" if torch.cuda.is_available() else "cpu"
6
7tokenizer = AutoTokenizer.from_pretrained(repo)
8model = AutoModelForSeq2SeqLM.from_pretrained(repo).to(device)
9model.eval()
10
11text = "toidanghocxulyngonngutunhien"
12inputs = tokenizer(text, return_tensors="pt").to(device)
13output = model.generate(**inputs, max_new_tokens=256, num_beams=4)
14print(tokenizer.decode(output[0], skip_special_tokens=True))
15# Kết quả: tôi đang học xử lý ngôn ngữ tự nhiên