10000 RuntimeError: Error(s) in loading state_dict for SemGCN · Issue #33 · garyzhao/SemGCN · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

RuntimeError: Error(s) in loading state_dict for SemGCN #33

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

Open
punjal97 opened this issue Nov 5, 2020 · 9 comments
Open

RuntimeError: Error(s) in loading state_dict for SemGCN #33

punjal97 opened this issue Nov 5, 2020 · 9 comments

Comments

@punjal97
Copy link
punjal97 commented Nov 5, 2020

Thankyou for your work, I tried running the code using

python main_linear.py --evaluate checkpoint/pretrained/ckpt_linear.pth.tar

python main_gcn.py --evaluate checkpoint/pretrained/ckpt_semgcn.pth.tar

are working fine, but getting missing keys error for this run
python main_gcn.py --non_local --evaluate checkpoint/pretrained/ckpt_semgcn_nonlocal.pth.tar

$ python main_gcn.py --non_local --evaluate checkpoint/pretrained/ckpt_semgcn_nonlocal.pth.tar ==> Using settings Namespace(actions='*', batch_size=64, checkpoint='checkpoint', dataset='h36m', downsample=1, dropout=0.0, epochs=100, evaluate='checkpoint/pretrained/ckpt_semgcn_nonlocal.pth.tar', hid_dim=128, keypoints='gt', lr=0.001, lr_decay=100000, lr_gamma=0.96, max_norm=True, non_local=True, num_layers=4, num_workers=8, resume='', snapshot=5) ==> Loading dataset... ==> Preparing data... ==> Loading 2D detections... ==> Creating model... ==> Total parameters: 0.43M ==> Loading checkpoint 'checkpoint/pretrained/ckpt_semgcn_nonlocal.pth.tar' Traceback (most recent call last): File "main_gcn.py", line 320, in <module> main(parse_args()) File "main_gcn.py", line 138, in main model_pos.load_state_dict(ckpt['state_dict']) File "/home/kirk/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/site-packages/torch/nn/modules/module.py", line 839, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for SemGCN: Missing key(s) in state_dict: "gconv_input.1.nonlocal1.g.0.weight", "gconv_input.1.nonlocal1.g.0.bias", "gconv_input.1.nonlocal1.theta.weight", "gconv_input.1.nonlocal1.theta.bias", "gconv_input.1.nonlocal1.phi.0.weight", "gconv_input.1.nonlocal1.phi.0.bias", "gconv_input.1.nonlocal1.concat_project.0.weight", "gconv_input.1.nonlocal1.W.0.weight", "gconv_input.1.nonlocal1.W.0.bias", "gconv_input.1.nonlocal1.W.1.weight", "gconv_input.1.nonlocal1.W.1.bias", "gconv_input.1.nonlocal1.W.1.running_mean", "gconv_input.1.nonlocal1.W.1.running_var", "gconv_layers.1.nonlocal1.g.0.weight", "gconv_layers.1.nonlocal1.g.0.bias", "gconv_layers.1.nonlocal1.theta.weight", "gconv_layers.1.nonlocal1.theta.bias", "gconv_layers.1.nonlocal1.phi.0.weight", "gconv_layers.1.nonlocal1.phi.0.bias", "gconv_layers.1.nonlocal1.concat_project.0.weight", "gconv_layers.1.nonlocal1.W.0.weight", "gconv_layers.1.nonlocal1.W.0.bias", "gconv_layers.1.nonlocal1.W.1.weight", "gconv_layers.1.nonlocal1.W.1.bias", "gconv_layers.1.nonlocal1.W.1.running_mean", "gconv_layers.1.nonlocal1.W.1.running_var", "gconv_layers.3.nonlocal1.g.0.weight", "gconv_layers.3.nonlocal1.g.0.bias", "gconv_layers.3.nonlocal1.theta.weight", "gconv_layers.3.nonlocal1.theta.bias", "gconv_layers.3.nonlocal1.phi.0.weight", "gconv_layers.3.nonlocal1.phi.0.bias", "gconv_layers.3.nonlocal1.concat_project.0.weight", "gconv_layers.3.nonlocal1.W.0.weight", "gconv_layers.3.nonlocal1.W.0.bias", "gconv_layers.3.nonlocal1.W.1.weight", "gconv_layers.3.nonlocal1.W.1.bias", "gconv_layers.3.nonlocal1.W.1.running_mean", "gconv_layers.3.nonlocal1.W.1.running_var", "gconv_layers.5.nonlocal1.g.0.weight", "gconv_layers.5.nonlocal1.g.0.bias", "gconv_layers.5.nonlocal1.theta.weight", "gconv_layers.5.nonlocal1.theta.bias", "gconv_layers.5.nonlocal1.phi.0.weight", "gconv_layers.5.nonlocal1.phi.0.bias", "gconv_layers.5.nonlocal1.concat_project.0.weight", "gconv_layers.5.nonlocal1.W.0.weight", "gconv_layers.5.nonlocal1.W.0.bias", "gconv_layers.5.nonlocal1.W.1.weight", "gconv_layers.5.nonlocal1.W.1.bias", "gconv_layers.5.nonlocal1.W.1.running_mean", "gconv_layers.5.nonlocal1.W.1.running_var", "gconv_layers.7.nonlocal1.g.0.weight", "gconv_layers.7.nonlocal1.g.0.bias", "gconv_layers.7.nonlocal1.theta.weight", "gconv_layers.7.nonlocal1.theta.bias", "gconv_layers.7.nonlocal1.phi.0.weight", "gconv_layers.7.nonlocal1.phi.0.bias", "gconv_layers.7.nonlocal1.concat_project.0.weight", "gconv_layers.7.nonlocal1.W.0.weight", "gconv_layers.7.nonlocal1.W.0.bias", "gconv_layers.7.nonlocal1.W.1.weight", "gconv_layers.7.nonlocal1.W.1.bias", "gconv_layers.7.nonlocal1.W.1.running_mean", "gconv_layers.7.nonlocal1.W.1.running_var". Unexpected key(s) in state_dict: "gconv_input.1.nonlocal.g.0.weight", "gconv_input.1.nonlocal.g.0.bias", "gconv_input.1.nonlocal.theta.weight", "gconv_input.1.nonlocal.theta.bias", "gconv_input.1.nonlocal.phi.0.weight", "gconv_input.1.nonlocal.phi.0.bias", "gconv_input.1.nonlocal.concat_project.0.weight", "gconv_input.1.nonlocal.W.0.weight", "gconv_input.1.nonlocal.W.0.bias", "gconv_input.1.nonlocal.W.1.weight", "gconv_input.1.nonlocal.W.1.bias", "gconv_input.1.nonlocal.W.1.running_mean", "gconv_input.1.nonlocal.W.1.running_var", "gconv_input.1.nonlocal.W.1.num_batches_tracked", "gconv_layers.1.nonlocal.g.0.weight", "gconv_layers.1.nonlocal.g.0.bias", "gconv_layers.1.nonlocal.theta.weight", "gconv_layers.1.nonlocal.theta.bias", "gconv_layers.1.nonlocal.phi.0.weight", "gconv_layers.1.nonlocal.phi.0.bias", "gconv_layers.1.nonlocal.concat_project.0.weight", "gconv_layers.1.nonlocal.W.0.weight", "gconv_layers.1.nonlocal.W.0.bias", "gconv_layers.1.nonlocal.W.1.weight", "gconv_layers.1.nonlocal.W.1.bias", "gconv_layers.1.nonlocal.W.1.running_mean", "gconv_layers.1.nonlocal.W.1.running_var", "gconv_layers.1.nonlocal.W.1.num_batches_tracked", "gconv_layers.3.nonlocal.g.0.weight", "gconv_layers.3.nonlocal.g.0.bias", "gconv_layers.3.nonlocal.theta.weight", "gconv_layers.3.nonlocal.theta.bias", "gconv_layers.3.nonlocal.phi.0.weight", "gconv_layers.3.nonlocal.phi.0.bias", "gconv_layers.3.nonlocal.concat_project.0.weight", "gconv_layers.3.nonlocal.W.0.weight", "gconv_layers.3.nonlocal.W.0.bias", "gconv_layers.3.nonlocal.W.1.weight", "gconv_layers.3.nonlocal.W.1.bias", "gconv_layers.3.nonlocal.W.1.running_mean", "gconv_layers.3.nonlocal.W.1.running_var", "gconv_layers.3.nonlocal.W.1.num_batches_tracked", "gconv_layers.5.nonlocal.g.0.weight", "gconv_layers.5.nonlocal.g.0.bias", "gconv_layers.5.nonlocal.theta.weight", "gconv_layers.5.nonlocal.theta.bias", "gconv_layers.5.nonlocal.phi.0.weight", "gconv_layers.5.nonlocal.phi.0.bias", "gconv_layers.5.nonlocal.concat_project.0.weight", "gconv_layers.5.nonlocal.W.0.weight", "gconv_layers.5.nonlocal.W.0.bias", "gconv_layers.5.nonlocal.W.1.weight", "gconv_layers.5.nonlocal.W.1.bias", "gconv_layers.5.nonlocal.W.1.running_mean", "gconv_layers.5.nonlocal.W.1.running_var", "gconv_layers.5.nonlocal.W.1.num_batches_tracked", "gconv_layers.7.nonlocal.g.0.weight", "gconv_layers.7.nonlocal.g.0.bias", "gconv_layers.7.nonlocal.theta.weight", "gconv_layers.7.nonlocal.theta.bias", "gconv_layers.7.nonlocal.phi.0.weight", "gconv_layers.7.nonlocal.phi.0.bias", "gconv_layers.7.nonlocal.concat_project.0.weight", "gconv_layers.7.nonlocal.W.0.weight", "gconv_layers.7.nonlocal.W.0.bias", "gconv_layers.7.nonlocal.W.1.weight", "gconv_layers.7.nonlocal.W.1.bias", "gconv_layers.7.nonlocal.W.1.running_mean", "gconv_layers.7.nonlocal.W.1.running_var", "gconv_layers.7.nonlocal.W.1.num_batches_tracked".

