Skip to content

Instantly share code, notes, and snippets.

from transformers import pipeline
import random
unmasker = pipeline('fill-mask', model='bert-base-cased')
input_text = "I went to see a movie in the theater"
orig_text_list = input_text.split()
len_input = len(orig_text_list)
#Random index where we want to replace the word