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

get_small_model.py出现维度不匹配 #8

Open
HandsLing opened this issue Aug 27, 2021 · 7 comments
Open

get_small_model.py出现维度不匹配 #8

HandsLing opened this issue Aug 27, 2021 · 7 comments

Comments

@HandsLing
Copy link

运行get_small_model.py的时候,在
File "get_small_model.py", line 242, in
small_model = get_small_model(model)
File "get_small_model.py", line 186, in get_small_model
small_model.load_state_dict(small_state_dict)
File "/home/ctgai/anaconda3/envs/taco/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1052, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Small_Model:
size mismatch for neck_self.conv1.conv.weight: copying a param with shape torch.Size([512, 716, 1, 1]) from checkpoint, the shape in current model is torch.Size([358, 716, 1, 1]).
size mismatch for neck_self.conv1.bn.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([358]).
size mismatch for neck_self.conv1.bn.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([358]).
size mismatch for neck_self.conv1.bn.running_mean: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([358]).
加载的模型是用的train_prune_sfp.py训练得到的模型,请问这是哪里的问题呢?

@mvpzhangqiu
Copy link

我的也是,这个咋解决啊 @HandsLing

@mvpzhangqiu
Copy link

@xhwNobody

@xhwNobody
Copy link
Owner

@xhwNobody

需要对代码进行修改,统一small_model网络结构和修剪后参数的维度

@Hassan686
Copy link

@xhwNobody

需要对代码进行修改,统一small_model网络结构和修剪后参数的维度

请问您能展开说说么,我也遇到了这样的问题

@wyzwyzzzzz
Copy link

请问你们解决了这个问题嘛,我也遇到了这个问题不知道怎么解决

@hwangyl
Copy link

hwangyl commented Dec 15, 2021

各位大佬,如何解决的? 怎么改,来点详细说明啊。

@kaiyu9991
Copy link

大佬,这个咋解决啊
@xhwNobody

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

7 participants