When I load some pre-trained layers to construct my new neural network, the error occurred:
KeyError: 'unexpected key "weight_g" in state_dict'
The pre-trained model is training by shared memory (A3C)
How can I fix this bug?
When I load some pre-trained layers to construct my new neural network, the error occurred:
KeyError: 'unexpected key "weight_g" in state_dict'
The pre-trained model is training by shared memory (A3C)
How can I fix this bug?
The weights are stored as an ordered dictionary. Just print out the parameters name of your network using net.named_parameters()
and see if the parameters name are matching with the keys in the stored weights.