Hy there



 tenet2001tenet:

model = torch.load(‘pytorch_model.bin’, map_location=‘cpu’)


This will load the pretrained parameters of the model not the model defination itself, which are stored in the form of Ordered Dict hence the error.
You should create your model class first.
class Net(nn.Module):
        // Your Model for which you want to load parameters 

model = Net()
torch.optim.SGD(lr=0.001) #According to your own Configuration.
checkpoint = torch.load(pytorch_model)
model.load_state_dict(checkpoint['model'])
optimizer.load_state_dict(checkpoint['opt']) 


Also if you want to use pretrained model in pytorch, the best way is to get them through
torchvision package. Check this tutorial.
https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html 115