axeldelafosse/stemgen

[Feature Request] GPU acceleration

axeldelafosse opened this issue · 8 comments

Following this discussion: #8 (comment) -- I think Stemgen should:

  • Default to GPU
  • Provide a flag to force CPU
  • Explain how to get Spleeter and/or Demucs to work with Mac GPUs
0vm commented

Don't default to GPU as many people will be running this on dockers, VM's, etc. These don't have GPUs and if anyone wants to switch to GPU, include something in the README such as removing the CPU Flag.

0vm commented

There are cases where GPU acceleration has worse performance than CPU?

There are cases where GPU acceleration has worse performance than CPU?

I think that some gpu/cpu combinations could be slower with cuda - but it should be the exception

Using gpu is around 15 times faster with my mobile 3070 instead of my 10th gen 16 thread I7.

I will also test this with a 11th gen i5/ mobile 1650 gpu combo

Update:
According to userbenchmarks a 10 year old gtx 660 is a 5th as fast (or rather slow) as the 3070 mobile - so even that card should be much faster then running on cpu

Yeah! I'm gonna work on this soon!

It's quite easy to use GPU with stemgen:

  1. Follow the GPU step of DEMUCS setup:
    If you are using Windows: Windows support.
    If you are using MAC OS X: Mac OS X support.
    If you are using Linux: Linux support.

  2. replace all occurence of
    "-d", "cpu",
    for
    "-d", "cuda",

in stemgen.py

Hey! I took some time to write proper docs and add support for GPU without touching the code: https://stemgen.dev/docs/gpu-acceleration-on-windows.

Note that it is only working on Windows if you have a NVIDIA GPU.