@1165048017
Copy link

same error

@garyzhao
Copy link
Owner

Hi @Chromium97 ,

I guess you might be using Python 3.

Changing to Python 2 might solve this problem.

Best,
Long

@punjal97
Copy link
Author

Hi @garyzhao

I was earlier using Python 3.6.x
but tried running the same thing with new virtual env for Python 2.7.18,

Giving the same error for last command, the other two are working okay just like above.

Any idea here?
Thanks

@HDYYZDN
Copy link
HDYYZDN commented Dec 7, 2020

model.load_state_dict(checkpoint['state_dict'], strict=False) 解决问题

@SuperAttitude
Copy link

model.load_state_dict(checkpoint['state_dict'], strict=False) 解决问题

您好,打扰您了,这行代码加到哪里运行呢,谢谢,感激不尽

@jujakoss
Copy link
jujakoss commented Apr 5, 2021

model.load_state_dict(checkpoint['state_dict'], strict=False) 解决问题

您好,打扰您了,这行代码加到哪里运行呢,谢谢,感激不尽
@SuperAttitude

in viz.py line 106
model_pos.load_state_dict(ckpt['state_dict'], strict=False)

@SuperAttitude
Copy link

model.load_state_dict(checkpoint['state_dict'], strict=False) 解决问题

您好,打扰您了,这行代码加到哪里运行呢,谢谢,感激不尽
@SuperAttitude

in viz.py line 106
model_pos.load_state_dict(ckpt['state_dict'], strict=False)

Thank you, thank you for your help, sincerely wish you good luck.

@tamasino52
Copy link

print("==> Loading checkpoint '{}'".format(ckpt_path))
ckpt = torch.load(ckpt_path)
start_epoch = ckpt['epoch']
error_best = ckpt['error']
glob_step = ckpt['step']
lr_now = ckpt['lr']

for k, v in ckpt['state_dict'].copy().items():
ckpt['state_dict'][k.replace('nonlocal', 'non_local')] = ckpt['state_dict'].pop(k)

model_pos.load_state_dict(ckpt['state_dict'])

Rename like this.

@PawAlldeller
Copy link

model.load_state_dict(checkpoint['state_dict'], strict=False) 解决问题

您好,打扰您了,这行代码加到哪里运行呢,谢谢,感激不尽
@SuperAttitude

in viz.py line 106 model_pos.load_state_dict(ckpt['state_dict'], strict=False)

Sorry, but where is this viz located?py ? How to find it

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

8 participants
0