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

Invalid load key error when running models_server.py #35

Closed
panicbuttonvfx opened this issue Apr 5, 2023 · 5 comments
Closed

Invalid load key error when running models_server.py #35

panicbuttonvfx opened this issue Apr 5, 2023 · 5 comments

Comments

@panicbuttonvfx
Copy link

When running:

python models_server.py --config config.yaml

I get the following error:

Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/envs/jarvis/lib/python3.8/site-packages/transformers/modeling_utils.py", line 415, in load_state_dict
    return torch.load(checkpoint_file, map_location="cpu")
  File "/home/ubuntu/miniconda3/envs/jarvis/lib/python3.8/site-packages/torch/serialization.py", line 795, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/home/ubuntu/miniconda3/envs/jarvis/lib/python3.8/site-packages/torch/serialization.py", line 1002, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'.
@ErikDombi
Copy link
Contributor

Is there any more to the traceback? I had a similar issue come up, but it was a far longer error.

@panicbuttonvfx
Copy link
Author

There is, here's the full traceback. git-lfs is installed, initialized and updated:


Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/envs/jarvis/lib/python3.8/site-packages/transformers/modeling_utils.py", line 415, in load_state_dict
    return torch.load(checkpoint_file, map_location="cpu")
  File "/home/ubuntu/miniconda3/envs/jarvis/lib/python3.8/site-packages/torch/serialization.py", line 795, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/home/ubuntu/miniconda3/envs/jarvis/lib/python3.8/site-packages/torch/serialization.py", line 1002, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "models_server.py", line 342, in <module>
    pipes = load_pipes(local_deployment)
  File "models_server.py", line 87, in load_pipes
    "model": VisionEncoderDecoderModel.from_pretrained(f"{local_fold}/nlpconnect/vit-gpt2-image-captioning"),
  File "/home/ubuntu/miniconda3/envs/jarvis/lib/python3.8/site-packages/transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py", line 363, in from_pretrained
    return super().from_pretrained(pretrained_model_name_or_path, *model_args, **kwargs)
  File "/home/ubuntu/miniconda3/envs/jarvis/lib/python3.8/site-packages/transformers/modeling_utils.py", line 2477, in from_pretrained
    state_dict = load_state_dict(resolved_archive_file)
  File "/home/ubuntu/miniconda3/envs/jarvis/lib/python3.8/site-packages/transformers/modeling_utils.py", line 420, in load_state_dict
    raise OSError(
OSError: You seem to have cloned a repository without having git-lfs installed. Please install git-lfs and run `git lfs install` followed by `git lfs pull` in the folder you cloned.

@ErikDombi
Copy link
Contributor

If you installed git-lfs AFTER downloading the models, then you will need to rerun the download.sh script inside jarvis/server/models/

@panicbuttonvfx
Copy link
Author

Thanks, that seems to be what was happening. Download hasn't completed yet though (it keeps getting stuck at some point), so I haven't been able to check if it works. I'll close this issue once I'm able to test it out.

@panicbuttonvfx
Copy link
Author

I'm closing this issue, solved after re-download the models.

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