tsurumeso / vocal-remover

Vocal Remover using Deep Neural Networks
MIT License
1.47k stars 215 forks source link

[Size mismatch Error] Add support for UVR v5 models #130

Open RuolinZheng08 opened 1 year ago

RuolinZheng08 commented 1 year ago

Hi, is there any plans to add support for UVR v5 models? Currently the model is by default initialized as model = nets.CascadedNet(args.n_fft, 32, 128) and it gives a size mismatch error (attached at the very end of this comment) for UVR v5 models in https://github.com/Anjok07/ultimatevocalremovergui/releases.

Here's UVR's code to determine the model shape: https://github.com/Anjok07/ultimatevocalremovergui/blob/6bf69b2756920b929781439e15d022395d41aeae/separate.py#L666

self.model_run = nets_new.CascadedNet(self.mp.param['bins'] * 2, nn_arch_size, nout=self.model_capacity[0], nout_lstm=self.model_capacity[1])

Error:

param with shape torch.Size([256, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).
        size mismatch for stg3_full_band_net.aspp.conv4.conv.1.weight: copying a param with shape torch.Size([256, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([256]).
        size mismatch for stg3_full_band_net.aspp.conv5.conv.0.weight: copying a param with shape torch.Size([256, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).
        size mismatch for stg3_full_band_net.aspp.conv5.conv.1.weight: copying a param with shape torch.Size([256, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([256]).
spooninc commented 1 year ago

I'd like to know as well. I ran into the same problem attempting to use a UVR model with this project 😊

douglas-isaksson commented 1 year ago

I believe I have similar issue with mdx-net models. Tried to infer using one of the mdx-net models from uvrgui.

uvrcli        | Traceback (most recent call last):
uvrcli        |   File "/app/inference.py", line 184, in <module>
uvrcli        |     main()
uvrcli        |   File "/app/inference.py", line 127, in main
uvrcli        |     model.load_state_dict(torch.load(args.pretrained_model, map_location=device))
uvrcli        |   File "/usr/local/lib/python3.9/site-packages/torch/serialization.py", line 815, in load
uvrcli        |     return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
uvrcli        |   File "/usr/local/lib/python3.9/site-packages/torch/serialization.py", line 1033, in _legacy_load
uvrcli        |     magic_number = pickle_module.load(f, **pickle_load_args)
uvrcli        | _pickle.UnpicklingError: invalid load key, '\x08'. 
starbuck100 commented 11 months ago

Same here. Would appreciate some help.

aufr33 commented 11 months ago

You should install the UVR GUI application.