
用torch 1.8.1训练保存的模型,用torch 1.1.0进行模型加载。PyTorch的1.6版本将torch.save切换为使用新的基于zipfile的文件格式。 torch.load仍然保留以旧格式加载文件的功能。 如果出于任何原因您希望torch.save使用旧格式,请传递kwarg _use_new_zipfile_serialization = False。
The 1.6 release of PyTorch switched torch.save to use a new zipfile-based file format. torch.load still retains the ability to load files in the old format. If for any reason you want torch.save to use the old format, pass the kwarg _use_new_zipfile_serialization=False.

- 解决方法1
保存模型时,传递kwarg _use_new_zipfile_serialization = False参数,使用旧格式。
torch.save(net.sta

本文介绍如何在PyTorch 1.8.1中加载1.1.0版本保存的模型,涉及使用torch.save的旧格式参数,并提供了解决方案和实例。
最低0.47元/天 解锁文章
4万+

被折叠的 条评论
为什么被折叠?



