I want to load a model,I need the latest_net_G_A.pth ,when I load the file ,an error appeared,it is the 'unexpected key “model.10.conv_block.5.weight” in state_dict’
Do you have an instance of a model with the exact same structure as the model you saved?
How do you save/load the model?
Did you save only the statedict or the entire model?
If you saved only the statedict you need to do something like
model = MyModel() # create instance of your model with exact same structure as the one you saved
model.load_state_dict(torch.load("/your/path/to/statedict.pth"
To check whether you saved the statedict or the entire model we need to see your saving code.
yes ,I have checked my code .Isaved the statedict rather than the entire model.thank you for you reply!