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

Error loading model from pypi install #136

Open
jerpint opened this issue Dec 20, 2023 · 2 comments
Open

Error loading model from pypi install #136

jerpint opened this issue Dec 20, 2023 · 2 comments

Comments

@jerpint
Copy link

jerpint commented Dec 20, 2023

when using pip install laion-clap and loading the model:

import laion_clap

model = laion_clap.CLAP_Module(enable_fusion=False)
model.load_ckpt() # downloads the default pretrained checkpoint.

I get the following error:

Load Checkpoint...
Traceback (most recent call last):
  File "/Users/jeremypinto/cse/zero_shot_eval.py", line 33, in <module>
    model.load_ckpt() # downloads the default pretrained checkpoint.
    ^^^^^^^^^^^^^^^^^
  File "/Users/jeremypinto/opt/miniconda3/envs/cse/lib/python3.11/site-packages/laion_clap/hook.py", line 114, in load_ckpt
    self.model.load_state_dict(ckpt)
  File "/Users/jeremypinto/opt/miniconda3/envs/cse/lib/python3.11/site-packages/torch/nn/modules/module.py", line 2152, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for CLAP:
        Unexpected key(s) in state_dict: "text_branch.embeddings.position_ids".

However, if I clone the repository and install it locally using pip install -e ., I do not get this error and model weights load correctly.

@jerpint
Copy link
Author

jerpint commented Dec 20, 2023

possibly related to #118 ?

@lukewys
Copy link
Contributor

lukewys commented Mar 31, 2024

Thanks for the reminder. Please refer to #118 for updates

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