swe-roberta-wiki-oscar / evaluate.py
birgermoell's picture
Updated models
8f10943
raw
history blame
517 Bytes
from transformers import AutoTokenizer, AutoModelForMaskedLM
from transformers import RobertaTokenizer, RobertaForMaskedLM, pipeline
import torch
def pt_evaluate():
tokenizer = AutoTokenizer.from_pretrained("flax-community/nordic-roberta-wiki")
model = AutoModelForMaskedLM.from_pretrained("flax-community/nordic-roberta-wiki")
my_unmasker_pipeline = pipeline('fill-mask', model=model, tokenizer=tokenizer)
output = my_unmasker_pipeline("Det är roligt att <mask>")
print(output)
pt_evaluate()