Error loading model from pypi install
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 213
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with laion_clap/hook.py at load_ckpt, then compare the installed PyPI package with the editable checkout and inspect the checkpoint-loading error involving text_branch.embeddings.position_ids. Reproduce both installation paths and identify the package or dependency difference; done means the PyPI installation loads the default checkpoint successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100