axeldelafosse / stemgen

🎛 Stemgen is a Stem file generator. Convert any track into a Stem and have fun with Traktor.
https://stemgen.dev
MIT License
207 stars 39 forks source link

GPU Support? #8

Closed 0vm closed 1 year ago

0vm commented 1 year ago

Since Demucs has GPU Support, Do you plan on adding it to this tool? Do you already have a way and just undocumented?

awesomer commented 1 year ago

Demucs uses the GPU by default if it's available. I would expect the stemgen wrapping of Demucs to Just Work if run in an environment (like WSL2 with GPU passthrough) with GPU available.

0vm commented 1 year ago

hm thats odd, I already have it running in WSL2 with the Nvidia drivers installed with no luck, I'll try figuring it out, thank you.

axeldelafosse commented 1 year ago

Hey guys! stemgen defaults to CPU instead of GPU. To use the GPU acceleration, you can search and remove -d cpu in the script.

awesomer commented 1 year ago

But as I understand it, demucs falls back to GPU automatically... why would one deliberately want to default to CPU if the GPU is available?

On Mon, Dec 19, 2022 at 6:10 AM Axel Delafosse @.***> wrote:

Hey guys! stemgen defaults to CPU instead of GPU. To use the GPU acceleration, you can search and remove -d cpu in the script.

— Reply to this email directly, view it on GitHub https://github.com/axeldelafosse/stemgen/issues/8#issuecomment-1357730018, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADRNXFFTCATPLKX4O25LEDWOBUFDANCNFSM6AAAAAAS7WIYUM . You are receiving this because you commented.Message ID: @.***>

axeldelafosse commented 1 year ago

To be honest, it's mostly a selfish decision because I don't have a Nvidia GPU so I chose to default to CPU. If you have a GPU you should use it! Except if you have low memory I guess, but you should try.

I haven't got any request about this so far but I'm obviously happy to default to GPU instead (and maybe let the underlying software fallback to CPU or introduce a flag to force CPU).

I was using Spleeter with the CPU package when I first created this script. It was a separate package for the GPU so this was the only option available. Now it seems to be unified but I unfortunately don't have an Nvidia GPU so I can't really test the GPU acceleration. Also I'd love to try to make Spleeter and/or Demucs work with Mac GPUs, maybe it could work with Tensorflow Metal?

Meta: I don't have any information about current users' needs. Please send me an email if you want to chat more about the future of Stemgen!