facebookresearch / demucs

Code for the paper Hybrid Spectrogram and Waveform Source Separation
MIT License
8.26k stars 1.05k forks source link

Google Colab error #82

Open milancelanmi opened 4 years ago

milancelanmi commented 4 years ago

Cpu separation in colab working as expected. Error log for gpu: Separating track /content/drive/testfile.flac 0%| | 0/210 [00:00<?, ?seconds/s]Traceback (most recent call last): File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/content/demucs/demucs/separate.py", line 166, in main() File "/content/demucs/demucs/separate.py", line 155, in main sources = apply_model(model, wav, shifts=args.shifts, split=args.split, progress=True) File "/content/demucs/demucs/utils.py", line 119, in apply_model chunk_out = apply_model(model, chunk, shifts=shifts) File "/content/demucs/demucs/utils.py", line 140, in apply_model out = model(padded.unsqueeze(0))[0] File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(*input, kwargs) File "/content/demucs/demucs/model.py", line 198, in forward x = encode(x) File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(*input, *kwargs) File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward input = module(input) File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(input, kwargs) File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 202, in forward self.padding, self.dilation, self.groups) RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same 0%| | 0/210 [00:00<?, ?seconds/s] Googled and seems to cuda model needs to be called before, but I am new to python language and don t know how to fix this error? Please help. Thank you.

iamnoob1 commented 4 years ago

Same :/

adefossez commented 4 years ago

you need to call model.to('cuda') before passing it to apply_model.

iamnoob1 commented 4 years ago

How?

iamnoob1 commented 4 years ago

Please tutorial

iamnoob1 commented 4 years ago

I can't use Demucs

adefossez commented 4 years ago

okay sorry about that, if you update from master it should work now :)

marlluslustosa commented 4 years ago

I created a collab for this project using GPU. I tested it with "-n demucs" and "-n tasnet" and it worked very well.

The link to the collab is here: https://github.com/marlluslustosa/demucs/blob/master/Lulu_Demucs.ipynb

@adefossez, feel free to add it to the README if you want. I loved your project and would like more people to use it. Google collaboratory is a great and free tool.