Skip to content

Error loading model from pypi install #136

Description

@jerpint

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions