[SOLVED] Load_state_dict error

Hi, thank you always for your help.
When I load my trained model using load_state_dict, it raises the following error:

File “/root/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/site-packages/torch/optim/optimizer.py”, line 114, in load_state_dict
raise ValueError("loaded state dict contains a parameter group "
ValueError: loaded state dict contains a parameter group that doesn’t match the size of optimizer’s group

I could loaded trained models until yesterday, and have suddenly become unable to load them.
I will looking forward to hearing any suggestion to correct this issue.

Thank you in advance:)

Apparently the number parameters known to the optimizer changed somehow.
Note that this is from loading the optimizer’s state dict, not the model.

Best regards

Thomas

1 Like

Hi tom,
Thank you for your kind reply.
As you suggested, I used wrong numbers of parameters.
I tried to load parameters for different layer depth by mistake.
It now works by setting the model size and parameter size.

Thank you for your help!