Thanks,I fine-tuned the pre-training model, then saved my model after training my own data. The code for fine-tuning the pre-training model and saving the model is as follows:
######################################################################
Finetuning the convnet
model_ft = models.resnet101(pretrained=True)
num_ftrs = model_ft.fc.in_features
model_ft.fc = nn.Linear(num_ftrs, 11)
######################################################################
save the fnie-tuned model
            torch.save({'epoch': epoch + 1, 'state_dict': model.state_dict(), 
                        'optimizer': optimizer.state_dict()},
                       './checkpoint/' + 'new.pth.tar')

But when i load the saved model ,like this:
checkpoint = torch.load("./checkpoint/new.pth.tar")
myresnet = model_ft.load_state_dict(checkpoint[‘state_dict’])
There have a error,I don’t know how to define the model,for I use the pretrained-model.error like this:
myresnet = model_ft.load_state_dict(checkpoint[‘state_dict’])
NameError: name ‘model_ft’ is not defined