google-research / bert

TensorFlow code and pre-trained models for BERT
https://arxiv.org/abs/1810.04805
Apache License 2.0
37.8k stars 9.56k forks source link

Use the pre-trained model for word prediction #773

Open vlosing opened 5 years ago

vlosing commented 5 years ago

Hi, I guess I have a beginners question.

How can the pre-trained model be used to get predictions for a masked word in the sentence?

Example: The man buys a newspaper at a -mask-.

How can the pre-trained model be used to get the scores for each word in the vocabulary? Words like "shop", "kiosk" should have high ratings. I am interested to get the distribution over the whole vocabulary

Thanks

danyaljj commented 4 years ago

did you figure this out?