Use the model


from transformers import BertTokenizer, BertForMaskedLM
import torch

# Load the tokenizer
tokenizer = BertTokenizer.from_pretrained('btqkhai/SinoNomBERT')
# Load the model
model = BertForMaskedLM.from_pretrained('btqkhai/SinoNomBERT')

text = '大 [MASK] 百 官 其 𢮿 花 供 饌 皆 用 新 禮'

inputs = tokenizer(text, return_tensors="pt")
mask_token_index = torch.where(inputs["input_ids"] == tokenizer.mask_token_id)[1]
# Ground Truth: 宴
logits = model(**inputs).logits
mask_token_logits = logits[0, mask_token_index, :]

print("Predicted word:",  tokenizer.decode(mask_token_logits[0].argmax()))
Downloads last month
6
Safetensors
Model size
125M params
Tensor type
F32
·
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.

Model tree for btqkhai/SinoNomBERT

Finetuned
(3)
this model