stevewongv/SPANet

Train mode issue - latest pth error.

Closed this issue · 2 comments

Can not use the 'latest' model for training or testing.

When i try this code in terminal :
python main.py -a test -m latest

It will happen " state_dict missing key(s) " ERROR :
RuntimeError: Error(s) in loading state_dict for SPANet: Missing key(s) in state_dict: "SAM1.irnn1.right_weight.weight", "SAM1.irnn1.right_weight.bias"...... (ignored error message) Unexpected key(s) in state_dict: "SAM1.irnn1.right_wight.weight", "SAM1.irnn1.right_wight.bias"...... (ignored error message)

So i tried to fix some variables scope name errors in SPANet.py
e.g.
right_weight -> right_wight
up_weight -> up_wight
down_weight -> down_wight
left_wight -> left_weight

But, the (other) error happens again in the training phase (testing phase error fixed!):
ValueError: loaded state dict contains a parameter group that doesn't match the size of optimizer's group

I hope you can solve this problem as soon as possible! Thx!

Thanks, please check new version.

您好,当训练时加载模型的时候 加载训练参数的时候self.opt.load_state_dict(obj['opt']) ,报错,loaded state dict contains a parameter group that doesn't match the size of optimizer's group