问题:
在运行项目时,出现RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory的问题
Traceback (most recent call last):
File "F:\Project\GFPGAN-master\GFPGAN-master\inference_gfpgan.py", line 174, in <module>
main()
File "F:\Project\GFPGAN-master\GFPGAN-master\inference_gfpgan.py", line 70, in main
bg_upsampler = RealESRGANer(
File "D:\anaconda3\envs\SR\lib\site-packages\realesrgan\utils.py", line 63, in __init__
loadnet = torch.load(model_path, map_location=torch.device('cpu'))
File "D:\anaconda3\envs\SR\lib\site-packages\torch\serialization.py", line 705, in load
with _open_zipfile_reader(opened_file) as opened_zipfile:
File "D:\anaconda3\envs\SR\lib\site-packages\torch\serialization.py", line 242, in __init__
super(_open_zipfile_reader, self).__init__(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
原因:
模型下载因为网络问题没有下载成功,再次加载模型代码的时候报错。删除掉的模型,还存在缓存中,加载时加载了缓存中未下载成功的模型
解决办法:
去浏览器中重新下载模型,将模型路径换为本地路径
完美解决!!!!