其他分享
首页 > 其他分享> > 【debug】PytorchStreamReader failed reading zip archive: failed finding central directory

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

作者:互联网

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可以正常读取了

标签:PytorchStreamReader,central,tensor,pt,torch,failed,save,cur
来源: https://blog.csdn.net/weixin_42262721/article/details/121403687