-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from BWagener/feature/container-optimizations
optimize container related configuration and documentation
- Loading branch information
Showing
10 changed files
with
162 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
evaluation | ||
.git | ||
|
||
.env | ||
.vscode/ | ||
# virtual environment | ||
venv | ||
.venv | ||
|
||
# python | ||
**__pycache__ | ||
|
||
# test data | ||
test_input | ||
test_output | ||
|
||
# default output folder | ||
output | ||
/UltraSinger*.spec | ||
/registry_path.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
FROM nvidia/cuda:12.5.0-runtime-ubuntu22.04 | ||
FROM nvidia/cuda:12.6.3-runtime-ubuntu22.04 | ||
|
||
WORKDIR /app | ||
RUN apt-get update && apt-get install git python3-pip -y && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
# note: the python3-pip package contains Python 3.10 on Ubuntu 22.04 | ||
RUN apt-get update \ | ||
&& apt-get install git python3-pip python3.10-venv ffmpeg curl -y \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN git clone https://github.com/rakuri255/UltraSinger.git | ||
COPY . /app/UltraSinger | ||
WORKDIR /app/UltraSinger | ||
RUN apt-get update && apt-get install ffmpeg curl -y && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
RUN pip install --no-cache-dir torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121 | ||
RUN pip install --no-cache-dir tensorflow[and-cuda]==2.16.1 | ||
ENV UID=0 | ||
ENV GID=0 | ||
ENV UMASK=022 | ||
|
||
EXPOSE 8088 | ||
# no need to run as root | ||
RUN chown -R 1000:1000 /app/UltraSinger | ||
USER 1000:1000 | ||
|
||
# setup venv | ||
ENV VIRTUAL_ENV=/app/UltraSinger/.venv | ||
RUN python3 -m venv $VIRTUAL_ENV | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
# install dependencies | ||
RUN pip install --no-cache-dir -r requirements.txt \ | ||
&& pip install --no-cache-dir torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121 \ | ||
&& pip install --no-cache-dir tensorflow[and-cuda]==2.16.1 | ||
|
||
WORKDIR /app/UltraSinger/src | ||
CMD ["bash" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Containerized UltraSinger | ||
|
||
## Getting started | ||
|
||
1. There are specific instructions for either Docker or Podman: | ||
1. [Docker](docker.md) | ||
1. [Podman](podman.md) | ||
|
||
## Why run UltraSinger as a container? | ||
|
||
Running UltraSinger in a container bears the following advantages | ||
|
||
- Environment Consistency: Containers ensure that the application runs in the same environment across different machines, reducing the "it works on my machine" problem. | ||
- Isolation: Containers isolate the application from the host system, preventing conflicts with other applications and dependencies. | ||
- Simplified Deployment: Containers package the application and its dependencies together, simplifying the deployment process. | ||
- Security: Containers provide an additional layer of security by isolating applications from the host system and each other. |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Containerized UltraSinger (Docker) | ||
|
||
To run the docker run `git clone https://github.com/rakuri255/UltraSinger.git` | ||
enter the UltraSinger folder. | ||
run this command to build the docker | ||
`docker build -t ultrasinger .` make sure to include the "." at the end | ||
let this run till complete. | ||
then run this command | ||
`docker run --gpus all -it --name UltraSinger -v $pwd/src/output:/app/src/output ultrasinger` | ||
|
||
Docker-Compose | ||
- there are two files that you can pick from. | ||
- cd into the `container` folder | ||
- to download and setup, run either | ||
- `docker-compose -f compose-gpu.yml up` if you have an nvidia gpu to use with UltraSinger | ||
- or`docker-compose -f compose-nogpu.yml up` if you wish to only use the CPU for UltraSinger | ||
|
||
Output | ||
by default the docker-compose will setup the output folder as `/output` inside the docker. | ||
on the host machine it will map to the folder with the `compose<gpu|nogpu>.yml` file under `output` | ||
you may change this by editing the `compose<gpu|nogpu>.yml` | ||
|
||
to edit the file. | ||
use any text editor you wish. i would recoment nano. | ||
run `nano compose<gpu|nogpu>.yml` | ||
then change this line | ||
` - ./output:/app/UltraSinger/src/output` | ||
to anything you line for on your host machine. | ||
` - /yourfolderpathhere:/app/UltraSinger/src/output` | ||
sample | ||
` - /mnt/user/appdata/UltraSinger:/output` | ||
note the blank space before the `-` | ||
formating is important here in this file. | ||
|
||
this will create and drop you into the docker. | ||
now run this command. | ||
`python3 UltraSinger.py -i file` | ||
or | ||
`python3 UltraSinger.py -i youtube_url` | ||
to use mp3's in the folder you git cloned you must place all songs you like in UltraSinger/src/output. | ||
this will be the place for youtube links aswell. | ||
|
||
|
||
to quit the docker just type exit. | ||
|
||
to reenter docker run this command | ||
`docker start UltraSinger && Docker exec -it UltraSinger /bin/bash` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Containerized UltraSinger (Podman) | ||
|
||
1. prerequisites | ||
1. Podman installed (for Windows WSL2 machine provider is recommended) -> [installation instructions](https://podman-desktop.io/docs/installation) | ||
1. (optional) for GPU acceleration Nvidia Container Toolkit installed -> [GPU container access](https://podman-desktop.io/docs/podman/gpu) | ||
1. clone this repository: | ||
```commandline | ||
git clone https://github.com/rakuri255/UltraSinger.git | ||
``` | ||
1. build the container image | ||
```commandline | ||
podman build -t ultrasinger . | ||
``` | ||
1. run the container (note that the first time you run the container models will be downloaded which may take a while) | ||
1. PowerShell: | ||
```powershell | ||
# remember to replace <desired-output-folder> below | ||
podman run ` | ||
--rm -it --name ultrasinger ` | ||
--device nvidia.com/gpu=all ` | ||
-v $env:USERPROFILE\.cache:/app/UltraSinger/src/.cache ` | ||
-v <desired-output-folder>:/app/UltraSinger/src/output ` | ||
ultrasinger ` | ||
python3 UltraSinger.py -i <refer to top-level README.md> | ||
# explanation: | ||
podman run ` | ||
--rm -it --name ultrasinger ` # remove container after run, interactive mode, name the container | ||
--device nvidia.com/gpu=all ` # optional, enables GPU acceleration if available, requires step 1.ii | ||
-v $env:USERPROFILE\.cache:/app/UltraSinger/src/.cache ` # cache directory for models | ||
-v <desired-output-folder>:/app/UltraSinger/src/output ` # output directory | ||
ultrasinger ` # container image name, we built this in step 3 | ||
python3 UltraSinger.py -i <refer to top-level README.md> # run UltraSinger, refer to top-level README.md for all options | ||
``` | ||
1. Bash: | ||
```bash | ||
# remember to replace <desired-output-folder> below | ||
podman run \ | ||
--rm -it --name ultrasinger \ | ||
--device nvidia.com/gpu=all \ | ||
-v $HOME/.cache:/app/UltraSinger/src/.cache \ | ||
-v <desired-output-folder>:/app/UltraSinger/src/output \ | ||
ultrasinger \ | ||
python3 UltraSinger.py -i <refer to top-level README.md> | ||
1. to use cookies for YouTube downloads, you can mount your cookies.txt file into the container: | ||
```powershell | ||
podman run ` | ||
... ` # same as above | ||
-v <path-to-cookies.txt>:/app/UltraSinger/src/cookies.txt ` | ||
ultrasinger ` | ||
python3 UltraSinger.py --cookiefile cookies.txt -i <refer to top-level README.md> | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.