Skip to content

Instantly share code, notes, and snippets.

@fangkuoyu
Last active April 5, 2022 02:12
Show Gist options
  • Select an option

  • Save fangkuoyu/4ad4d180791850c1f474eab2e021aee7 to your computer and use it in GitHub Desktop.

Select an option

Save fangkuoyu/4ad4d180791850c1f474eab2e021aee7 to your computer and use it in GitHub Desktop.
from transformers import pipeline
fillmask_bert = pipeline('fill-mask', model="bert-base-uncased")
sentence = "Paris is the [MASK] of France."
print(sentence)
pred = fillmask_bert(sentence)
for item in pred:
print(item)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment