JusperLee / Dual-Path-RNN-Pytorch

Dual-path RNN: efficient long sequence modeling for time-domain single-channel speech separation implemented by Pytorch
Apache License 2.0
417 stars 65 forks source link

RuntimeError: Error(s) in loading state_dict for Conv_TasNet: Missing key(s) in state_dict: "separation.conv1d_list.0.0.conv1x1.weight", #18

Closed Yunlong-He closed 4 years ago

Yunlong-He commented 4 years ago

When I run inference with provided model, I got following error, is there anything wrong in the model?

root:/lab/Dual-Path-RNN-Pytorch# python3 test_tasnet.py -mix_scp=sample/test.scp -save_path=sample/result
Traceback (most recent call last): File "test_tasnet.py", line 81, in main() File "test_tasnet.py", line 76, in main separation=Separation(args.mix_scp, args.yaml, args.model, gpuid) File "test_tasnet.py", line 20, in init net.load_state_dict(dicts["model_state_dict"]) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 1045, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for Conv_TasNet: Missing key(s) in state_dict: "separation.conv1d_list.0.0.conv1x1.weight", "separation.conv1d_list.0.0.conv1x1.bias", "separation.conv1d_list.0.0.PReLu1.weight", "separation.conv1d_list.0.0.norm1.weight", "separation.conv1d_list.0.0.norm1.bias", "separation.conv1d_list.0.0.dwconv.weight", "separation.conv1d_list.0.0.dwconv.bias", "separation.conv1d_list.0.0.PReLu2.weight", "separation.conv1d_list.0.0.norm2.weight", "separation.conv1d_list.0.0.norm2.bias", "separation.conv1d_list.0.0.end_conv1x1.weight", "separation.conv1d_list.0.0.end_conv1x1.bias", "separation.conv1d_list.0.1.conv1x1.weight", "separation.conv1d_list.0.1.conv1x1.bias", "separation.conv1d_list.0.1.PReLu1.weight", "separation.conv1d_list.0.1.norm1.weight", "separation.conv1d_list.0.1.norm1.bias", "separation.conv1d_list.0.1.dwconv.weight", "separation.conv1d_list.0.1.dwconv.bias", "separation.conv1d_list.0.1.PReLu2.weight", "separation.conv1d_list.0.1.norm2.weight", "separation.conv1d_list.0.1.norm2.bias", "separation.conv1d_list.0.1.end_conv1x1.weight", "separation.conv1d_list.

JusperLee commented 4 years ago

Are you using Conv-TasNet's pre-trained model?

Yunlong-He commented 4 years ago

Yes, I downloaded the model from link of the repo: root@neufoundry-test-gpu-host14:/lab/github/speech/Dual-Path-RNN-Pytorch# ls ./checkpoint/Conv_Tasnet_skip/best.pt -l -rw-r--r-- 1 root root 60796676 Aug 21 09:48 ./checkpoint/Conv_Tasnet_skip/best.pt

JusperLee commented 4 years ago

If you want to use the Conv-TasNet model, I recommend you to use this repository: https://github.com/JusperLee/Conv-TasNet

JusperLee commented 4 years ago

Maybe the model file stored in my repository does not match model.py, causing the error.

Yunlong-He commented 4 years ago

I tried https://github.com/JusperLee/Conv-TasNet, but got same error, I searched in google, someone said that error may be related to nn.DataParallel, but I don't see such code in your training file, so there may be other reasons.

could you help to confirm whether you generated the best.pt by yourself? and what pytorch version are you using? Thanks

JusperLee commented 4 years ago

Your error is that the structure of the saved model is different from the structure of model.py.

Yunlong-He commented 4 years ago

Thanks, I just found another model file which is usable, though it is from another project, but I think the root cause is just as JusperLee said, thanks to JusperLee,👍