bert icon indicating copy to clipboard operation
bert copied to clipboard

BERT as a language model

Open eaplatanios opened this issue 8 years ago • 4 comments

Hi there,

First of all, thanks for open-sourcing BERT as a concise independent codebase that's easy to go through and play around with. :)

I have a question regarding just applying BERT as a language model scoring function. For example, say I have a text file containing one sentence per line. Is there a simple way to just score those sentences with their likelihood under the BERT language model?

Thanks, Anthony

eaplatanios avatar Nov 17 '18 17:11 eaplatanios

Related : #35

astariul avatar Nov 19 '18 01:11 astariul

You can mask each word one at a time, but this doesn't give you a meaningful sentence probability.

jacobdevlin-google avatar Nov 23 '18 22:11 jacobdevlin-google

Thanks! I see. I guess that makes sense in the context of the masked LM.

eaplatanios avatar Nov 24 '18 00:11 eaplatanios

would this work? https://github.com/xu-song/bert-as-language-model

dpny518 avatar Jan 08 '20 03:01 dpny518