Merge pull request #542 from Paladinium/alltalkbeta

Improvements to the docker build + update readme
This commit is contained in:
erew123 authored and GitHub committed 2025-02-27 06:38:35 +00:00
commit cb47f763f9
10 files changed
+91 -66

No files matched your search

+3
View File
@@ -2,10 +2,13 @@ name: 'Setting up docker'
inputs:
DOCKERHUB_USERNAME:
description: "Docker hub username"
required: true
DOCKERHUB_REPO_NAME:
description: "Docker hub repo name"
required: true
DOCKERHUB_TOKEN:
description: "Docker hub token"
required: true
runs:
+1 -1
View File
@@ -116,7 +116,7 @@ jobs:
ALLTALK_DIR=${{ env.ALLTALK_DIR }}
DEEPSPEED_VERSION=${{ env.DEEPSPEED_VERSION }}
DOCKER_TAG=${{ env.DOCKER_TAG }}
GITHUB_REPOSITORY=${{ env.DOCKERHUB_USERNAME }}/
DOCKER_REPOSITORY=${{ env.DOCKERHUB_USERNAME }}/
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPO_NAME }}:buildcache-${{ matrix.tts }}
+50 -42
View File
@@ -1,21 +1,19 @@
# Docker
The Docker image currently works on Windows and Linux, optionally supporting NVIDIA GPUs.
The Docker image currently works on Windows and Linux supporting NVIDIA GPUs.
## General Remarks
- The resulting Docker image is 21 GB in size. Building might require even more disk space temporarily.
- Another 15 GB is required for building DeepSpeed
- Build time depends on your hardware and internet connection. Expect at least 20-30min to be normal for a full build.
- This includes building the conda environment as well as DeepSpeed, which is the basis for the alltalk Docker image.
- The Docker build for alltalk:
- Downloads XTTS as default TTS engine
- Enables RVC by default
- Downloads all supported RVC models
- Enables deepspeed by default
- Starting the Docker image should only a few seconds due to all the steps that were already executed during build.
## System requirements
- AMD compatible Windows or Linux system
- CUDA 12.6
- Nvidia Docker Container Toolkit
- At least 25GB of free disk space
## Docker for Linux
## Quickstart
Use `docker-start.sh` to pull the latest docker image using the XTTS model from Docker Hub and
visit `http://localhost:7851/`. See instructions below for passing more arguments to the start script.
### Ubuntu Specific Setup for GPUs
## Installing Prerequisites
### Docker for Linux
#### Ubuntu Specific Setup for GPUs
1. Make sure the latest nvidia drivers are installed: `sudo ubuntu-drivers install`
1. Install Docker your preferred way. One way to do it is to follow the official documentation [here](https://docs.docker.com/engine/install/ubuntu/#uninstall-old-versions).
- Start by uninstalling the old versions
@@ -27,8 +25,8 @@ The Docker image currently works on Windows and Linux, optionally supporting NVI
```sudo nvidia-ctk runtime configure --runtime=docker```
- Restart docker
## Docker for Windows (WSL2)
### Windows Specific Setup for GPUs
### Docker for Windows (WSL2)
#### Windows Specific Setup for GPUs
> Make sure your Nvidia drivers are up to date: https://www.nvidia.com/download/index.aspx
1. Install WSL2 in PowerShell with `wsl --install` and restart
2. Open PowerShell, type and enter ```ubuntu```. It should now load you into wsl2
@@ -40,39 +38,49 @@ The Docker image currently works on Windows and Linux, optionally supporting NVI
8. Install Docker Desktop using WSL2 as the backend
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).
11. Open PowerShell, type ```ubuntu```, [then follow below](#building-and-running-in-docker)
11. Open PowerShell, type ```ubuntu```, [then follow below](#quickstart)
## Building and Running in Docker
## Arguments for starting the Docker container
To make it as simple as possible to use Docker, the script `docker-start.sh` can be used. It provides the
following optional arguments:
1. Open a terminal (or Ubuntu WSL) and go where you cloned the repo
3. Build the image with `./docker-build.sh`
4. Start the container with `./docker-start.sh`
5. Visit `http://localhost:7851/` or remotely with `http://<ip>:7851`
## Arguments for building and starting docker
There are various arguments to customize the build and start of the docker image.
### Arguments for `docker-build.sh`
- `--tts_model` allows to choose the TTS model that is used by default. Valid values are `piper`, `vits`, `xtts`. Defaults to `xtts`.
- Example: `docker-build.sh --tts_model piper`
- `--tag` allows to choose the docker tag. Defaults to `latest`.
- Example: `docker-build.sh --tag mytag`
- `--clean` allows remove existing dependency build like conda environment or DeepSpeed.
- Example: `docker-build.sh --clean`
### Arguments for `docker-start.sh`
- `--config` lets you choose a config JSON file which can subset of `confignew.json`. This allows you to change only
- `--config` lets you choose a config JSON file which can subset of `confignew.json`. This allows you to change only
few values and leave the rest as defined in the default `confignew.json` file.
- Example: `docker-start.sh --config /my/config/file.json` with content `{"branding": "My Brand "}` will just change
the branding in `confignew.json`.
- Example: `docker-start.sh --config /my/config/file.json` with content `{"branding": "My Brand "}` will just change
the branding in `confignew.json`.
- `--voices` lets you add voices for the TTS engine in WAV format. You have to specify the folder containing all
voice files.
- Example: `docker-start.sh --voices /my/voices/dir`
- Example: `docker-start.sh --voices /my/voices/dir`
- `--rvc_voices` similar to voices, this option lets you pick the folder containing the RVC models.
- Example: `docker-start.sh --rvc_voices /my/rvc/voices/dir`
- Example: `docker-start.sh --rvc_voices /my/rvc/voices/dir`
- `--no_ui` allows you to not expose port 7852 for the gradio interface. Note that you still have to set `launch_gradio`
to `false` via JSON file passed to `--config`.
- `--tag` allows to choose the docker tag of the image to run. Defaults to `latest`.
- Example: `docker-start.sh --tag mytag`
- Since the above commands only address the most important options, you might pass additional arbitrary docker commands
to the `docker-start.sh`.
- `--docker-repository` allows to choose another Docker repository for pulling the image from. Use an empty
string for the local repo.
- Since the above commands only address the most important options, you might pass additional arbitrary docker arguments
to the `docker-start.sh`.
Of course, like any other Docker image, you can also directly use `docker run` directly and use `docker-start.sh`
as an inspiration.
## Building your own images (advanced)
> Be aware that building the images requires good hardware and bandwidth. Expect this process to require >
> 40 GB of disk space and > 30min execution time depending on your hardware.
Under normal circumstances, there should be no need to build the Docker images locally. However, if needed for some
reason, you may want to use `docker-build.sh` with the following arguments:
- `--tts_model` allows to choose the TTS model that is used by default. Valid values are `piper`, `vits`, `xtts`. Defaults to `xtts`.
- Example: `docker-build.sh --tts_model piper`
- `--tag` allows to choose the docker tag. Defaults to `latest-xtts`.
- Example: `docker-build.sh --tag mytag`
- `--docker-repository` allows to choose another Docker repository for tagging the image from. Use an empty
string for the local repo.
- `--local-deepspeed-build` should only be used in rare cases where DeepSpeed needs to be rebuilt. Defaults to `false`.
- `--clean` allows remove existing dependency build like conda environment or DeepSpeed.
- Example: `docker-build.sh --clean`
+2 -2
View File
@@ -1,6 +1,6 @@
ARG GITHUB_REPOSITORY
ARG DOCKER_REPOSITORY
ARG DOCKER_TAG=latest
FROM ${GITHUB_REPOSITORY}alltalk_tts_environment:${DOCKER_TAG}
FROM ${DOCKER_REPOSITORY}alltalk_tts_environment:${DOCKER_TAG}
# Argument to choose the model: piper, vits, xtts
ARG TTS_MODEL="xtts"
+10 -6
View File
@@ -6,9 +6,10 @@ cd $SCRIPT_DIR
. ${SCRIPT_DIR=}/docker/variables.sh
TTS_MODEL=xtts
DOCKER_TAG=latest
DOCKER_TAG=latest-${TTS_MODEL}
CLEAN=false
LOCAL_DEEPSPEED_BUILD=false
DOCKER_REPOSITORY=erew123
# Create required build directories if they don't exist
mkdir -p ${SCRIPT_DIR=}/docker/deepspeed/build
@@ -37,10 +38,12 @@ while [ "$#" -gt 0 ]; do
DOCKER_TAG="$2"
shift
;;
--github-repository)
--docker-repository)
if [ -n "$2" ] && ! [[ $2 =~ ^--.* ]]; then
GITHUB_REPOSITORY="$2"
DOCKER_REPOSITORY="$2"
shift
else
DOCKER_REPOSITORY=""
fi
;;
--local-deepspeed-build)
@@ -68,7 +71,7 @@ echo "Building base environment image"
$SCRIPT_DIR/docker/base/build-base-env.sh \
--cuda-version ${CUDA_VERSION} \
--python-version ${PYTHON_VERSION} \
--github-repository ${GITHUB_REPOSITORY} \
--docker-repository ${DOCKER_REPOSITORY} \
--tag ${DOCKER_TAG}
if [ $? -ne 0 ]; then
@@ -80,7 +83,7 @@ if [ "$LOCAL_DEEPSPEED_BUILD" = true ]; then
echo "Building DeepSpeed"
$SCRIPT_DIR/docker/deepspeed/build-deepspeed.sh \
--python-version ${PYTHON_VERSION} \
--github-repository ${GITHUB_REPOSITORY} \
--docker-repository ${DOCKER_REPOSITORY} \
--tag ${DOCKER_TAG}
if [ $? -ne 0 ]; then
@@ -99,7 +102,8 @@ docker buildx \
--build-arg ALLTALK_DIR=$ALLTALK_DIR \
--build-arg DEEPSPEED_VERSION=$DEEPSPEED_VERSION \
--build-arg DOCKER_TAG=$DOCKER_TAG \
-t ${GITHUB_REPOSITORY}alltalk_tts:${DOCKER_TAG} \
--build-arg DOCKER_REPOSITORY=$DOCKER_REPOSITORY \
-t ${DOCKER_REPOSITORY}alltalk_tts:${DOCKER_TAG} \
.
echo "Docker build process finished. Use docker-start.sh to start the container."
+8 -3
View File
@@ -5,6 +5,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
WITH_UI=true
DOCKER_TAG=latest
DOCKER_REPOSITORY=erew123
declare -a ADDITIONAL_ARGS=()
# Parse arguments
@@ -29,10 +30,12 @@ while [ "$#" -gt 0 ]; do
DOCKER_TAG="$2"
shift
;;
--github-repository)
--docker-repository)
if [ -n "$2" ] && ! [[ $2 =~ ^--.* ]]; then
GITHUB_REPOSITORY="$2"
DOCKER_REPOSITORY="$2"
shift
else
DOCKER_REPOSITORY=""
fi
;;
*)
@@ -45,6 +48,8 @@ done
# Compose docker arguments based on user input to the script:
declare -a DOCKER_ARGS=()
echo "REPO = $DOCKER_REPOSITORY"
exit 0
if [[ -n $CONFIG ]]; then
# Mount the config file to docker_confignew.json:
@@ -71,4 +76,4 @@ docker run \
--name alltalk \
"${DOCKER_ARGS[@]}" \
"${ADDITIONAL_ARGS[@]}" \
${GITHUB_REPOSITORY}alltalk_tts:${DOCKER_TAG} &> /dev/stdout
${DOCKER_REPOSITORY}alltalk_tts:${DOCKER_TAG} &> /dev/stdout
+7 -4
View File
@@ -6,6 +6,7 @@ cd $SCRIPT_DIR
. ${SCRIPT_DIR=}/../variables.sh
DOCKER_TAG=latest
DOCKER_REPOSITORY=erew123
# Parse arguments
while [ "$#" -gt 0 ]; do
@@ -22,10 +23,12 @@ while [ "$#" -gt 0 ]; do
DOCKER_TAG="$2"
shift
;;
--github-repository)
if [ -n "${GITHUB_REPOSITORY}" ] && ! [[ $GITHUB_REPOSITORY =~ ^--.* ]]; then
GITHUB_REPOSITORY="$2"
--docker-repository)
if [ -n "$2" ] && ! [[ $2 =~ ^--.* ]]; then
DOCKER_REPOSITORY="$2"
shift
else
DOCKER_REPOSITORY=""
fi
;;
*)
@@ -43,5 +46,5 @@ docker buildx \
--progress=plain \
--build-arg CUDA_VERSION=$CUDA_VERSION \
--build-arg PYTHON_VERSION=$PYTHON_VERSION \
-t ${GITHUB_REPOSITORY}alltalk_tts_environment:${DOCKER_TAG} \
-t ${DOCKER_REPOSITORY}alltalk_tts_environment:${DOCKER_TAG} \
.
+2 -2
View File
@@ -1,6 +1,6 @@
ARG GITHUB_REPOSITORY
ARG DOCKER_REPOSITORY
ARG DOCKER_TAG=latest
FROM ${GITHUB_REPOSITORY}alltalk_tts_environment:${DOCKER_TAG}
FROM ${DOCKER_REPOSITORY}alltalk_tts_environment:${DOCKER_TAG}
ARG DEEPSPEED_VERSION=0.16.3
ENV DEEPSPEED_VERSION=$DEEPSPEED_VERSION
+8 -5
View File
@@ -6,6 +6,7 @@ cd $SCRIPT_DIR
. ${SCRIPT_DIR=}/../variables.sh
DOCKER_TAG=latest
DOCKER_REPOSITORY=erew123
# Parse arguments
while [ "$#" -gt 0 ]; do
@@ -23,9 +24,11 @@ while [ "$#" -gt 0 ]; do
shift
;;
--github-repository)
if [ -n "${GITHUB_REPOSITORY}" ] && ! [[ $GITHUB_REPOSITORY =~ ^--.* ]]; then
GITHUB_REPOSITORY="$2"
if [ -n "$2" ] && ! [[ $2 =~ ^--.* ]]; then
DOCKER_REPOSITORY="$2"
shift
else
DOCKER_REPOSITORY=""
fi
;;
*)
@@ -51,9 +54,9 @@ mkdir -p build
docker buildx \
build \
--build-arg GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
--build-arg DOCKER_REPOSITORY=$DOCKER_REPOSITORY \
--build-arg DEEPSPEED_VERSION=$DEEPSPEED_VERSION \
-t ${GITHUB_REPOSITORY}alltalk_deepspeed:${DOCKER_TAG} \
-t ${DOCKER_REPOSITORY}alltalk_deepspeed:${DOCKER_TAG} \
.
docker run \
@@ -63,4 +66,4 @@ docker run \
--name deepspeed \
--build-arg DOCKER_TAG=$DOCKER_TAG \
-v $SCRIPT_DIR/build:/deepspeed \
${GITHUB_REPOSITORY}alltalk_deepspeed:${DOCKER_TAG}
${DOCKER_REPOSITORY}alltalk_deepspeed:${DOCKER_TAG}
-1
View File
@@ -5,7 +5,6 @@ ALLTALK_VARS["CUDA_VERSION"]=12.6.0
ALLTALK_VARS["PYTHON_VERSION"]=3.11.11
ALLTALK_VARS["DEEPSPEED_VERSION"]=0.16.2
ALLTALK_VARS["ALLTALK_DIR"]=/opt/alltalk
ALLTALK_VARS["GITHUB_REPOSITORY"]=
# Export single variables (needed by Docker locally)
for key in "${!ALLTALK_VARS[@]}"