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

请问为什么加载的权重是错的:RuntimeError: Error(s) in loading state_dict for MoGaA: #8

Open
nit-hmz opened this issue Dec 7, 2021 · 1 comment

Comments

@nit-hmz
Copy link

nit-hmz commented Dec 7, 2021

#我在MoGa_A.py的末尾加上这几句话,如果备注#model.load_state_dict那么是可以正常运行的,但是加载权重就报错了
if name == 'main':
from torchsummary import summary
model = MoGaA()
model.load_state_dict(torch.load('MoGaA.pth.tar'))#加载权重
summary(model,(3,224,224))
#RuntimeError: Error(s) in loading state_dict for MoGaA:

Missing key(s) in state_dict: "stem.0.weight", "stem.1.weight", "stem.1.bias",

@JiangMei0201
Copy link

varify.py 的载入方式如下:
model_dict = torch.load('C:/Users/admin/Desktop/YOLOX-ShuffleNetv2/weights/MoGaC.pth.tar')
model.load_state_dict(model_dict["model_state"])

#我在MoGa_A.py的末尾加上这几句话,如果备注#model.load_state_dict那么是可以正常运行的,但是加载权重就报错了 if name == 'main': from torchsummary import summary model = MoGaA() model.load_state_dict(torch.load('MoGaA.pth.tar'))#加载权重 summary(model,(3,224,224)) #RuntimeError: Error(s) in loading state_dict for MoGaA:

Missing key(s) in state_dict: "stem.0.weight", "stem.1.weight", "stem.1.bias",

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

2 participants