ZhuiyiTechnology / simbert

a bert for retrieval and generation
Apache License 2.0
843 stars 150 forks source link

预训练模型checkpoint转换pytorch出错 #21

Open lidw-chinese opened 3 years ago

lidw-chinese commented 3 years ago

想把chinese_simbert_L-4_H-312_A-12转换成pytorch版本,出现了错误,请问大佬怎么解决呢? File "E:/project/ws/convert.py", line 63, in convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, bert_config_file, pytorch_dump_path) File "E:/project/ws/convert.py", line 34, in convert_tf_checkpoint_to_pytorch load_tf_weights_in_bert(model, config, tf_checkpoint_path) File "D:\ProgramData\Miniconda3\envs\tf2.3-cpu\lib\site-packages\transformers\models\bert\modeling_bert.py", line 158, in load_tf_weights_in_bert ), f"Pointer shape {pointer.shape} and array shape {array.shape} mismatched" AssertionError: ('Pointer shape torch.Size([312]) and array shape (128,) mismatched', torch.Size([312]), (128,))

bojone commented 2 years ago

不清楚,不懂pytorch