当前位置:网站首页>torch在高版本训练的模型在低版本中使用报错

torch在高版本训练的模型在低版本中使用报错

2022-06-12 06:20:00 嗯呢嗯呢

pttempted to read a PyTorch file with version 3, but the maximum supported version for reading is 2.

解决:

首先用高版本的torch读入后重新保存。

model = torch.load('model_name.pt')

torch.save(model, 'save_path', _use_new_zipfile_serialization=False)

然后在低版本中读取。

torch.load('model path', map_location='cpu')

原网站

版权声明
本文为[嗯呢嗯呢]所创,转载请带上原文链接,感谢
https://blog.csdn.net/ZZhangYajuan/article/details/125059067