Fixing docker build for DeepSpeed, introducing build for conda environment
This commit is contained in:
1 parent
7522fa87d6
commit
c7f9b04826
10 files changed
+272
-153
No files matched your search
+40
-48
@@ -4,23 +4,21 @@ FROM continuumio/miniconda3:24.7.1-0
|
||||
ARG TTS_MODEL="xtts"
|
||||
ENV TTS_MODEL=$TTS_MODEL
|
||||
|
||||
ARG CUDA_VERSION="12.1.1"
|
||||
ENV CUDA_VERSION=$CUDA_VERSION
|
||||
|
||||
ARG PYTHON_VERSION=3.11.9
|
||||
ENV PYTHON_VERSION=$PYTHON_VERSION
|
||||
|
||||
ARG PYTORCH_VERSION=2.2.1
|
||||
ENV PYTORCH_VERSION=$PYTORCH_VERSION
|
||||
ARG ALLTALK_DIR=/opt/alltalk
|
||||
|
||||
SHELL ["/bin/bash", "-l", "-c"]
|
||||
ENV SHELL=/bin/bash
|
||||
ENV HOST=0.0.0.0
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV CUDA_DOCKER_ARCH=all
|
||||
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
||||
ENV NVIDIA_VISIBLE_DEVICES=all
|
||||
ENV CONDA_AUTO_UPDATE_CONDA="false"
|
||||
|
||||
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
||||
|
||||
##############################################################################
|
||||
# Installation/Basic Utilities
|
||||
##############################################################################
|
||||
RUN <<EOR
|
||||
apt-get update
|
||||
apt-get upgrade -y
|
||||
@@ -34,59 +32,47 @@ RUN <<EOR
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
EOR
|
||||
|
||||
WORKDIR /alltalk
|
||||
WORKDIR ${ALLTALK_DIR}
|
||||
|
||||
##############################################################################
|
||||
# Create a conda environment and install dependencies:
|
||||
ARG INSTALL_ENV_DIR=/alltalk/alltalk_environment/env
|
||||
ENV CONDA_AUTO_UPDATE_CONDA="false"
|
||||
##############################################################################
|
||||
COPY docker/conda/build/environment-*.yml environment.yml
|
||||
RUN <<EOR
|
||||
CUDA_SHORT_VERSION=${CUDA_VERSION%.*}
|
||||
|
||||
conda create -y -n "alltalk" -c conda-forge python=${PYTHON_VERSION}
|
||||
conda activate alltalk
|
||||
RESULT=$( { conda install -y \
|
||||
gcc_linux-64 \
|
||||
gxx_linux-64 \
|
||||
pytorch=${PYTORCH_VERSION} \
|
||||
pytorch-cuda=${CUDA_SHORT_VERSION} \
|
||||
torchvision \
|
||||
torchaudio \
|
||||
libaio \
|
||||
nvidia/label/cuda-${CUDA_SHORT_VERSION}.0::cuda-toolkit \
|
||||
faiss-gpu=1.9.0 \
|
||||
conda-forge::ffmpeg=7.1.0 \
|
||||
conda-forge::portaudio=19.7.0 \
|
||||
-c pytorch \
|
||||
-c anaconda \
|
||||
-c nvidia ; } 2>&1 )
|
||||
RESULT=$( { conda env create -f environment.yml ; } 2>&1 )
|
||||
|
||||
if echo $RESULT | grep -izq error ; then
|
||||
echo "Failed to install conda dependencies 2: $RESULT"
|
||||
echo "Failed to install conda dependencies: $RESULT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
conda clean -a && pip cache purge
|
||||
EOR
|
||||
|
||||
##############################################################################
|
||||
# Install python dependencies (cannot use --no-deps because requirements are not complete)
|
||||
##############################################################################
|
||||
COPY system/config system/config
|
||||
COPY system/requirements/requirements_standalone.txt system/requirements/requirements_standalone.txt
|
||||
COPY system/requirements/requirements_parler.txt system/requirements/requirements_parler.txt
|
||||
ENV PIP_CACHE_DIR=/alltalk/pip_cache
|
||||
ENV PIP_CACHE_DIR=${ALLTALK_DIR}/pip_cache
|
||||
RUN <<EOR
|
||||
conda activate alltalk
|
||||
|
||||
mkdir /alltalk/pip_cache
|
||||
pip install --no-cache-dir --cache-dir=/alltalk/pip_cache -r system/requirements/requirements_standalone.txt
|
||||
pip install --no-cache-dir --cache-dir=/alltalk/pip_cache --upgrade gradio==4.32.2
|
||||
mkdir ${ALLTALK_DIR}k/pip_cache
|
||||
pip install --no-cache-dir --cache-dir=${ALLTALK_DIR}/pip_cache -r system/requirements/requirements_standalone.txt
|
||||
pip install --no-cache-dir --cache-dir=${ALLTALK_DIR}/pip_cache --upgrade gradio==4.32.2
|
||||
# Parler:
|
||||
pip install --no-cache-dir --cache-dir=/alltalk/pip_cache -r system/requirements/requirements_parler.txt
|
||||
pip install --no-cache-dir --cache-dir=${ALLTALK_DIR}/pip_cache -r system/requirements/requirements_parler.txt
|
||||
|
||||
conda clean --all --force-pkgs-dirs -y && pip cache purge
|
||||
EOR
|
||||
|
||||
# Deepspeed:
|
||||
##############################################################################
|
||||
# Install DeepSpeed
|
||||
##############################################################################
|
||||
RUN mkdir -p /tmp/deepseped
|
||||
COPY deepspeed/build/*.whl /tmp/deepspeed/
|
||||
COPY docker/deepspeed/build/*.whl /tmp/deepspeed/
|
||||
RUN <<EOR
|
||||
DEEPSPEED_WHEEL=$(realpath /tmp/deepspeed/*.whl)
|
||||
conda activate alltalk
|
||||
@@ -103,11 +89,9 @@ RUN <<EOR
|
||||
conda clean --all --force-pkgs-dirs -y && pip cache purge
|
||||
EOR
|
||||
|
||||
### Deepspeed requires cutlass:
|
||||
###RUN git clone --depth 1 --branch "v3.5.1" https://github.com/NVIDIA/cutlass /alltalk/cutlass
|
||||
###ENV CUTLASS_PATH=/alltalk/cutlass
|
||||
|
||||
##############################################################################
|
||||
# Writing scripts to start alltalk:
|
||||
##############################################################################
|
||||
RUN <<EOR
|
||||
cat << EOF > start_alltalk.sh
|
||||
#!/usr/bin/env bash
|
||||
@@ -141,7 +125,9 @@ EOR
|
||||
|
||||
COPY . .
|
||||
|
||||
# Create script to execute firstrun.py:
|
||||
##############################################################################
|
||||
# Create script to execute firstrun.py and run it:
|
||||
##############################################################################
|
||||
RUN echo $'#!/usr/bin/env bash \n\
|
||||
source ~/.bashrc \n\
|
||||
conda activate alltalk \n\
|
||||
@@ -150,18 +136,24 @@ python ./system/config/firstrun.py $@' > ./start_firstrun.sh
|
||||
RUN chmod +x start_firstrun.sh
|
||||
RUN ./start_firstrun.sh --tts_model $TTS_MODEL
|
||||
|
||||
RUN mkdir -p /alltalk/outputs
|
||||
RUN mkdir -p ${ALLTALK_DIR}/outputs
|
||||
RUN mkdir -p /root/.triton/autotune
|
||||
|
||||
# Enabling deepspeed for all models:
|
||||
##############################################################################
|
||||
# Enable deepspeed for all models:
|
||||
##############################################################################
|
||||
RUN find . -name model_settings.json -exec sed -i -e 's/"deepspeed_enabled": false/"deepspeed_enabled": true/g' {} \;
|
||||
|
||||
# Downloading all RVC models:
|
||||
##############################################################################
|
||||
# Download all RVC models:
|
||||
##############################################################################
|
||||
RUN <<EOR
|
||||
jq -r '.[]' system/tts_engines/rvc_files.json > /tmp/rvc_files.txt
|
||||
xargs -n 1 curl --create-dirs --output-dir models/rvc_base -LO < /tmp/rvc_files.txt
|
||||
rm -f /tmp/rvc_files.txt
|
||||
EOR
|
||||
|
||||
## Start alltalk:
|
||||
##############################################################################
|
||||
# Start alltalk:
|
||||
##############################################################################
|
||||
ENTRYPOINT ["sh", "-c", "./start_alltalk.sh"]
|
||||
Reference in new issue
Block a user