Merge pull request #517 from Paladinium/alltalkbeta_docker_improvements
Refactoring docker images, updating CUDA to 12.6 and pytorch 2.6
This commit is contained in:
11 files changed
+122
-142
No files matched your search
@@ -173,5 +173,4 @@ cython_debug/
|
|||||||
.idea/*
|
.idea/*
|
||||||
|
|
||||||
# Docker build
|
# Docker build
|
||||||
docker/conda/build
|
|
||||||
docker/deepspeed/build
|
docker/deepspeed/build
|
||||||
+1
-1
@@ -36,7 +36,7 @@ The Docker image currently works on Windows and Linux, optionally supporting NVI
|
|||||||
4. Download CUDA toolkit keyring: `wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb`
|
4. Download CUDA toolkit keyring: `wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb`
|
||||||
5. Install keyring: `sudo dpkg -i cuda-keyring_1.1-1_all.deb`
|
5. Install keyring: `sudo dpkg -i cuda-keyring_1.1-1_all.deb`
|
||||||
6. Update package list: `sudo apt-get update`
|
6. Update package list: `sudo apt-get update`
|
||||||
7. Install CUDA toolkit: `sudo apt-get -y install cuda-toolkit-12-4`
|
7. Install CUDA toolkit: `sudo apt-get -y install cuda-toolkit-12-6`
|
||||||
8. Install Docker Desktop using WSL2 as the backend
|
8. Install Docker Desktop using WSL2 as the backend
|
||||||
9. Restart
|
9. Restart
|
||||||
10. If you wish to monitor the terminal remotely via SSH, follow [this guide](https://www.hanselman.com/blog/how-to-ssh-into-wsl2-on-windows-10-from-an-external-machine).
|
10. If you wish to monitor the terminal remotely via SSH, follow [this guide](https://www.hanselman.com/blog/how-to-ssh-into-wsl2-on-windows-10-from-an-external-machine).
|
||||||
|
|||||||
+13
-48
@@ -1,54 +1,19 @@
|
|||||||
FROM continuumio/miniconda3:24.7.1-0
|
ARG GITHUB_REPOSITORY
|
||||||
|
FROM ${GITHUB_REPOSITORY}alltalk_environment:latest
|
||||||
|
|
||||||
# Argument to choose the model: piper, vits, xtts
|
# Argument to choose the model: piper, vits, xtts
|
||||||
ARG TTS_MODEL="xtts"
|
ARG TTS_MODEL="xtts"
|
||||||
ENV TTS_MODEL=$TTS_MODEL
|
ENV TTS_MODEL=$TTS_MODEL
|
||||||
|
|
||||||
ARG ALLTALK_DIR=/opt/alltalk
|
ARG DEEPSPEED_VERSION=0.16.2
|
||||||
|
ENV DEEPSPEED_VERSION=$DEEPSPEED_VERSION
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-l", "-c"]
|
ARG ALLTALK_DIR=/opt/alltalk
|
||||||
ENV SHELL=/bin/bash
|
|
||||||
ENV HOST=0.0.0.0
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
ENV CUDA_DOCKER_ARCH=all
|
|
||||||
ENV NVIDIA_VISIBLE_DEVICES=all
|
|
||||||
ENV CONDA_AUTO_UPDATE_CONDA="false"
|
|
||||||
|
|
||||||
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# Installation/Basic Utilities
|
|
||||||
##############################################################################
|
|
||||||
RUN <<EOR
|
|
||||||
apt-get update
|
|
||||||
apt-get upgrade -y
|
|
||||||
apt-get install --no-install-recommends -y \
|
|
||||||
espeak-ng \
|
|
||||||
curl \
|
|
||||||
wget \
|
|
||||||
jq \
|
|
||||||
vim
|
|
||||||
|
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
||||||
EOR
|
|
||||||
|
|
||||||
WORKDIR ${ALLTALK_DIR}
|
WORKDIR ${ALLTALK_DIR}
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# Create a conda environment and install dependencies:
|
|
||||||
##############################################################################
|
|
||||||
COPY docker/conda/build/environment-*.yml environment.yml
|
|
||||||
RUN <<EOR
|
|
||||||
RESULT=$( { conda env create -f environment.yml ; } 2>&1 )
|
|
||||||
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
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)
|
# Install python dependencies (cannot use --no-deps because requirements are not complete)
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@@ -59,7 +24,7 @@ ENV PIP_CACHE_DIR=${ALLTALK_DIR}/pip_cache
|
|||||||
RUN <<EOR
|
RUN <<EOR
|
||||||
conda activate alltalk
|
conda activate alltalk
|
||||||
|
|
||||||
mkdir ${ALLTALK_DIR}k/pip_cache
|
mkdir ${ALLTALK_DIR}/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 -r system/requirements/requirements_standalone.txt
|
||||||
pip install --no-cache-dir --cache-dir=${ALLTALK_DIR}/pip_cache --upgrade gradio==4.32.2
|
pip install --no-cache-dir --cache-dir=${ALLTALK_DIR}/pip_cache --upgrade gradio==4.32.2
|
||||||
# Parler:
|
# Parler:
|
||||||
@@ -77,10 +42,11 @@ RUN <<EOR
|
|||||||
DEEPSPEED_WHEEL=$(realpath /tmp/deepspeed/*.whl)
|
DEEPSPEED_WHEEL=$(realpath /tmp/deepspeed/*.whl)
|
||||||
conda activate alltalk
|
conda activate alltalk
|
||||||
|
|
||||||
RESULT=$( { CFLAGS="-I$CONDA_PREFIX/include/" LDFLAGS="-L$CONDA_PREFIX/lib/" \
|
echo "Using precompiled DeepSpeed wheel at ${DEEPSPEED_WHEEL}"
|
||||||
pip install --no-cache-dir ${DEEPSPEED_WHEEL} ; } 2>&1 )
|
CFLAGS="-I$CONDA_PREFIX/include/" LDFLAGS="-L$CONDA_PREFIX/lib/" \
|
||||||
|
pip install --no-cache-dir ${DEEPSPEED_WHEEL}
|
||||||
|
|
||||||
if echo $RESULT | grep -izq error ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to install pip dependencies: $RESULT"
|
echo "Failed to install pip dependencies: $RESULT"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -118,7 +84,6 @@ conda activate alltalk
|
|||||||
python diagnostics.py
|
python diagnostics.py
|
||||||
EOF
|
EOF
|
||||||
chmod +x start_alltalk.sh
|
chmod +x start_alltalk.sh
|
||||||
chmod +x start_environment.sh
|
|
||||||
chmod +x start_finetune.sh
|
chmod +x start_finetune.sh
|
||||||
chmod +x start_diagnostics.sh
|
chmod +x start_diagnostics.sh
|
||||||
EOR
|
EOR
|
||||||
@@ -129,9 +94,9 @@ COPY . .
|
|||||||
# Create script to execute firstrun.py and run it:
|
# Create script to execute firstrun.py and run it:
|
||||||
##############################################################################
|
##############################################################################
|
||||||
RUN echo $'#!/usr/bin/env bash \n\
|
RUN echo $'#!/usr/bin/env bash \n\
|
||||||
source ~/.bashrc \n\
|
source ~/.bashrc \n\
|
||||||
conda activate alltalk \n\
|
conda activate alltalk \n\
|
||||||
python ./system/config/firstrun.py $@' > ./start_firstrun.sh
|
python ./system/config/firstrun.py $@' > ./start_firstrun.sh
|
||||||
|
|
||||||
RUN chmod +x start_firstrun.sh
|
RUN chmod +x start_firstrun.sh
|
||||||
RUN ./start_firstrun.sh --tts_model $TTS_MODEL
|
RUN ./start_firstrun.sh --tts_model $TTS_MODEL
|
||||||
|
|||||||
+31
-7
@@ -10,7 +10,6 @@ DOCKER_TAG=latest
|
|||||||
CLEAN=false
|
CLEAN=false
|
||||||
|
|
||||||
# Create required build directories if they don't exist
|
# Create required build directories if they don't exist
|
||||||
mkdir -p ${SCRIPT_DIR=}/docker/conda/build
|
|
||||||
mkdir -p ${SCRIPT_DIR=}/docker/deepspeed/build
|
mkdir -p ${SCRIPT_DIR=}/docker/deepspeed/build
|
||||||
echo "Created build directories"
|
echo "Created build directories"
|
||||||
|
|
||||||
@@ -29,10 +28,20 @@ while [ "$#" -gt 0 ]; do
|
|||||||
TTS_MODEL="$2"
|
TTS_MODEL="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--deepspeed-version)
|
||||||
|
DEEPSPEED_VERSION="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--tag)
|
--tag)
|
||||||
DOCKER_TAG="$2"
|
DOCKER_TAG="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--github-repository)
|
||||||
|
if [ -n "${GITHUB_REPOSITORY}" ] && ! [[ $GITHUB_REPOSITORY =~ ^--.* ]]; then
|
||||||
|
GITHUB_REPOSITORY="$2"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
--clean)
|
--clean)
|
||||||
CLEAN=true
|
CLEAN=true
|
||||||
;;
|
;;
|
||||||
@@ -45,20 +54,34 @@ while [ "$#" -gt 0 ]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ "$CLEAN" = true ]; then
|
if [ "$CLEAN" = true ]; then
|
||||||
rm -rf ${SCRIPT_DIR=}/docker/conda/build
|
|
||||||
rm -rf ${SCRIPT_DIR=}/docker/deepspeed/build
|
rm -rf ${SCRIPT_DIR=}/docker/deepspeed/build
|
||||||
# Recreate directories after clean
|
# Recreate directories after clean
|
||||||
mkdir -p ${SCRIPT_DIR=}/docker/conda/build
|
|
||||||
mkdir -p ${SCRIPT_DIR=}/docker/deepspeed/build
|
mkdir -p ${SCRIPT_DIR=}/docker/deepspeed/build
|
||||||
echo "Cleaned and recreated build directories"
|
echo "Cleaned and recreated build directories"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$SCRIPT_DIR/docker/conda/build-conda-env.sh \
|
echo "Building base environment image"
|
||||||
|
$SCRIPT_DIR/docker/base/build-base-env.sh \
|
||||||
--cuda-version ${CUDA_VERSION} \
|
--cuda-version ${CUDA_VERSION} \
|
||||||
--python-version ${PYTHON_VERSION}
|
--python-version ${PYTHON_VERSION} \
|
||||||
|
--github-repository ${GITHUB_REPOSITORY} \
|
||||||
|
--tag ${DOCKER_TAG}
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Failed to build base environment image"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building DeepSpeed"
|
||||||
$SCRIPT_DIR/docker/deepspeed/build-deepspeed.sh \
|
$SCRIPT_DIR/docker/deepspeed/build-deepspeed.sh \
|
||||||
--python-version ${PYTHON_VERSION}
|
--python-version ${PYTHON_VERSION} \
|
||||||
|
--github-repository ${GITHUB_REPOSITORY} \
|
||||||
|
--tag ${DOCKER_TAG}
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Failed to build DeepSpeed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Starting docker build process using TTS model '${TTS_MODEL}' and docker tag '${DOCKER_TAG}'"
|
echo "Starting docker build process using TTS model '${TTS_MODEL}' and docker tag '${DOCKER_TAG}'"
|
||||||
echo "Building for CUDA $CUDA_VERSION using python ${PYTHON_VERSION}"
|
echo "Building for CUDA $CUDA_VERSION using python ${PYTHON_VERSION}"
|
||||||
@@ -68,7 +91,8 @@ docker buildx \
|
|||||||
--progress=plain \
|
--progress=plain \
|
||||||
--build-arg TTS_MODEL=$TTS_MODEL \
|
--build-arg TTS_MODEL=$TTS_MODEL \
|
||||||
--build-arg ALLTALK_DIR=$ALLTALK_DIR \
|
--build-arg ALLTALK_DIR=$ALLTALK_DIR \
|
||||||
-t alltalk_beta:${DOCKER_TAG} \
|
--build-arg DEEPSPEED_VERSION=$DEEPSPEED_VERSION \
|
||||||
|
-t ${GITHUB_REPOSITORY}alltalk_beta:${DOCKER_TAG} \
|
||||||
.
|
.
|
||||||
|
|
||||||
echo "Docker build process finished. Use docker-start.sh to start the container."
|
echo "Docker build process finished. Use docker-start.sh to start the container."
|
||||||
+7
-1
@@ -29,6 +29,12 @@ while [ "$#" -gt 0 ]; do
|
|||||||
DOCKER_TAG="$2"
|
DOCKER_TAG="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--github-repository)
|
||||||
|
if [ -n "${GITHUB_REPOSITORY}" ] && ! [[ $GITHUB_REPOSITORY =~ ^--.* ]]; then
|
||||||
|
GITHUB_REPOSITORY="$2"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# Allow to pass arbitrary arguments to docker as well to be flexible:
|
# Allow to pass arbitrary arguments to docker as well to be flexible:
|
||||||
ADDITIONAL_ARGS+=( $1 )
|
ADDITIONAL_ARGS+=( $1 )
|
||||||
@@ -65,4 +71,4 @@ docker run \
|
|||||||
--name alltalk \
|
--name alltalk \
|
||||||
"${DOCKER_ARGS[@]}" \
|
"${DOCKER_ARGS[@]}" \
|
||||||
"${ADDITIONAL_ARGS[@]}" \
|
"${ADDITIONAL_ARGS[@]}" \
|
||||||
alltalk_beta:${DOCKER_TAG} &> /dev/stdout
|
${GITHUB_REPOSITORY}alltalk_beta:${DOCKER_TAG} &> /dev/stdout
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
FROM continuumio/miniconda3:24.7.1-0 AS build
|
FROM continuumio/miniconda3:24.7.1-0 AS build
|
||||||
|
|
||||||
ARG CUDA_VERSION=12.4.1
|
ARG CUDA_VERSION=12.6.0
|
||||||
ENV CUDA_VERSION=$CUDA_VERSION
|
ENV CUDA_VERSION=$CUDA_VERSION
|
||||||
|
|
||||||
ARG PYTHON_VERSION=3.11.11
|
ARG PYTHON_VERSION=3.11.11
|
||||||
@@ -14,6 +14,8 @@ ENV CUDA_DOCKER_ARCH=all
|
|||||||
ENV NVIDIA_VISIBLE_DEVICES=all
|
ENV NVIDIA_VISIBLE_DEVICES=all
|
||||||
ENV CONDA_AUTO_UPDATE_CONDA="false"
|
ENV CONDA_AUTO_UPDATE_CONDA="false"
|
||||||
|
|
||||||
|
ENV ALLTALK_DIR=/opt/alltalk
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Installation/Basic Utilities
|
# Installation/Basic Utilities
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@@ -35,24 +37,24 @@ EOR
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
RUN <<EOR
|
RUN <<EOR
|
||||||
CUDA_SHORT_VERSION=${CUDA_VERSION%.*}
|
CUDA_SHORT_VERSION=${CUDA_VERSION%.*}
|
||||||
|
|
||||||
conda create -y -n "alltalk" -c conda-forge python=${PYTHON_VERSION}
|
conda create -y -n "alltalk" -c conda-forge python=${PYTHON_VERSION}
|
||||||
conda activate alltalk
|
conda activate alltalk
|
||||||
RESULT=$( { conda install -y \
|
conda install -y \
|
||||||
gcc_linux-64 \
|
gcc_linux-64 \
|
||||||
gxx_linux-64 \
|
gxx_linux-64 \
|
||||||
pytorch \
|
|
||||||
pytorch-cuda=${CUDA_SHORT_VERSION} \
|
|
||||||
torchvision \
|
|
||||||
torchaudio \
|
|
||||||
libaio \
|
libaio \
|
||||||
nvidia/label/cuda-${CUDA_SHORT_VERSION}.0::cuda-toolkit \
|
|
||||||
faiss-gpu=1.9.0 \
|
faiss-gpu=1.9.0 \
|
||||||
|
cuda=${CUDA_VERSION} cuda-tools=${CUDA_VERSION} cuda-toolkit=${CUDA_VERSION} cuda-version=${CUDA_SHORT_VERSION} \
|
||||||
|
cuda-command-line-tools=${CUDA_VERSION} cuda-compiler=${CUDA_VERSION} cuda-runtime=${CUDA_VERSION} \
|
||||||
|
cuda-libraries=${CUDA_VERSION} cuda-libraries-dev=${CUDA_VERSION} cuda-libraries-static=${CUDA_VERSION} \
|
||||||
|
cuda-cudart=${CUDA_SHORT_VERSION} cuda-cudart_linux-64=${CUDA_SHORT_VERSION} \
|
||||||
|
cudnn=9.3 \
|
||||||
|
py-cpuinfo=9 \
|
||||||
conda-forge::ffmpeg=7.1.0 \
|
conda-forge::ffmpeg=7.1.0 \
|
||||||
conda-forge::portaudio=19.7.0 \
|
conda-forge::portaudio=19.7.0 \
|
||||||
-c pytorch \
|
-c pytorch \
|
||||||
-c anaconda \
|
-c nvidia \
|
||||||
-c nvidia ; } 2>&1 )
|
-c anaconda
|
||||||
|
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "Failed to install conda dependencies: $RESULT"
|
echo "Failed to install conda dependencies: $RESULT"
|
||||||
@@ -62,16 +64,17 @@ RUN <<EOR
|
|||||||
conda clean -a && pip cache purge
|
conda clean -a && pip cache purge
|
||||||
EOR
|
EOR
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# Export conda environment:
|
|
||||||
##############################################################################
|
|
||||||
RUN <<EOR
|
RUN <<EOR
|
||||||
conda activate alltalk
|
CUDA_SHORT_VERSION=${CUDA_VERSION%.*}
|
||||||
conda env export > /environment-cu-${CUDA_VERSION}-cp-${PYTHON_VERSION}.yml
|
CUDA_SHORT_VERSION_NO_DOT=${CUDA_SHORT_VERSION//./}
|
||||||
EOR
|
|
||||||
|
|
||||||
##############################################################################
|
conda activate alltalk
|
||||||
# Make environment file available to docker build output:
|
mkdir -p ${ALLTALK_DIR}/pip_cache
|
||||||
##############################################################################
|
pip install --no-cache-dir --cache-dir=${ALLTALK_DIR}/pip_cache \
|
||||||
FROM scratch
|
torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu${CUDA_SHORT_VERSION_NO_DOT}
|
||||||
COPY --from=build /environment-*.yml /
|
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo "Failed to install pip dependencies: $RESULT"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
EOR
|
||||||
@@ -5,10 +5,7 @@ cd $SCRIPT_DIR
|
|||||||
|
|
||||||
. ${SCRIPT_DIR=}/../variables.sh
|
. ${SCRIPT_DIR=}/../variables.sh
|
||||||
|
|
||||||
if [ -f $SCRIPT_DIR/build/environment-cu-${CUDA_VERSION}-cp-${PYTHON_VERSION}.yml ]; then
|
DOCKER_TAG=latest
|
||||||
echo "Environment file already exists - skipping..."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
while [ "$#" -gt 0 ]; do
|
while [ "$#" -gt 0 ]; do
|
||||||
@@ -21,8 +18,17 @@ while [ "$#" -gt 0 ]; do
|
|||||||
PYTHON_VERSION="$2"
|
PYTHON_VERSION="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--tag)
|
||||||
|
DOCKER_TAG="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--github-repository)
|
||||||
|
if [ -n "${GITHUB_REPOSITORY}" ] && ! [[ $GITHUB_REPOSITORY =~ ^--.* ]]; then
|
||||||
|
GITHUB_REPOSITORY="$2"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# Allow to pass arbitrary arguments to docker as well to be flexible:
|
|
||||||
echo "Unknown argument '$1'"
|
echo "Unknown argument '$1'"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
@@ -32,12 +38,10 @@ done
|
|||||||
|
|
||||||
echo "Building conda environment using python ${PYTHON_VERSION} with CUDA ${CUDA_VERSION}"
|
echo "Building conda environment using python ${PYTHON_VERSION} with CUDA ${CUDA_VERSION}"
|
||||||
|
|
||||||
rm -rf build # make sure to properly clean up
|
|
||||||
mkdir -p build
|
|
||||||
|
|
||||||
docker buildx \
|
docker buildx \
|
||||||
build \
|
build \
|
||||||
|
--progress=plain \
|
||||||
--build-arg CUDA_VERSION=$CUDA_VERSION \
|
--build-arg CUDA_VERSION=$CUDA_VERSION \
|
||||||
--build-arg PYTHON_VERSION=$PYTHON_VERSION \
|
--build-arg PYTHON_VERSION=$PYTHON_VERSION \
|
||||||
--output=$SCRIPT_DIR/build \
|
-t ${GITHUB_REPOSITORY}alltalk_environment:${DOCKER_TAG} \
|
||||||
.
|
.
|
||||||
+13
-43
@@ -1,53 +1,15 @@
|
|||||||
FROM continuumio/miniconda3:24.7.1-0
|
ARG GITHUB_REPOSITORY
|
||||||
|
FROM ${GITHUB_REPOSITORY}alltalk_environment:latest
|
||||||
|
|
||||||
ARG DEEPSPEED_VERSION=0.16.2
|
ARG DEEPSPEED_VERSION=0.16.3
|
||||||
ENV DEEPSPEED_VERSION=$DEEPSPEED_VERSION
|
ENV DEEPSPEED_VERSION=$DEEPSPEED_VERSION
|
||||||
|
|
||||||
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 NVIDIA_VISIBLE_DEVICES=all
|
|
||||||
ENV CONDA_AUTO_UPDATE_CONDA="false"
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Directories:
|
# Directories:
|
||||||
##############################################################################
|
##############################################################################
|
||||||
ENV STAGE_DIR=/tmp
|
ENV STAGE_DIR=/tmp
|
||||||
RUN mkdir -p ${STAGE_DIR}
|
RUN mkdir -p ${STAGE_DIR}
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# Installation/Basic Utilities
|
|
||||||
##############################################################################
|
|
||||||
RUN <<EOR
|
|
||||||
apt-get update
|
|
||||||
apt-get upgrade -y
|
|
||||||
apt-get install --no-install-recommends -y \
|
|
||||||
espeak-ng \
|
|
||||||
curl \
|
|
||||||
wget \
|
|
||||||
jq \
|
|
||||||
vim
|
|
||||||
|
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
||||||
EOR
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# Create a conda environment and install dependencies:
|
|
||||||
##############################################################################
|
|
||||||
COPY build/environment-*.yml environment.yml
|
|
||||||
RUN <<EOR
|
|
||||||
RESULT=$( { conda env create -f environment.yml ; } 2>&1 )
|
|
||||||
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
echo "Failed to install conda dependencies: $RESULT"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
conda clean -a && pip cache purge
|
|
||||||
EOR
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Install python dependencies
|
# Install python dependencies
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@@ -56,8 +18,7 @@ RUN <<EOR
|
|||||||
conda activate alltalk
|
conda activate alltalk
|
||||||
|
|
||||||
pip install \
|
pip install \
|
||||||
deepspeed-kernels \
|
deepspeed-kernels
|
||||||
scikit-learn
|
|
||||||
EOR
|
EOR
|
||||||
|
|
||||||
|
|
||||||
@@ -69,6 +30,15 @@ RUN <<EOR
|
|||||||
cd ${STAGE_DIR}/DeepSpeed
|
cd ${STAGE_DIR}/DeepSpeed
|
||||||
git checkout .
|
git checkout .
|
||||||
git checkout "tags/v${DEEPSPEED_VERSION}" -b "v${DEEPSPEED_VERSION}"
|
git checkout "tags/v${DEEPSPEED_VERSION}" -b "v${DEEPSPEED_VERSION}"
|
||||||
|
|
||||||
|
# Patching some files due to bug https://github.com/microsoft/DeepSpeed/issues/6709
|
||||||
|
START_LINE=`awk '/#ifndef BF16_AVAILABLE/{ print NR; exit }' csrc/transformer/inference/csrc/gelu.cu`
|
||||||
|
TO_LINE=$((START_LINE + 2))
|
||||||
|
sed -i "${START_LINE},${TO_LINE}d" ./csrc/transformer/inference/csrc/gelu.cu
|
||||||
|
|
||||||
|
START_LINE=`awk '/#ifndef BF16_AVAILABLE/{ print NR; exit }' csrc/transformer/inference/csrc/transform.cu`
|
||||||
|
TO_LINE=$((START_LINE + 2))
|
||||||
|
sed -i "${START_LINE},${TO_LINE}d" ./csrc/transformer/inference/csrc/transform.cu
|
||||||
EOR
|
EOR
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ cd $SCRIPT_DIR
|
|||||||
|
|
||||||
. ${SCRIPT_DIR=}/../variables.sh
|
. ${SCRIPT_DIR=}/../variables.sh
|
||||||
|
|
||||||
|
DOCKER_TAG=latest
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
while [ "$#" -gt 0 ]; do
|
while [ "$#" -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -16,8 +18,17 @@ while [ "$#" -gt 0 ]; do
|
|||||||
DEEPSPEED_VERSION="$2"
|
DEEPSPEED_VERSION="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--tag)
|
||||||
|
DOCKER_TAG="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--github-repository)
|
||||||
|
if [ -n "${GITHUB_REPOSITORY}" ] && ! [[ $GITHUB_REPOSITORY =~ ^--.* ]]; then
|
||||||
|
GITHUB_REPOSITORY="$2"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# Allow to pass arbitrary arguments to docker as well to be flexible:
|
|
||||||
echo "Unknown argument '$1'"
|
echo "Unknown argument '$1'"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
@@ -33,22 +44,16 @@ then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CONDA_ENV=${SCRIPT_DIR=}/../conda/build/environment-cu-${CUDA_VERSION}-cp-${PYTHON_VERSION}.yml
|
|
||||||
if [ ! -f ${CONDA_ENV} ]; then
|
|
||||||
echo "No conda environment found. Please run 'build-conda-env.sh' first."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Building DeepSpeed $DEEPSPEED_VERSION using python ${PYTHON_VERSION}"
|
echo "Building DeepSpeed $DEEPSPEED_VERSION using python ${PYTHON_VERSION}"
|
||||||
|
|
||||||
rm -rf build # make sure to properly clean up
|
rm -rf build # make sure to properly clean up
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cp ${CONDA_ENV} ${SCRIPT_DIR=}/build
|
|
||||||
|
|
||||||
docker buildx \
|
docker buildx \
|
||||||
build \
|
build \
|
||||||
|
--build-arg GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
|
||||||
--build-arg DEEPSPEED_VERSION=$DEEPSPEED_VERSION \
|
--build-arg DEEPSPEED_VERSION=$DEEPSPEED_VERSION \
|
||||||
-t deepspeed:$DEEPSPEED_VERSION \
|
-t ${GITHUB_REPOSITORY}alltalk_deepspeed:${DOCKER_TAG} \
|
||||||
.
|
.
|
||||||
|
|
||||||
docker run \
|
docker run \
|
||||||
@@ -57,4 +62,4 @@ docker run \
|
|||||||
--gpus=all \
|
--gpus=all \
|
||||||
--name deepspeed \
|
--name deepspeed \
|
||||||
-v $SCRIPT_DIR/build:/deepspeed \
|
-v $SCRIPT_DIR/build:/deepspeed \
|
||||||
deepspeed:$DEEPSPEED_VERSION
|
${GITHUB_REPOSITORY}alltalk_deepspeed:${DOCKER_TAG}
|
||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
export CUDA_VERSION=12.4.1
|
export CUDA_VERSION=12.6.0
|
||||||
export PYTHON_VERSION=3.11.11
|
export PYTHON_VERSION=3.11.11
|
||||||
export DEEPSPEED_VERSION=0.16.2
|
export DEEPSPEED_VERSION=0.16.2
|
||||||
export ALLTALK_DIR=/opt/alltalk
|
export ALLTALK_DIR=/opt/alltalk
|
||||||
|
export GITHUB_REPOSITORY=
|
||||||
@@ -2,6 +2,8 @@ import numpy as np
|
|||||||
import re
|
import re
|
||||||
import unicodedata
|
import unicodedata
|
||||||
from fairseq import checkpoint_utils
|
from fairseq import checkpoint_utils
|
||||||
|
from fairseq.data import Dictionary
|
||||||
|
import torch
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@@ -66,6 +68,7 @@ def load_embedding(embedder_model):
|
|||||||
#print("MODEL PATH IS", model_path)
|
#print("MODEL PATH IS", model_path)
|
||||||
|
|
||||||
# Load model ensemble and task
|
# Load model ensemble and task
|
||||||
|
torch.serialization.add_safe_globals([Dictionary])
|
||||||
models = checkpoint_utils.load_model_ensemble_and_task(
|
models = checkpoint_utils.load_model_ensemble_and_task(
|
||||||
[f"{model_path}"],
|
[f"{model_path}"],
|
||||||
suffix="",
|
suffix="",
|
||||||
|
|||||||
Reference in new issue
Block a user