microsoft / CLAP

Learning audio concepts from natural language supervision
MIT License
486 stars 38 forks source link

Problem loading state_dict #27

Closed jesse-lane-ai closed 1 year ago

jesse-lane-ai commented 1 year ago

Any one have some insight into this error: raceback (most recent call last): File "C:\Users\rokam\Documents\Dev\msclap-test\test.py", line 8, in clap_model = CLAP(weights_path, version = 'clapcap', use_cuda=False) File "C:\Users\rokam\Documents\Dev\msclap-test\msclaptest\lib\site-packages\msclap\CLAPWrapper.py", line 59, in init self.clapcap, self.tokenizer, self.args = self.load_clapcap() File "C:\Users\rokam\Documents\Dev\msclap-test\msclaptest\lib\site-packages\msclap\CLAPWrapper.py", line 161, in load_clapcap clapcap.load_state_dict(model_state_dict) File "C:\Users\rokam\Documents\Dev\msclap-test\msclaptest\lib\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 ClapCaptionModel: Unexpected key(s) in state_dict: "gpt.transformer.h.0.attn.bias", "gpt.transformer.h.0.attn.masked_bias", "gpt.transformer.h.1.attn.bias", "gpt.transformer.h.1.attn.masked_bias", "gpt.transformer.h.2.attn.bias", "gpt.transformer.h.2.attn.masked_bias", "gpt.transformer.h.3.attn.bias", "gpt.transformer.h.3.attn.masked_bias", "gpt.transformer.h.4.attn.bias", "gpt.transformer.h.4.attn.masked_bias", "gpt.transformer.h.5.attn.bias", "gpt.transformer.h.5.attn.masked_bias", "gpt.transformer.h.6.attn.bias", "gpt.transformer.h.6.attn.masked_bias", "gpt.transformer.h.7.attn.bias", "gpt.transformer.h.7.attn.masked_bias", "gpt.transformer.h.8.attn.bias", "gpt.transformer.h.8.attn.masked_bias", "gpt.transformer.h.9.attn.bias", "gpt.transformer.h.9.attn.masked_bias", "gpt.transformer.h.10.attn.bias", "gpt.transformer.h.10.attn.masked_bias", "gpt.transformer.h.11.attn.bias", "gpt.transformer.h.11.attn.masked_bias".

bmartin1 commented 1 year ago

Hi @RokaMic,

Thanks for pointing that out, the pypi repo is not up to date so pip install msclap will throw this error. I'll fix it soon. In the meantime, use the second option "pip install git+https://github.com/microsoft/CLAP"

bmartin1 commented 1 year ago

FYI, the pypi repo is fixed. If you pip install msclap again, you shouldn't see the error anymore.