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

上一篇:数据库查询出来的时间总是比存的时间多8个小时


下一篇:Command "python setup.py egg_info" failed with error code 1