Downloads · 30 days
74
7% of all-time downloads
minhtoan/roberta-masked-lm-vietnamese-nom
roberta-masked-lm-vietnamese-nom is a fill-mask model from minhtoan. Use it when you need the model to fill a missing word. It is set up for transformers.
A masked language model for Nôm script is a specialized version of a language model designed to understand and generate text in the Chữ Nôm script. Chữ Nôm is a logographic writing system used in Vietnam from the 13th…
Downloads · 30 days
74
7% of all-time downloads
All-time downloads
1.1K
Public
Repo size
539 MB
Likes
3
Public
Click a slice to open those files.
.bin269 MB · 100%
From the Hugging Face model README
A masked language model for Nôm script is a specialized version of a language model designed to understand and generate text in the Chữ Nôm script. Chữ Nôm is a logographic writing system used in Vietnam from the 13th to the early 20th century, primarily before the introduction of the Latin-based Vietnamese script.
Similar to other masked language models, such as GPT-3, the Chữ Nôm masked language model is trained on a large corpus of Chữ Nôm texts. This training data helps the model learn the statistical patterns, contextual relationships, and semantic meanings of characters and words in the Chữ Nôm script.
Model was trained on some literary works and poetry: Bai ca ran co bac, Buom hoa tan truyen, Chinh phu ngam, Gia huan ca, Ho Xuan Huong, Luc Van Tien, Tale of Kieu-1870, Tale of Kieu 1871, Tale of kieu 1902,...
from transformers import RobertaTokenizerFast, RobertaForMaskedLM
import torch
# Load the tokenizer
tokenizer = RobertaTokenizerFast.from_pretrained('minhtoan/roberta-masked-lm-vietnamese-nom')
# Load the model
model = RobertaForMaskedLM.from_pretrained('minhtoan/roberta-masked-lm-vietnamese-nom')
text = '<mask>如㗂䳽𠖤戈'
inputs = tokenizer(text, return_tensors="pt")
mask_token_index = torch.where(inputs["input_ids"] == tokenizer.mask_token_id)[1]
logits = model(**inputs).logits
mask_token_logits = logits[0, mask_token_index, :]
print("Predicted word:", tokenizer.decode(mask_token_logits[0].argmax()))
Phan Minh Toan