Keypoint_Communities icon indicating copy to clipboard operation
Keypoint_Communities copied to clipboard

PytorchStreamReader failed reading zip archive: failed finding central directory

Open sulei1998 opened this issue 3 years ago • 2 comments

When i run the demo, i meet the error like this:

INFO:__main__:neural network device: cuda (CUDA available: True, count: 2)
Traceback (most recent call last):
  File "/root/miniconda3/envs/key_com/lib/python3.8/runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/root/miniconda3/envs/key_com/lib/python3.8/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/miniconda3/envs/key_com/lib/python3.8/site-packages/openpifpaf/predict.py", line 128, in <module>
    main()
  File "/root/miniconda3/envs/key_com/lib/python3.8/site-packages/openpifpaf/predict.py", line 103, in main
    predictor = Predictor(
  File "/root/miniconda3/envs/key_com/lib/python3.8/site-packages/openpifpaf/predictor.py", line 29, in __init__
    self.model_cpu, _ = network.Factory().factory(head_metas=head_metas)
  File "/root/miniconda3/envs/key_com/lib/python3.8/site-packages/openpifpaf/network/factory.py", line 302, in factory
    net_cpu, epoch = self.from_checkpoint()
  File "/root/miniconda3/envs/key_com/lib/python3.8/site-packages/openpifpaf/network/factory.py", line 366, in from_checkpoint
    checkpoint = torch.hub.load_state_dict_from_url(
  File "/root/miniconda3/envs/key_com/lib/python3.8/site-packages/torch/hub.py", line 590, in load_state_dict_from_url
    return torch.load(cached_file, map_location=map_location)
  File "/root/miniconda3/envs/key_com/lib/python3.8/site-packages/torch/serialization.py", line 600, in load
    with _open_zipfile_reader(opened_file) as opened_zipfile:
  File "/root/miniconda3/envs/key_com/lib/python3.8/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

My torch version is 1.10.0.

sulei1998 avatar Nov 18 '21 06:11 sulei1998

Hi @sulei1998, I meet the same error as you when using python 3.8 and pytorch 1.10 on Ubuntu 20.04, and it is also not clear to me why the loading of the checkpoint fails. However, when using python 3.9 and pytorch 1.10 the error does not occur. Could you try with python 3.9 and pytorch 1.10? If the problem persists, could you provide your OS and the exact command that you are running, so that I can try to reproduce your error?

DuncanZauss avatar Nov 23 '21 11:11 DuncanZauss

Thank you for your help! But when i try with python 3.9 and pytorch 1.10, i meet the same error. image

By the way, I test it on ubuntu18.04. As you can see, the command is python -m openpifpaf.predict docs/soccer.jpeg --checkpoint=shufflenetv2k30-wholebody --line-width=2 --show .

sulei1998 avatar Nov 23 '21 13:11 sulei1998