mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-08-24 13:39:48 +08:00
Update Docker & Pre-Commit
This commit is contained in:
parent
4c4a84f63a
commit
e086862595
184
.github/workflows/docker-publish.yaml
vendored
184
.github/workflows/docker-publish.yaml
vendored
@ -5,7 +5,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
generate-meta:
|
generate-meta:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
outputs:
|
outputs:
|
||||||
tag: ${{ steps.meta.outputs.tag }}
|
tag: ${{ steps.meta.outputs.tag }}
|
||||||
steps:
|
steps:
|
||||||
@ -18,24 +18,27 @@ jobs:
|
|||||||
DATE=$(date +'%Y%m%d')
|
DATE=$(date +'%Y%m%d')
|
||||||
COMMIT=$(git rev-parse --short=6 HEAD)
|
COMMIT=$(git rev-parse --short=6 HEAD)
|
||||||
echo "tag=${DATE}-${COMMIT}" >> $GITHUB_OUTPUT
|
echo "tag=${DATE}-${COMMIT}" >> $GITHUB_OUTPUT
|
||||||
|
build-amd64:
|
||||||
build-and-push:
|
|
||||||
needs: generate-meta
|
needs: generate-meta
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- cuda_version: 12.4
|
- cuda_version: 124
|
||||||
lite: true
|
lite: true
|
||||||
|
cuda_base: runtime
|
||||||
tag_prefix: cu124-lite
|
tag_prefix: cu124-lite
|
||||||
- cuda_version: 12.4
|
- cuda_version: 124
|
||||||
lite: false
|
lite: false
|
||||||
|
cuda_base: devel
|
||||||
tag_prefix: cu124
|
tag_prefix: cu124
|
||||||
- cuda_version: 12.8
|
- cuda_version: 128
|
||||||
lite: true
|
lite: true
|
||||||
|
cuda_base: runtime
|
||||||
tag_prefix: cu128-lite
|
tag_prefix: cu128-lite
|
||||||
- cuda_version: 12.8
|
- cuda_version: 128
|
||||||
lite: false
|
lite: false
|
||||||
|
cuda_base: devel
|
||||||
tag_prefix: cu128
|
tag_prefix: cu128
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -73,7 +76,6 @@ jobs:
|
|||||||
sudo rm -rf /usr/share/miniconda
|
sudo rm -rf /usr/share/miniconda
|
||||||
sudo rm -rf /usr/share/az_12.1.0
|
sudo rm -rf /usr/share/az_12.1.0
|
||||||
sudo rm -rf /usr/share/dotnet
|
sudo rm -rf /usr/share/dotnet
|
||||||
|
|
||||||
|
|
||||||
echo "After cleanup:"
|
echo "After cleanup:"
|
||||||
df -h
|
df -h
|
||||||
@ -87,19 +89,169 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||||
|
|
||||||
- name: Build and Push Docker Image
|
- name: Build and Push Docker Image (amd64)
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: false
|
push: true
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64
|
||||||
build-args: |
|
build-args: |
|
||||||
LITE=${{ matrix.lite }}
|
LITE=${{ matrix.lite }}
|
||||||
|
CUDA_BASE=${{ matrix.cuda_base }}
|
||||||
CUDA_VERSION=${{ matrix.cuda_version }}
|
CUDA_VERSION=${{ matrix.cuda_version }}
|
||||||
WORKFLOW=true
|
WORKFLOW=true
|
||||||
tags: |
|
tags: |
|
||||||
xxxxrt666/gpt-sovits:${{ matrix.tag_prefix }}-${{ needs.generate-meta.outputs.tag }}
|
xxxxrt666/gpt-sovits:${{ matrix.tag_prefix }}-${{ needs.generate-meta.outputs.tag }}-amd64
|
||||||
xxxxrt666/gpt-sovits:latest-${{ matrix.tag_prefix }}
|
xxxxrt666/gpt-sovits:latest-${{ matrix.tag_prefix }}-amd64
|
||||||
cache-from: type=gha
|
|
||||||
# cache-to: type=gha,mode=max
|
build-arm64:
|
||||||
|
needs: generate-meta
|
||||||
|
runs-on: ubuntu-22.04-arm
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- cuda_version: 124
|
||||||
|
lite: true
|
||||||
|
cuda_base: runtime
|
||||||
|
tag_prefix: cu124-lite
|
||||||
|
- cuda_version: 124
|
||||||
|
lite: false
|
||||||
|
cuda_base: devel
|
||||||
|
tag_prefix: cu124
|
||||||
|
- cuda_version: 128
|
||||||
|
lite: true
|
||||||
|
cuda_base: runtime
|
||||||
|
tag_prefix: cu128-lite
|
||||||
|
- cuda_version: 128
|
||||||
|
lite: false
|
||||||
|
cuda_base: devel
|
||||||
|
tag_prefix: cu128
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Free up disk space
|
||||||
|
run: |
|
||||||
|
echo "Before cleanup:"
|
||||||
|
df -h
|
||||||
|
|
||||||
|
sudo rm -rf /opt/ghc
|
||||||
|
sudo rm -rf /opt/hostedtoolcache/CodeQL
|
||||||
|
sudo rm -rf /opt/hostedtoolcache/PyPy
|
||||||
|
sudo rm -rf /opt/hostedtoolcache/go
|
||||||
|
sudo rm -rf /opt/hostedtoolcache/node
|
||||||
|
sudo rm -rf /opt/hostedtoolcache/Ruby
|
||||||
|
sudo rm -rf /opt/microsoft
|
||||||
|
sudo rm -rf /opt/pipx
|
||||||
|
sudo rm -rf /opt/az
|
||||||
|
sudo rm -rf /opt/google
|
||||||
|
|
||||||
|
|
||||||
|
sudo rm -rf /usr/lib/jvm
|
||||||
|
sudo rm -rf /usr/lib/google-cloud-sdk
|
||||||
|
sudo rm -rf /usr/lib/dotnet
|
||||||
|
|
||||||
|
sudo rm -rf /usr/local/lib/android
|
||||||
|
sudo rm -rf /usr/local/.ghcup
|
||||||
|
sudo rm -rf /usr/local/julia1.11.5
|
||||||
|
sudo rm -rf /usr/local/share/powershell
|
||||||
|
sudo rm -rf /usr/local/share/chromium
|
||||||
|
|
||||||
|
sudo rm -rf /usr/share/swift
|
||||||
|
sudo rm -rf /usr/share/miniconda
|
||||||
|
sudo rm -rf /usr/share/az_12.1.0
|
||||||
|
sudo rm -rf /usr/share/dotnet
|
||||||
|
|
||||||
|
echo "After cleanup:"
|
||||||
|
df -h
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and Push Docker Image (arm64)
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
platforms: linux/arm64
|
||||||
|
build-args: |
|
||||||
|
LITE=${{ matrix.lite }}
|
||||||
|
CUDA_BASE=${{ matrix.cuda_base }}
|
||||||
|
CUDA_VERSION=${{ matrix.cuda_version }}
|
||||||
|
WORKFLOW=true
|
||||||
|
tags: |
|
||||||
|
xxxxrt666/gpt-sovits:${{ matrix.tag_prefix }}-${{ needs.generate-meta.outputs.tag }}-arm64
|
||||||
|
xxxxrt666/gpt-sovits:latest-${{ matrix.tag_prefix }}-arm64
|
||||||
|
|
||||||
|
|
||||||
|
merge-and-clean:
|
||||||
|
needs:
|
||||||
|
- build-amd64
|
||||||
|
- build-arm64
|
||||||
|
- generate-meta
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- tag_prefix: cu124-lite
|
||||||
|
- tag_prefix: cu124
|
||||||
|
- tag_prefix: cu128-lite
|
||||||
|
- tag_prefix: cu128
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Merge amd64 and arm64 into multi-arch image
|
||||||
|
run: |
|
||||||
|
DATE_TAG=${{ needs.generate-meta.outputs.tag }}
|
||||||
|
TAG_PREFIX=${{ matrix.tag_prefix }}
|
||||||
|
|
||||||
|
docker buildx imagetools create \
|
||||||
|
--tag ${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:${TAG_PREFIX}-${DATE_TAG} \
|
||||||
|
${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:${TAG_PREFIX}-${DATE_TAG}-amd64 \
|
||||||
|
${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:${TAG_PREFIX}-${DATE_TAG}-arm64
|
||||||
|
|
||||||
|
docker buildx imagetools create \
|
||||||
|
--tag ${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest-${TAG_PREFIX} \
|
||||||
|
${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest-${TAG_PREFIX}-amd64 \
|
||||||
|
${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest-${TAG_PREFIX}-arm64
|
||||||
|
|
||||||
|
- name: Delete old platform-specific tags via Docker Hub API
|
||||||
|
env:
|
||||||
|
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||||
|
TAG_PREFIX: ${{ matrix.tag_prefix }}
|
||||||
|
DATE_TAG: ${{ needs.generate-meta.outputs.tag }}
|
||||||
|
run: |
|
||||||
|
sudo apt-get update && sudo apt-get install -y jq
|
||||||
|
|
||||||
|
TOKEN=$(curl -s -u $DOCKER_HUB_USERNAME:$DOCKER_HUB_TOKEN" \
|
||||||
|
"https://auth.docker.io/token?service=registry.docker.io&scope=repository:xxxxrt666/gpt-sovits:pull,push,delete" \
|
||||||
|
| jq -r .token)
|
||||||
|
|
||||||
|
for PLATFORM in amd64 arm64; do
|
||||||
|
SAFE_PLATFORM=$(echo $PLATFORM | sed 's/\//-/g')
|
||||||
|
TAG="${TAG_PREFIX}-${DATE_TAG}-${SAFE_PLATFORM}"
|
||||||
|
LATEST_TAG="latest-${TAG_PREFIX}-${SAFE_PLATFORM}"
|
||||||
|
|
||||||
|
for DEL_TAG in "$TAG" "$LATEST_TAG"; do
|
||||||
|
echo "Deleting tag: $DEL_TAG"
|
||||||
|
curl -X DELETE -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/$DOCKER_HUB_USERNAME/gpt-sovits/manifests/$DEL_TAG
|
||||||
|
done
|
||||||
|
done
|
@ -12,7 +12,7 @@ repos:
|
|||||||
# Run the formatter.
|
# Run the formatter.
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
types_or: [ python, pyi ]
|
types_or: [ python, pyi ]
|
||||||
args: [ --line-length=120, --target-version py310 ]
|
args: [ --line-length, "120", --target-version, "py310" ]
|
||||||
|
|
||||||
- repo: https://github.com/codespell-project/codespell
|
- repo: https://github.com/codespell-project/codespell
|
||||||
rev: v2.4.1
|
rev: v2.4.1
|
||||||
|
@ -8,6 +8,10 @@ cd "$SCRIPT_DIR" || exit 1
|
|||||||
|
|
||||||
cd .. || exit 1
|
cd .. || exit 1
|
||||||
|
|
||||||
|
if [ -d "$HOME/anaconda3" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
WORKFLOW=${WORKFLOW:-"false"}
|
WORKFLOW=${WORKFLOW:-"false"}
|
||||||
TARGETPLATFORM=${TARGETPLATFORM:-"linux/amd64"}
|
TARGETPLATFORM=${TARGETPLATFORM:-"linux/amd64"}
|
||||||
|
|
||||||
@ -47,6 +51,8 @@ source "$HOME/anaconda3/etc/profile.d/conda.sh"
|
|||||||
|
|
||||||
"$HOME/anaconda3/bin/conda" install python=3.11 -q -y
|
"$HOME/anaconda3/bin/conda" install python=3.11 -q -y
|
||||||
|
|
||||||
|
"$HOME/anaconda3/bin/conda" install gcc=14 gxx ffmpeg cmake make unzip -q -y
|
||||||
|
|
||||||
rm $LOG_PATH
|
rm $LOG_PATH
|
||||||
|
|
||||||
rm -rf "$HOME/anaconda3/pkgs"
|
rm -rf "$HOME/anaconda3/pkgs"
|
||||||
|
@ -48,16 +48,16 @@ fi
|
|||||||
|
|
||||||
source "$HOME/anaconda3/etc/profile.d/conda.sh"
|
source "$HOME/anaconda3/etc/profile.d/conda.sh"
|
||||||
|
|
||||||
if [ "$CUDA_VERSION" = 12.8 ]; then
|
if [ "$CUDA_VERSION" = 128 ]; then
|
||||||
pip install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128
|
pip install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128
|
||||||
elif [ "$CUDA_VERSION" = 12.4 ]; then
|
elif [ "$CUDA_VERSION" = 124 ]; then
|
||||||
pip install torch==2.5.1 torchaudio==2.5.1 --no-cache-dir --index-url https://download.pytorch.org/whl/cu124
|
pip install torch==2.5.1 torchaudio==2.5.1 --no-cache-dir --index-url https://download.pytorch.org/whl/cu124
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$LITE" = "true" ]; then
|
if [ "$LITE" = "true" ]; then
|
||||||
bash install.sh --device "CU${CUDA_VERSION//./}" --source HF
|
bash install.sh --device "CU${CUDA_VERSION}" --source HF
|
||||||
elif [ "$LITE" = "false" ]; then
|
elif [ "$LITE" = "false" ]; then
|
||||||
bash install.sh --device "CU${CUDA_VERSION//./}" --source HF --download-uvr5
|
bash install.sh --device "CU${CUDA_VERSION}" --source HF --download-uvr5
|
||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
21
Dockerfile
21
Dockerfile
@ -1,7 +1,7 @@
|
|||||||
ARG CUDA_VERSION=12.4
|
ARG CUDA_VERSION=124
|
||||||
ARG CUDA_BASE=runtime
|
ARG CUDA_BASE=runtime
|
||||||
|
|
||||||
FROM nvidia/cuda:${CUDA_VERSION}.1-cudnn-${CUDA_BASE}-ubuntu22.04
|
FROM xxxxrt666/gpt-sovits:latest-cu{CUDA_VERSION}-${CUDA_BASE}-base
|
||||||
|
|
||||||
LABEL maintainer="XXXXRT"
|
LABEL maintainer="XXXXRT"
|
||||||
LABEL version="V4-0501"
|
LABEL version="V4-0501"
|
||||||
@ -11,23 +11,6 @@ ARG CUDA_VERSION=12.4
|
|||||||
|
|
||||||
ENV CUDA_VERSION=${CUDA_VERSION}
|
ENV CUDA_VERSION=${CUDA_VERSION}
|
||||||
|
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq 1>/dev/null && \
|
|
||||||
apt-get install -y -qq --no-install-recommends \
|
|
||||||
build-essential \
|
|
||||||
gcc \
|
|
||||||
g++ \
|
|
||||||
wget \
|
|
||||||
curl \
|
|
||||||
unzip \
|
|
||||||
git \
|
|
||||||
nano \
|
|
||||||
htop \
|
|
||||||
procps \
|
|
||||||
ca-certificates \
|
|
||||||
locales \
|
|
||||||
1>/dev/null \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
WORKDIR /workspace/GPT-SoVITS
|
WORKDIR /workspace/GPT-SoVITS
|
||||||
|
|
||||||
COPY . /workspace/GPT-SoVITS
|
COPY . /workspace/GPT-SoVITS
|
||||||
|
@ -40,10 +40,10 @@ while [[ $# -gt 0 ]]; do
|
|||||||
--cuda)
|
--cuda)
|
||||||
case "$2" in
|
case "$2" in
|
||||||
12.4)
|
12.4)
|
||||||
CUDA_VERSION=12.4
|
CUDA_VERSION=124
|
||||||
;;
|
;;
|
||||||
12.8)
|
12.8)
|
||||||
CUDA_VERSION=12.8
|
CUDA_VERSION=128
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Error: Invalid CUDA_VERSION: $2"
|
echo "Error: Invalid CUDA_VERSION: $2"
|
||||||
|
@ -229,10 +229,8 @@ fi
|
|||||||
if [ "$USE_CUDA" = true ] && [ "$WORKFLOW" = false ]; then
|
if [ "$USE_CUDA" = true ] && [ "$WORKFLOW" = false ]; then
|
||||||
echo "Installing PyTorch with CUDA support..."
|
echo "Installing PyTorch with CUDA support..."
|
||||||
if [ "$CUDA" = 128 ]; then
|
if [ "$CUDA" = 128 ]; then
|
||||||
echo 11111
|
|
||||||
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128
|
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128
|
||||||
elif [ "$CUDA" = 124 ]; then
|
elif [ "$CUDA" = 124 ]; then
|
||||||
echo 22222
|
|
||||||
pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124
|
pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124
|
||||||
fi
|
fi
|
||||||
elif [ "$USE_ROCM" = true ] && [ "$WORKFLOW" = false ]; then
|
elif [ "$USE_ROCM" = true ] && [ "$WORKFLOW" = false ]; then
|
||||||
@ -241,6 +239,9 @@ elif [ "$USE_ROCM" = true ] && [ "$WORKFLOW" = false ]; then
|
|||||||
elif [ "$USE_CPU" = true ] && [ "$WORKFLOW" = false ]; then
|
elif [ "$USE_CPU" = true ] && [ "$WORKFLOW" = false ]; then
|
||||||
echo "Installing PyTorch for CPU..."
|
echo "Installing PyTorch for CPU..."
|
||||||
pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cpu
|
pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cpu
|
||||||
|
elif [ "$WORKFLOW" = false ]; then
|
||||||
|
echo "Unknown Err"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing Python dependencies from requirements.txt..."
|
echo "Installing Python dependencies from requirements.txt..."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user