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
102
Safetensors
Model size
125M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for btqkhai/SinoNomBERT

Finetuned
(3)
this model