Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model's dimension doesn't match checkpoint's dimension? #7

Open
chithize opened this issue Apr 9, 2020 · 0 comments
Open

model's dimension doesn't match checkpoint's dimension? #7

chithize opened this issue Apr 9, 2020 · 0 comments

Comments

@chithize
Copy link

chithize commented Apr 9, 2020

HI,参照myTest目录下的video测试demo脚本,
下载页面提供的模型链接文件
将 154行 :File = os.path.join(exp_args.model_root, 'model_best.pth.tar')
改成
bestModelFile = os.path.join(exp_args.model_root, 'mobilenetv2_total_with_prior_channel.tar')
运行后产生如下错误

videotest.py:101: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
cf = load(cont)
finish load config file ...
Traceback (most recent call last):
File "videotest.py", line 158, in
netmodel_video.load_state_dict(checkpoint_video['state_dict'])
File "/home/hcruise/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 487, in load_state_dict
.format(name, own_state[name].size(), param.size()))
RuntimeError: While copying the parameter named stage0.0.weight, whose dimensions in the model are torch.Size([32, 4, 3, 3]) and whose dimensions in the checkpoint are torch.Size([32, 3, 3, 3]).

这是什么情况,我是安装主页上说的安装的pytorch 0.3.0post4, 及torchvision 0.2.0
为什么load模型后又说自己的模型dimension不对呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant