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 test.py ****
loading pretrained model from trained_models/mixed_second_finetune_acc97p7.pth
Traceback (most recent call last):
File "test.py", line 64, in
**model.load_state_dict(torch.load(crnn_model_path,map_location='cpu')) **
File "/home/seven/anaconda3/envs/chinese_ocr/lib/python2.7/site-packages/torch/nn/modules/module.py", line 719, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for CRNN:
size mismatch for rnn.1.embedding.bias: copying a param of torch.Size([19997]) from checkpoint, where the shape is torch.Size([6736]) in current model.
size mismatch for rnn.1.embedding.weight: copying a param of torch.Size([19997, 512]) from checkpoint, where the shape is torch.Size([6736, 512]) in current model.
The text was updated successfully, but these errors were encountered:
当我尝试运行这份代码时,test.py 有以下报错信息,疑惑?
我添加了map_location='cpu' 是这个原因吗?
model.load_state_dict(torch.load(crnn_model_path,map_location='cpu'))
报错信息:
The text was updated successfully, but these errors were encountered: