Solved by ptrblck in post #2 
              
              
                The stored checkpoints contains most likely the state_dicts of the model and optimizer. 
You would have to create a model instance first and load the state_dict afterwards as explained in the serialization docs: 
model = MyModel()
optimizer = torch.optim.Adam(model.parameters(), lr=1e-3) # change to…