解决方法
in 1.7:
weight = torch.load("/last.pt", map_location=torch.device('cpu'))['model']
model.load_state_dict(weight.state_dict())
torch.save(model.state_dict(), 'model_best_bacc.pth.tar', _use_new_zipfile_serialization=False)
then in 1.4:
model.load_state_dict(torch.load('model_best_bacc.pth.tar',map_location='cpu'))
torch.save(model.state_dict(), "./parameter_state_dict_1.4.pth")
原文链接:https://blog.csdn.net/qxqxqzzz/article/details/110955978