when training:
trained_model = training_func(.....)
torch.save(trained_model.state_dict(), 'trained.pth')

then:
pretrained_weights = torch.load('trained.pth'')
model = resnet50(pretrained=False)
model.load_state_dict(pretrained_weights)

you save your model state_dict with model structure by using torch.save(trained_model, 'trained.pth') , but you just load state_dict  by model.load_state_dict(pretrained_weights)