https://github.com/google-research/bert/blob/4a47cc2da23dcb4ab1bf5c08085910b6fd94a4cf/run_squad.py#L865-L890
This may cause best_non_null_entry is None when FLAGS.version_2_with_negative is True, and I think if not nbest should be moved up.
Yes, sometimes the best_non_null_entry can be null and breaks the prediction process. It would be better to add a if/else to avoid such unexpected behavior.
Most helpful comment
Yes, sometimes the
best_non_null_entrycan benulland breaks the prediction process. It would be better to add aif/elseto avoid such unexpected behavior.