A sentence with a masked word, which is defined as SENTENCE in bert.py.
Masked Word should be represented by one _.
Top k predicted words suitable for filling the Masked Word.
k is defined as NUM_PREDICT in bert.py
SENTENCE is defined in the bert.py.
ex. SENTENCE = 'I want to _ the car because it is cheap.'
- English Bert
$ python3 bert.py
...
predicted top 3 words: ['buy', 'drive', 'rent']- Japanese Bert (test implementation)
- [WARNING] For now, Japanese model does not work correctly.
- requirements
- juman++, boost (ref: https://blog.imind.jp/entry/2019/01/12/192936)
$ python3 bert.py -l jp
predicted top 3 words: ['結婚', '[UNK]', '旅']pytorch-pretrained-bert
BERT日本語Pretrainedモデル
PyTorch 1.3.0
ONNX opset = 10