ymcui / Chinese-BERT-wwm

Pre-Training with Whole Word Masking for Chinese BERT(中文BERT-wwm系列模型)
https://ieeexplore.ieee.org/document/9599397
Apache License 2.0
9.66k stars 1.39k forks source link

rbt3将tf模型转torch报错 #204

Closed renjunxiang closed 2 years ago

renjunxiang commented 2 years ago

您好,其他几个bert-base系列模型用脚本转换都没有问题,rbt3和rbt4用脚步转换报错,方便看一下什么原因吗?

Skipping cls/predictions/key/bias
Traceback (most recent call last):
  File "convert_bert_original_tf_checkpoint_to_pytorch.py", line 61, in <module>
    convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.bert_config_file, args.pytorch_dump_path)
  File "convert_bert_original_tf_checkpoint_to_pytorch.py", line 36, in convert_tf_checkpoint_to_pytorch
    load_tf_weights_in_bert(model, config, tf_checkpoint_path)
  File "C:\Users\hp\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\transformers\models\bert\modeling_bert.py", line 157, in load_tf_weights_in_bert
    raise ValueError(f"Pointer shape {pointer.shape} and array shape {array.shape} mismatched")
ValueError: Pointer shape torch.Size([21128]) and array shape (768,) mismatched
ymcui commented 2 years ago

你好,如需PyTorch版本,可直接通过huggingface模型库下载。 https://huggingface.co/hfl 点击需要的模型之后选择files and versions选项卡,就可以看到相应文件了。

renjunxiang commented 2 years ago

你好,如需PyTorch版本,可直接通过huggingface模型库下载。 https://huggingface.co/hfl 点击需要的模型之后选择files and versions选项卡,就可以看到相应文件了。

谢谢,已经在这里下载了可以使用,只是比较好奇原因