Can't Load My PyTorch Model

Hello good people. I recently trained a PyTorch model on a GPU enabled remote server and I saved it with the state_dict. I downloaded it and now wish to run it on my local machine on CPU. I tried to load it but I don’t know why it shows me an implementation error. Am I doing it wrong and is there any way around it? Kindly find below my model architecture (a slightly fine-tuned resnet18 model)



Thank and hope to get a reply.

I was able to get this by removing the “=”. It should be model.load_state_dict(…) instead of model = model.load_state_dict(…)

You have named a class called model and also have a variable with the same name (model).
Try to keep different names to avoid confusion.