Skip to content

RuntimeError: pretrained_model is a zip archive (did you mean to use torch.jit.load()?) #3

Description

@ronsoohyeong

Thanks for sharing wonderful work.
However, there are errors in testing with the provided pretrained_model in both pre-1.6 and post-1.6 pytorch.

In torch 1.3.1, the error is

$ python test_image.py --root_path imgs --img_name test_img.jpg --resize --p 1 --q 2
        
    Traceback (most recent call last):
      File "/home/ron_lee/miniconda3/envs/torch1.3.1-py36-cuda9.0-tf1.14/lib/python3.6/tarfile.py", line 189, in nti
        n = int(s.strip() or "0", 8)
    ValueError: invalid literal for int() with base 8: 'ils\n_reb'


    Traceback (most recent call last):
      File "test_image.py", line 154, in <module>
        run(args)
      File "test_image.py", line 16, in run
        checkpoint = torch.load(args.trained_model_file)
      File "/home/ron_lee/miniconda3/envs/torch1.3.1-py36-cuda9.0-tf1.14/lib/python3.6/site-packages/torch/serialization.py", line 426, in load
        return _load(f, map_location, pickle_module, **pickle_load_args)
      File "/home/ron_lee/miniconda3/envs/torch1.3.1-py36-cuda9.0-tf1.14/lib/python3.6/site-packages/torch/serialization.py", line 599, in _load
        raise RuntimeError("{} is a zip archive (did you mean to use torch.jit.load()?)".format(f.name))
    RuntimeError: ./checkpoints/pretrained_model is a zip archive (did you mean to use torch.jit.load()?)

This error happens when using checkpoint trained with 1.6 or later, yet trying to test with earlier than 1.6 of pytorch.

On the other hand, using pytorch 1.8 leads to "Missing key(s) in state_dict: "sidenet_q.head0.0.weight",...".

Activity

  1. eeyrw commented on Oct 10, 2022

    @eeyrw

    I meet same error when loading pretrained weights: #4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions