mmagic icon indicating copy to clipboard operation
mmagic copied to clipboard

RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

Open cjj490168650 opened this issue 2 years ago • 6 comments

Runtime Error while inferencing with trained models. Command in Windows cmd:

python tools/test.py ^
configs/restorers/basicvsr_plusplus/basicvsr_plusplus_360.py ^
work_dirs/formal_basicvsr_plusplus_360new_cb/iter_90000.pth ^
--save-path result/basicvsr_plusplus_cb

Error message:

load checkpoint from local path: work_dirs/formal_basicvsr_plusplus_360new_cb/iter_90000.pth
Traceback (most recent call last):
  File "tools/test.py", line 142, in <module>
    main()
  File "tools/test.py", line 99, in main
    _ = load_checkpoint(model, args.checkpoint, map_location='cpu')
  File "D:\Anaconda3\envs\pytorch\lib\site-packages\mmcv\runner\checkpoint.py", line 581, in load_checkpoint
  File "D:\Anaconda3\envs\pytorch\lib\site-packages\mmcv\runner\checkpoint.py", line 302, in load_from_local
    checkpoint = torch.load(filename, map_location=map_location)
  File "D:\Anaconda3\envs\pytorch\lib\site-packages\torch\serialization.py", line 600, in load
    with _open_zipfile_reader(opened_file) as opened_zipfile:
  File "D:\Anaconda3\envs\pytorch\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

cjj490168650 avatar May 03 '22 08:05 cjj490168650

tried on Google Colab and still meet the same problem

cjj490168650 avatar May 07 '22 05:05 cjj490168650

Seems some defects with your pth file. Would you please try replacing iter_90000.pth with other checkpoints?

wangruohui avatar May 07 '22 06:05 wangruohui

Seems some defects with your pth file. Would you please try replacing iter_90000.pth with other checkpoints?

tried but still have the same problem

cjj490168650 avatar May 07 '22 06:05 cjj490168650

For example, replacing the checkpoint with the one downloaded from our readme page, cause the same error?

wangruohui avatar May 07 '22 06:05 wangruohui

For example, replacing the checkpoint with the one downloaded from our readme page, cause the same error?

the checkpoint downloaded from readme page has no problem, but the checkpoints from my training all have the same problem

cjj490168650 avatar May 07 '22 06:05 cjj490168650

@cjj490168650 did you manage to fix the issue?

godwinrayanc avatar Jun 27 '22 00:06 godwinrayanc

Please check this issue. @LeoXing1996

zengyh1900 avatar Oct 09 '22 11:10 zengyh1900

Hey @cjj490168650, seems that your model is not saved correctly. Can you provide a minimum script demonstrating the error?

LeoXing1996 avatar Oct 11 '22 11:10 LeoXing1996

Closing due to inactivity, please reopen if there are any further problems.

zengyh1900 avatar Oct 25 '22 07:10 zengyh1900