Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Ensure image runs without dropping into a shell to run the demucs command #38

Open
vigneshsankariyer1234567890 opened this issue Mar 13, 2024 · 3 comments

Comments

@vigneshsankariyer1234567890

At the moment, running the image opens up a shell, in which the user has to input the python command to actually separate the tracks. This makes it fairly annoying when trying to set up a pipeline that can directly split the track based on input.

Check out the screenshot below for reference:

image

However, when I try to mirror the make run command to pass in the python command to run demucs directly, that doesn't really work as it simply exists without executing the command in the first place:

docker run --rm --name=demucs \
    -v /path/to/input:/data/input \
    -v /path/to/output:/data/output \
    -v /path/to/models:/data/models \
    xserrat/facebook-demucs:latest \
    /bin/bash -c "python3 -m demucs -n htdemucs --out /data/output /data/input/01-kaligiyuNTEgadA_galgunu-kIravANi_seg_30.mp3"

It would be nice to build an image that actually does this for us, hiding away the details of executing demucs under the hood with python. I built a wrapper image in my own pipeline that allows me to do this, which we can adapt. In this way, it would be easier for users to simply pass in environment variables as necessary and run the image in a single fell swoop.

docker run --rm --name=demucs \
    -e GPU=false
    -e MP3OUTPUT=true
    -e MODEL=htdemucs
    -v /path/to/input:/data/input \
    -v /path/to/output:/data/output \
    -v /path/to/models:/data/models \ 
    wrapped-demucs \
    01-kaligiyuNTEgadA_galgunu-kIravANi_seg_30.mp3

In this case, wrapped-demucs refers to the wrapper image that I built on top of the existing xserrat/facebook-demucs image.

@vigneshsankariyer1234567890
Copy link
Author

@xserrat Would love to have your thoughts on this!

@lianee
Copy link

lianee commented Apr 2, 2024

However, when I try to mirror the make run command to pass in the python command to run demucs directly, that doesn't really work as it simply exists without executing the command in the first place:

docker run --rm --name=demucs \
    -v /path/to/input:/data/input \
    -v /path/to/output:/data/output \
    -v /path/to/models:/data/models \
    xserrat/facebook-demucs:latest \
    /bin/bash -c "python3 -m demucs -n htdemucs --out /data/output /data/input/01-kaligiyuNTEgadA_galgunu-kIravANi_seg_30.mp3"

After looking at the Makefile, just put the command line without /bin/bash -c:

docker run --rm --name=demucs \
    -v /path/to/input:/data/input \
    -v /path/to/output:/data/output \
    -v /path/to/models:/data/models \
    xserrat/facebook-demucs:latest \
   "python3 -m demucs -n htdemucs --out /data/output /data/input/01-kaligiyuNTEgadA_galgunu-kIravANi_seg_30.mp3"

@chucknelson
Copy link
Contributor

chucknelson commented Nov 9, 2024

Coming in way after the fact, recently came back to this project for splitting some more tracks.

@vigneshsankariyer1234567890 As for a "wrapper" where you could pass env vars for things, I think the one portion that won't work is GPU support, since that needs to be explicitly enabled with the --gpus param as part of docker run, it's not a parameter demucs recognizes.

Currently the Makefile is kind of the wrapper you're talking about to make things easier, but maybe we could also add some more directions/examples in the README around running the Docker image by itself, which would definitely be helpful for people finding the published image on Docker Hub. Maybe this is what issue #20 is for...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants