eva-n27 / BERT-for-Chinese-Question-Answering

Apache License 2.0
78 stars 18 forks source link

你的modeling.py中缺少BertForPreTraining()类,无法将tensorflow模型文件转化为pytorch文件 #6

Closed LouZhiX closed 5 years ago

LouZhiX commented 5 years ago

需要将BertForPreTraining类加入

eva-n27 commented 5 years ago

convert_tf_checkpoint_to_pytorch.py 了解一下

LouZhiX commented 5 years ago

image

LouZhiX commented 5 years ago

这个.modeling好像无法编译通过吧?

eva-n27 commented 5 years ago

https://github.com/xzp27/BERT-for-Chinese-Question-Answering/blob/ef2761455fbfbe23a8ca368d677c19beea5f04ba/run_squad.py#L38 本仓库中的代码中应该没有图片中的这行呀,我使用的huggingface的代码版本可能比较早,和你使用的应该不一样吧

LouZhiX commented 5 years ago

这一行代码是在convert_tf_checkpoint_to_pytorch中,run_squad中的代码是没错的

LouZhiX commented 5 years ago

目前是在tensorflow的ckpt预训练模型转化为pytorch模型上出现了问题

eva-n27 commented 5 years ago

了解了,发现是忘记上传修改后的convert_tf_checkpoint_to_pytorch.py,请稍等我更新一下

LouZhiX commented 5 years ago

好的,谢谢

eva-n27 commented 5 years ago

已将huggingface原始版本的convert_tf_checkpoint_to_pytorch.py上传,应该可以用了