forked from camenduru/ai-voice-cloning
Merge pull request 'Make convenient to use with Docker' (#191) from psr/ai-voice-cloning:docker into master
Reviewed-on: mrq/ai-voice-cloning#191
This commit is contained in:
commit
b785192dfc
4
.dockerignore
Normal file
4
.dockerignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
/models
|
||||
/training
|
||||
/voices
|
||||
/bin
|
37
Dockerfile
Normal file
37
Dockerfile
Normal file
|
@ -0,0 +1,37 @@
|
|||
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG TZ=UTC
|
||||
ARG MINICONDA_VERSION=23.1.0-1
|
||||
ARG PYTHON_VERSION=3.9.13
|
||||
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
RUN apt-get update
|
||||
RUN apt install -y curl wget git ffmpeg
|
||||
RUN adduser --disabled-password --gecos '' --shell /bin/bash user
|
||||
USER user
|
||||
ENV HOME=/home/user
|
||||
WORKDIR $HOME
|
||||
RUN mkdir $HOME/.cache $HOME/.config && chmod -R 777 $HOME
|
||||
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py39_$MINICONDA_VERSION-Linux-x86_64.sh
|
||||
RUN chmod +x Miniconda3-py39_$MINICONDA_VERSION-Linux-x86_64.sh
|
||||
RUN ./Miniconda3-py39_$MINICONDA_VERSION-Linux-x86_64.sh -b -p /home/user/miniconda
|
||||
ENV PATH="$HOME/miniconda/bin:$PATH"
|
||||
RUN conda init
|
||||
RUN conda install python=$PYTHON_VERSION
|
||||
RUN python3 -m pip install --upgrade pip
|
||||
RUN pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118
|
||||
|
||||
RUN mkdir $HOME/ai-voice-cloning
|
||||
WORKDIR $HOME/ai-voice-cloning
|
||||
COPY --chown=user:user modules modules
|
||||
|
||||
RUN python3 -m pip install -r ./modules/tortoise-tts/requirements.txt
|
||||
RUN python3 -m pip install -e ./modules/tortoise-tts/
|
||||
RUN python3 -m pip install -r ./modules/dlas/requirements.txt
|
||||
RUN python3 -m pip install -e ./modules/dlas/
|
||||
ADD requirements.txt requirements.txt
|
||||
RUN python3 -m pip install -r ./requirements.txt
|
||||
ADD --chown=user:user . $HOME/ai-voice-cloning
|
||||
|
||||
CMD ["python", "./src/main.py", "--listen", "0.0.0.0:7680"]
|
4
setup-docker.sh
Executable file
4
setup-docker.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
git submodule init
|
||||
git submodule update --remote
|
||||
docker build -t ai-voice-cloning .
|
14
start-docker.sh
Executable file
14
start-docker.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
CMD="python3 ./src/main.py $@"
|
||||
# CMD="bash"
|
||||
CPATH="/home/user/ai-voice-cloning"
|
||||
docker run --rm --gpus all \
|
||||
--mount "type=bind,src=$PWD/models,dst=$CPATH/models" \
|
||||
--mount "type=bind,src=$PWD/training,dst=$CPATH/training" \
|
||||
--mount "type=bind,src=$PWD/voices,dst=$CPATH/voices" \
|
||||
--mount "type=bind,src=$PWD/bin,dst=$CPATH/bin" \
|
||||
--workdir $CPATH \
|
||||
--user "$(id -u):$(id -g)" \
|
||||
--net host \
|
||||
-it ai-voice-cloning $CMD
|
||||
|
15
train-docker.sh
Executable file
15
train-docker.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
CMD="python3 ./src/train.py --yaml $1"
|
||||
# ipc host is one way to increase the shared memory for the container
|
||||
# more info here https://github.com/pytorch/pytorch#docker-image
|
||||
CPATH="/home/user/ai-voice-cloning"
|
||||
docker run --rm --gpus all \
|
||||
--mount "type=bind,src=$PWD/models,dst=$CPATH/models" \
|
||||
--mount "type=bind,src=$PWD/training,dst=$CPATH/training" \
|
||||
--mount "type=bind,src=$PWD/voices,dst=$CPATH/voices" \
|
||||
--mount "type=bind,src=$PWD/bin,dst=$CPATH/bin" \
|
||||
--mount "type=bind,src=$PWD/src,dst=$CPATH/src" \
|
||||
--workdir $CPATH \
|
||||
--ipc host \
|
||||
--user "$(id -u):$(id -g)" \
|
||||
-it ai-voice-cloning $CMD
|
Loading…
Reference in New Issue
Block a user