Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ronsoohyeong opened this issue Oct 7, 2022 · 1 comment

Comments

@ronsoohyeong
Copy link

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",...".

@eeyrw
Copy link

eeyrw commented Oct 10, 2022

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants