facebookresearch / demucs

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

Issues with the program #580

Closed Pocokk closed 9 months ago

Pocokk commented 9 months ago

Hello!

I've managed to set up the program and tried to run it on a 76.5MB large 1.5 hours long single track audio file.

First try resulted in a complete system freeze, had to restart the PC.

Second try was more promising, I moved the file onto a different drive and it went a bit ahead, but got a nasty error message at the end.

  F:\BF4> python -m demucs --device cuda --two-stems vocals --mp3 -o demucs Perfection.mp3
Important: the default model was recently changed to `htdemucs` the latest Hybrid Transformer Demucs model. In some cases, this model can actually perform worse than previous models. To get back the old default model use `-n mdx_extra_q`.
Selected model is a bag of 1 models. You will see that many progress bars per track.
Separated tracks will be stored in F:\BF4\demucs\htdemucs
Separating track Perfection.mp3
100%|██████████████████████████████████████████████████████████████████████| 5031.0/5031.0 [03:24<00:00, 24.57seconds/s]Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Pocok\AppData\Local\Programs\Python\Python311\Lib\site-packages\demucs\__main__.py", line 10, in <module>
    main()
  File "C:\Users\Pocok\AppData\Local\Programs\Python\Python311\Lib\site-packages\demucs\separate.py", line 173, in main
    sources = apply_model(model, wav[None], device=args.device, shifts=args.shifts,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Pocok\AppData\Local\Programs\Python\Python311\Lib\site-packages\demucs\apply.py", line 194, in apply_model
    estimates += out
RuntimeError: [enforce fail at alloc_cpu.cpp:80] data. DefaultCPUAllocator: not enough memory: you tried to allocate 7091970048 bytes.

I have 16 gigabytes of RAM memory + 8 GB VRAM from a GTX 1070 GPU (using the latest torch cuda and nvidia drivers). I literally shut down everything else, so only the program itself was running, I have no idea how it ran out of memory or its a bit more complex issue ?

Honestly I don't know what went wrong, should I just use a lesser model?

Thank you for your help, best regards Pocok

CarlGao4 commented 9 months ago

Demucs will store the whole audio in memory, so it will require huge amount of memory if you separate a very long audio.

Pocokk commented 9 months ago

So first I have to slice up the audio file into different parts and then use Demucs on it to separate it even further?

CarlGao4 commented 9 months ago

Yeah

Pocokk commented 9 months ago

Its an off-topic question, but want to be clear on this before spending a lot of time with it: how accurate can it be with audio dramas that has a lot of FX noises/sounds? So talking about not a clean audio, but a noisy one.

CarlGao4 commented 9 months ago

I didn't test that, so I can't tell its behaviour