学无先后,达者为师

网站首页 编程语言 正文

【debug】PytorchStreamReader failed reading zip archive: failed finding central directory

作者:cxxx17 更新时间: 2022-04-12 编程语言

libtorch(版本1.7)读取pytorch(版本1.4)中存的tensor时,报错PytorchStreamReader failed reading zip archive: failed finding central directory
save的代码:

torch.save(cur_tensor, "cur_tensor.pt")

尝试了网上的方法:

torch.save(cur_tensor, "cur_tensor.pt", _use_new_zipfile_serialization=False)
# or torch.save(cur_tensor, "cur_tensor.pt", _use_new_zipfile_serialization=True)

还是会报错。
尝试将pytorch版本也换成1.7,并且用

torch.save(cur_tensor, "cur_tensor.pt", _use_new_zipfile_serialization=True)

保存,libtorch可以正常读取了

原文链接:https://blog.csdn.net/weixin_42262721/article/details/121403687

栏目分类
最近更新