bert icon indicating copy to clipboard operation
bert copied to clipboard

What is suitable max_predictions_per_seq size when max_seq_length set to 512?

Open enod opened this issue 7 years ago • 4 comments

I'm trying to pre-train BERT on my own language.

I am aware that:

The max_predictions_per_seq is the maximum number of masked LM predictions per sequence. You should set this to around max_seq_length * masked_lm_prob (the script doesn't do that automatically because the exact value needs to be passed to both scripts).

In this case, I could set the max_predictions_per_seq=~77 when max_seq_length=512. But it's not clearly mentioned neither on the original paper nor on this documentation. I'm wondering if anyone created TFrecords with max_predictions_per_seq=77 and max_seq_length=512 and trained in this setting, whether it was better than max_predictions_per_seq=20 when max_seq_length=128. @jacobdevlin-google can you share the details please?

enod avatar Mar 23 '19 13:03 enod

Hello @enod, I also have the same query. Did you get any answers?

jicksonp avatar May 09 '19 09:05 jicksonp

@jicksonp I didn't. Ended up with setting max_predictions_per_seq=~77

enod avatar May 15 '19 01:05 enod

This is explained in the README from this repo in the Pre-training with BERT part: image

manueltonneau avatar Mar 25 '20 17:03 manueltonneau

If the rule is clear, then what does the max_predictions_per_seq do? Why do we need to manually set it?

ZilongZhang avatar Aug 15 '20 06:08 ZilongZhang