You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am using the phasefinder package and while fetching model weights, I am getting an error that state_dict is missing a key, leaving me with an issue.
I tried removing the weights_only=True argument and got the same error.
Hi, I am using the phasefinder package and while fetching model weights, I am getting an error that state_dict is missing a key, leaving me with an issue.
I tried removing the weights_only=True argument and got the same error.
Environment
OS: Ubuntu 20.04
Python: 3.10.0
dependencies
phasefinder=0.0.3
torch=2.5.0
torchaudio=2.6.0
Code
Log
Model weights already exist.
RuntimeError Traceback (most recent call last)
Cell In[8], line 3
1 from phasefinder import Phasefinder
----> 3 pf = Phasefinder()
5 # audio_path = "../utils/test.mp3"
6
7 # beat_times, bpm = pf.predict(audio_path, include_bpm=True)
8
9 # print(beat_times, bpm)
File /home/oem/anaconda3/envs/oncon/lib/python3.10/site-packages/phasefinder/predictor.py:33, in Phasefinder.init(self, modelname, device, quiet, attention)
31 else:
32 self.device = torch.device(device)
---> 33 self.load_model()
File /home/oem/anaconda3/envs/oncon/lib/python3.10/site-packages/phasefinder/predictor.py:41, in Phasefinder.load_model(self)
38 else:
39 self.model = PhasefinderModelNoattn()
---> 41 self.model.load_state_dict(torch.load(self.model_path, map_location=torch.device(self.device), weights_only=True))
42 self.model = self.model.to(self.device)
43 self.model.eval()
File /home/oem/anaconda3/envs/oncon/lib/python3.10/site-packages/torch/nn/modules/module.py:2584, in Module.load_state_dict(self, state_dict, strict, assign)
2576 error_msgs.insert(
2577 0,
2578 "Missing key(s) in state_dict: {}. ".format(
2579 ", ".join(f'"{k}"' for k in missing_keys)
2580 ),
2581 )
2583 if len(error_msgs) > 0:
-> 2584 raise RuntimeError(
2585 "Error(s) in loading state_dict for {}:\n\t{}".format(
2586 self.class.name, "\n\t".join(error_msgs)
2587 )
2588 )
2589 return _IncompatibleKeys(missing_keys, unexpected_keys)
RuntimeError: Error(s) in loading state_dict for PhasefinderModelNoattn:
Missing key(s) in state_dict: "tcn_beat.network.0.conv1.buffer", "tcn_beat.network.0.conv2.buffer", "tcn_beat.network.1.conv1.buffer", "tcn_beat.network.1.conv2.buffer", "tcn_beat.network.2.conv1.buffer", "tcn_beat.network.2.conv2.buffer", "tcn_beat.network.3.conv1.buffer", "tcn_beat.network.3.conv2.buffer", "tcn_beat.network.4.conv1.buffer", "tcn_beat.network.4.conv2.buffer", "tcn_beat.network.5.conv1.buffer", "tcn_beat.network.5.conv2.buffer", "tcn_beat.network.6.conv1.buffer", "tcn_beat.network.6.conv2.buffer", "tcn_beat.network.7.conv1.buffer", "tcn_beat.network.7.conv2.buffer", "tcn_beat.network.8.conv1.buffer", "tcn_beat.network.8.conv2.buffer", "tcn_beat.network.9.conv1.buffer", "tcn_beat.network.9.conv2.buffer", "tcn_beat.network.10.conv1.buffer", "tcn_beat.network.10.conv2.buffer", "tcn_beat.network.11.conv1.buffer", "tcn_beat.network.11.conv2.buffer", "tcn_beat.network.12.conv1.buffer", "tcn_beat.network.12.conv2.buffer", "tcn_beat.network.13.conv1.buffer", "tcn_beat.network.13.conv2.buffer", "tcn_beat.network.14.conv1.buffer", "tcn_beat.network.14.conv2.buffer", "tcn_beat.network.15.conv1.buffer", "tcn_beat.network.15.conv2.buffer".
The text was updated successfully, but these errors were encountered: