You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ python run.py --model albert_base_bright
Loading data...
401it [00:04, 96.21it/s]
140it [00:01, 101.19it/s]
135it [00:01, 86.25it/s]
Time usage: 0:00:07
Traceback (most recent call last):
File "run.py", line 39, in <module>
model = x.Model(config).to(config.device)
File "F:\PycharmProjects\Bert-Chinese-Text-Classification-Pytorch-master\models\albert_base_bright.py", line 40, in __init__
self.bert = BertModel.from_pretrained(config.bert_path,config=model_config)
File "D:\anaconda3\lib\site-packages\pytorch_transformers\modeling_utils.py", line 594, in from_pretrained
model.__class__.__name__, "\n\t".join(error_msgs)))
**RuntimeError: Error(s) in loading state_dict for BertModel:
size mismatch for bert.embeddings.word_embeddings.weight: copying a param with shape torch.Size([21128, 128]) from checkpoint, the shape in current model is torch.Size([21128, 768]).**
您好!
最近用您的pytorch框架加载了很多的预训练模型fintune自己的任务都成功了,但是在用albert族的model的时候却都没成功。
报错如下:
其中albert_base_bright的的config.json如下:
albert族的model只有albert_xxlarge_zh能够成功,albert_xxlarge_zh的json配置文件如下:
我在github上找到了这个 issues
于是我用了HuggingFace的pytorch_transfomers来加载模型:
请问您遇到过这种报错么?这种情况是什么原因呢?是要用convert_to_pytorch那几个文件转换一下吗?
望您有时间能够抽空回复,多谢!
The text was updated successfully, but these errors were encountered: