From 4f12b78ecdcc5d462ef409ca403b8389a419a591 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 18:09:54 +0100 Subject: [PATCH 001/183] Docker Auto-Build Workflow --- .dockerignore | 201 ++++++++++++++++++++++++++- .github/workflows/docker-publish.yml | 60 ++++++++ .gitignore | 9 +- Docker/damo.sha256 | 3 - Docker/download.py | 8 -- Docker/download.sh | 11 -- Docker/links.sha256 | 12 -- Docker/links.txt | 34 ----- Dockerfile | 95 +++++++++---- docker-compose.yaml | 61 +++++--- docker_build.sh | 82 +++++++++++ dockerbuild.sh | 21 --- 12 files changed, 442 insertions(+), 155 deletions(-) create mode 100644 .github/workflows/docker-publish.yml delete mode 100644 Docker/damo.sha256 delete mode 100644 Docker/download.py delete mode 100644 Docker/download.sh delete mode 100644 Docker/links.sha256 delete mode 100644 Docker/links.txt create mode 100644 docker_build.sh delete mode 100755 dockerbuild.sh diff --git a/.dockerignore b/.dockerignore index 4eca27be..8c73069b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,8 +1,197 @@ -docs -logs +GPT_SoVITS/pretrained_models/* +tools/asr/models/* +tools/uvr5/uvr5_weights/* + +.DS_Store +.vscode +*.pyc +env +runtime +.idea output -reference -SoVITS_weights -GPT_weights +logs +SoVITS_weights*/ +GPT_weights*/ TEMP -.git +weight.json +ffmpeg* +ffprobe* +cfg.json +speakers.json +ref_audios + +# Byte-compiled / optimized / DLL files +__pycache__/ +**/__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +Pipfile.lock + +# UV +# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +uv.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +.idea/ + +# Ruff stuff: +.ruff_cache/ + +# PyPI configuration file +.pypirc diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 00000000..eef763cf --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,60 @@ +name: Build and Publish Docker Image + +on: + workflow_dispatch: + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - 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: Generate Tag + id: meta + run: | + DATE=$(date +'%Y%m%d') + COMMIT=$(git rev-parse --short=6 HEAD) + echo "::set-output name=tag::${DATE}-${COMMIT}" + + - name: Build and Push Lite Docker Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + build-args: | + USE_FUNASR=true + USE_FASTERWHISPER=false + CUDA_VERSION=12.4 + tags: | + xxxxrt666/gpt-sovits:lite-cu124-${{ steps.meta.outputs.tag }} + xxxxrt666/gpt-sovits:latest-lite + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + build-args: | + USE_FUNASR=true + USE_FASTERWHISPER=true + CUDA_VERSION=12.4 + tags: | + xxxxrt666/gpt-sovits:cu124-${{ steps.meta.outputs.tag }} + xxxxrt666/gpt-sovits:latest + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0bb4e0bf..d280e459 100644 --- a/.gitignore +++ b/.gitignore @@ -7,13 +7,8 @@ runtime .idea output logs -reference -GPT_weights -SoVITS_weights -GPT_weights_v2 -SoVITS_weights_v2 -GPT_weights_v3 -SoVITS_weights_v3 +SoVITS_weights*/ +GPT_weights*/ TEMP weight.json ffmpeg* diff --git a/Docker/damo.sha256 b/Docker/damo.sha256 deleted file mode 100644 index 6e9804da..00000000 --- a/Docker/damo.sha256 +++ /dev/null @@ -1,3 +0,0 @@ -5bba782a5e9196166233b9ab12ba04cadff9ef9212b4ff6153ed9290ff679025 /workspace/tools/damo_asr/models/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/model.pb -b3be75be477f0780277f3bae0fe489f48718f585f3a6e45d7dd1fbb1a4255fc5 /workspace/tools/damo_asr/models/speech_fsmn_vad_zh-cn-16k-common-pytorch/model.pb -a5818bb9d933805a916eebe41eb41648f7f9caad30b4bd59d56f3ca135421916 /workspace/tools/damo_asr/models/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/model.pb \ No newline at end of file diff --git a/Docker/download.py b/Docker/download.py deleted file mode 100644 index 952423d1..00000000 --- a/Docker/download.py +++ /dev/null @@ -1,8 +0,0 @@ -# Download moda ASR related models -from modelscope import snapshot_download - -model_dir = snapshot_download( - "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", revision="v2.0.4" -) -model_dir = snapshot_download("damo/speech_fsmn_vad_zh-cn-16k-common-pytorch", revision="v2.0.4") -model_dir = snapshot_download("damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch", revision="v2.0.4") diff --git a/Docker/download.sh b/Docker/download.sh deleted file mode 100644 index 447e018e..00000000 --- a/Docker/download.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -Eeuo pipefail - -echo "Downloading models..." - -aria2c --disable-ipv6 --input-file /workspace/Docker/links.txt --dir /workspace --continue - -echo "Checking SHA256..." - -parallel --will-cite -a /workspace/Docker/links.sha256 "echo -n {} | sha256sum -c" diff --git a/Docker/links.sha256 b/Docker/links.sha256 deleted file mode 100644 index cda6dc15..00000000 --- a/Docker/links.sha256 +++ /dev/null @@ -1,12 +0,0 @@ -b1c1e17e9c99547a89388f72048cd6e1b41b5a18b170e86a46dfde0324d63eb1 /workspace/GPT_SoVITS/pretrained_models/s1bert25hz-2kh-longer-epoch=68e-step=50232.ckpt -fc579c1db3c1e21b721001cf99d7a584214280df19b002e200b630a34fa06eb8 /workspace/GPT_SoVITS/pretrained_models/s2D488k.pth -020a014e1e01e550e510f2f61fae5e5f5b6aab40f15c22f1f12f724df507e835 /workspace/GPT_SoVITS/pretrained_models/s2G488k.pth -24164f129c66499d1346e2aa55f183250c223161ec2770c0da3d3b08cf432d3c /workspace/GPT_SoVITS/pretrained_models/chinese-hubert-base/pytorch_model.bin -e53a693acc59ace251d143d068096ae0d7b79e4b1b503fa84c9dcf576448c1d8 /workspace/GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large/pytorch_model.bin -39796caa5db18d7f9382d8ac997ac967bfd85f7761014bb807d2543cc844ef05 /workspace/tools/uvr5/uvr5_weights/HP2_all_vocals.pth -45e6b65199e781b4a6542002699be9f19cd3d1cb7d1558bc2bfbcd84674dfe28 /workspace/tools/uvr5/uvr5_weights/HP3_all_vocals.pth -5908891829634926119720241e8573d97cbeb8277110a7512bdb0bd7563258ee /workspace/tools/uvr5/uvr5_weights/HP5_only_main_vocal.pth -8c8fd1582f9aabc363e47af62ddb88df6cae7e064cae75bbf041a067a5e0aee2 /workspace/tools/uvr5/uvr5_weights/VR-DeEchoAggressive.pth -01376dd2a571bf3cb9cced680732726d2d732609d09216a610b0d110f133febe /workspace/tools/uvr5/uvr5_weights/VR-DeEchoDeReverb.pth -56aba59db3bcdd14a14464e62f3129698ecdea62eee0f003b9360923eb3ac79e /workspace/tools/uvr5/uvr5_weights/VR-DeEchoNormal.pth -233bb5c6aaa365e568659a0a81211746fa881f8f47f82d9e864fce1f7692db80 /workspace/tools/uvr5/uvr5_weights/onnx_dereverb_By_FoxJoy/vocals.onnx \ No newline at end of file diff --git a/Docker/links.txt b/Docker/links.txt deleted file mode 100644 index e6603db0..00000000 --- a/Docker/links.txt +++ /dev/null @@ -1,34 +0,0 @@ -# GPT-SoVITS models -https://huggingface.co/lj1995/GPT-SoVITS/resolve/main/s1bert25hz-2kh-longer-epoch%3D68e-step%3D50232.ckpt - out=GPT_SoVITS/pretrained_models/s1bert25hz-2kh-longer-epoch=68e-step=50232.ckpt -https://huggingface.co/lj1995/GPT-SoVITS/resolve/main/s2D488k.pth - out=GPT_SoVITS/pretrained_models/s2D488k.pth -https://huggingface.co/lj1995/GPT-SoVITS/resolve/main/s2G488k.pth - out=GPT_SoVITS/pretrained_models/s2G488k.pth -https://huggingface.co/lj1995/GPT-SoVITS/resolve/main/chinese-hubert-base/config.json - out=GPT_SoVITS/pretrained_models/chinese-hubert-base/config.json -https://huggingface.co/lj1995/GPT-SoVITS/resolve/main/chinese-hubert-base/preprocessor_config.json - out=GPT_SoVITS/pretrained_models/chinese-hubert-base/preprocessor_config.json -https://huggingface.co/lj1995/GPT-SoVITS/resolve/main/chinese-hubert-base/pytorch_model.bin - out=GPT_SoVITS/pretrained_models/chinese-hubert-base/pytorch_model.bin -https://huggingface.co/lj1995/GPT-SoVITS/resolve/main/chinese-roberta-wwm-ext-large/config.json - out=GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large/config.json -https://huggingface.co/lj1995/GPT-SoVITS/resolve/main/chinese-roberta-wwm-ext-large/pytorch_model.bin - out=GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large/pytorch_model.bin -https://huggingface.co/lj1995/GPT-SoVITS/resolve/main/chinese-roberta-wwm-ext-large/tokenizer.json - out=GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large/tokenizer.json -# UVR5 -https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP2_all_vocals.pth - out=tools/uvr5/uvr5_weights/HP2_all_vocals.pth -https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP3_all_vocals.pth - out=tools/uvr5/uvr5_weights/HP3_all_vocals.pth -https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP5_only_main_vocal.pth - out=tools/uvr5/uvr5_weights/HP5_only_main_vocal.pth -https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/VR-DeEchoAggressive.pth - out=tools/uvr5/uvr5_weights/VR-DeEchoAggressive.pth -https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/VR-DeEchoDeReverb.pth - out=tools/uvr5/uvr5_weights/VR-DeEchoDeReverb.pth -https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/VR-DeEchoNormal.pth - out=tools/uvr5/uvr5_weights/VR-DeEchoNormal.pth -https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/onnx_dereverb_By_FoxJoy/vocals.onnx - out=tools/uvr5/uvr5_weights/onnx_dereverb_By_FoxJoy/vocals.onnx \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 80cd9f3a..5637c38b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,77 @@ -# Base CUDA image -FROM cnstark/pytorch:2.0.1-py3.9.17-cuda11.8.0-ubuntu20.04 +ARG CUDA_VERSION=12.4 -LABEL maintainer="breakstring@hotmail.com" -LABEL version="dev-20240209" +FROM nvidia/cuda:${CUDA_VERSION}.1-cudnn-devel-ubuntu22.04 + +LABEL maintainer="XXXXRT" +LABEL version="V4-0429" LABEL description="Docker image for GPT-SoVITS" +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + gcc \ + g++ \ + wget \ + curl \ + bzip2 \ + unzip \ + git \ + vim \ + htop \ + procps \ + ca-certificates \ + locales \ + net-tools \ + iputils-ping \ + && rm -rf /var/lib/apt/lists/* -# Install 3rd party apps -ENV DEBIAN_FRONTEND=noninteractive -ENV TZ=Etc/UTC -RUN apt-get update && \ - apt-get install -y --no-install-recommends tzdata ffmpeg libsox-dev parallel aria2 git git-lfs && \ - git lfs install && \ - rm -rf /var/lib/apt/lists/* +WORKDIR /workspace/GPT-SoVITS -# Copy only requirements.txt initially to leverage Docker cache -WORKDIR /workspace -COPY requirements.txt /workspace/ -RUN pip install --no-cache-dir -r requirements.txt +COPY . /workspace/GPT-SoVITS -# Define a build-time argument for image type -ARG IMAGE_TYPE=full +RUN wget --tries=25 --wait=3 --read-timeout=40 -O anaconda.sh "https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ + bash anaconda.sh -b -p /root/anaconda3 && \ + rm anaconda.sh -# Conditional logic based on the IMAGE_TYPE argument -# Always copy the Docker directory, but only use it if IMAGE_TYPE is not "elite" -COPY ./Docker /workspace/Docker -# elite 类型的镜像里面不包含额外的模型 -RUN if [ "$IMAGE_TYPE" != "elite" ]; then \ - chmod +x /workspace/Docker/download.sh && \ - /workspace/Docker/download.sh && \ - python /workspace/Docker/download.py && \ - python -m nltk.downloader averaged_perceptron_tagger cmudict; \ - fi +ARG USE_FUNASR=false +ARG USE_FASTERWHISPER=false +RUN if [ "$USE_FUNASR" = "true" ]; then \ + echo "Downloading funasr..." && \ + wget --tries=25 --wait=3 --read-timeout=40 "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/funasr.zip" && \ + unzip funasr.zip -d tools/asr/models/ && \ + rm -rf funasr.zip ; \ + else \ + echo "Skipping funasr download" ; \ + fi -# Copy the rest of the application -COPY . /workspace +RUN if [ "$USE_FASTERWHISPER" = "true" ]; then \ + echo "Downloading faster-whisper..." && \ + wget --tries=25 --wait=3 --read-timeout=40 "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/faster-whisper.zip" && \ + unzip faster-whisper.zip -d tools/asr/models/ && \ + rm -rf faster-whisper.zip ; \ + else \ + echo "Skipping faster-whisper download" ; \ + fi + +ENV PATH="/root/anaconda3/bin:$PATH" + +SHELL ["/bin/bash", "-c"] + +RUN conda create -n GPTSoVITS python=3.10 -y + +ENV PATH="/usr/local/cuda/bin:$PATH" +ENV CUDA_HOME="/usr/local/cuda" +ENV MAKEFLAGS="-j$(nproc)" + +RUN source /root/anaconda3/etc/profile.d/conda.sh && \ + conda activate GPTSoVITS && \ + bash /workspace/install.sh --source HF --download-uvr5 && \ + pip cache purge + +RUN rm -rf /root/anaconda3/pkgs EXPOSE 9871 9872 9873 9874 9880 -CMD ["python", "webui.py"] +WORKDIR /workspace/GPT-SoVITS + +CMD ["/bin/bash", "-c", "source /root/anaconda3/etc/profile.d/conda.sh && conda activate GPTSoVITS && export PYTHONPATH=$(pwd) && exec bash"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index aca8ab9e..649db4f3 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,32 +1,47 @@ -version: '3.8' +version: "3.8" services: - gpt-sovits: - image: breakstring/gpt-sovits:latest # please change the image name and tag base your environment. If the tag contains the word 'elite', such as "latest-elite", it indicates that the image does not include the necessary models such as GPT-SoVITS, UVR5, Damo ASR, etc. You will need to download them yourself and map them into the container. - container_name: gpt-sovits-container - environment: - - is_half=False - - is_share=False - volumes: - - ./output:/workspace/output - - ./logs:/workspace/logs - - ./SoVITS_weights:/workspace/SoVITS_weights - - ./reference:/workspace/reference - working_dir: /workspace + GPT-SoVITS: + image: xxxxrt666/gpt-sovits:latest + container_name: GPT-SoVITS ports: - - "9880:9880" - "9871:9871" - "9872:9872" - "9873:9873" - "9874:9874" - shm_size: 16G - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: "all" - capabilities: [gpu] - stdin_open: true + - "9880:9880" + volumes: + - .:/workspace/GPT-SoVITS + - /workspace/GPT-SoVITS/pretrained_models + - /workspace/tools/asr/models + - /workspace/tools/uvr5/uvr5_weights + environment: + - PYTHONPATH=/workspace/GPT-SoVITS + - is_half=true tty: true + stdin_open: true + shm_size: "16g" restart: unless-stopped + runtime: nvidia + GPT-SoVITS-Lite: + image: xxxxrt666/gpt-sovits:latest-lite + container_name: GPT-SoVITS-Lite + ports: + - "9871:9871" + - "9872:9872" + - "9873:9873" + - "9874:9874" + - "9880:9880" + volumes: + - .:/workspace/GPT-SoVITS + - /workspace/GPT-SoVITS/pretrained_models + - /workspace/tools/asr/models + - /workspace/tools/uvr5/uvr5_weights + environment: + - PYTHONPATH=/workspace/GPT-SoVITS + - is_half=true + tty: true + stdin_open: true + shm_size: "16g" + restart: unless-stopped + runtime: nvidia \ No newline at end of file diff --git a/docker_build.sh b/docker_build.sh new file mode 100644 index 00000000..212c8d1b --- /dev/null +++ b/docker_build.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" + +cd "$SCRIPT_DIR" || exit 1 + +set -e + +if ! command -v docker &>/dev/null; then + echo "Docker Not Found" + exit 1 +fi + +trap 'echo "Error Occured at \"$BASH_COMMAND\" with exit code $?"; exit 1' ERR + +USE_FUNASR=false +USE_FASTERWHISPER=false +CUDA_VERSION=12.4 + +print_help() { + echo "Usage: bash docker_build.sh [OPTIONS]" + echo "" + echo "Options:" + echo " --cuda 12.4|12.8 Specify the CUDA VERSION (REQUIRED)" + echo " --funasr Build with FunASR Paraformer Model" + echo " --faster-whisper Build with Faster-Whisper-Large-V3 Model" + echo " -h, --help Show this help message and exit" + echo "" + echo "Examples:" + echo " bash docker_build.sh --cuda 12.4 --funasr --faster-whisper" +} + +# Show help if no arguments provided +if [[ $# -eq 0 ]]; then + print_help + exit 0 +fi + +# Parse arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --cuda) + case "$2" in + 12.1) + CUDA_VERSION=12.1 + ;; + 12.4) + CUDA_VERSION=12.4 + ;; + 12.8) + CUDA_VERSION=12.8 + ;; + *) + echo "Error: Invalid CUDA_VERSION: $2" + echo "Choose From: [12.1, 12.4, 12.8]" + exit 1 + ;; + esac + shift 2 + ;; + --funasr) + USE_FUNASR=true + shift + ;; + --faster-whisper) + USE_FASTERWHISPER=true + shift + ;; + *) + echo "Unknown Argument: $1" + echo "Use -h or --help to see available options." + exit 1 + ;; + esac +done + +docker build \ + --build-arg CUDA_VERSION=$CUDA_VERSION \ + --build-arg USE_FUNASR=$USE_FUNASR \ + --build-arg USE_FASTERWHISPER=$USE_FASTERWHISPER \ + -t "${USER}/gpt-sovits:local" \ + . diff --git a/dockerbuild.sh b/dockerbuild.sh deleted file mode 100755 index 3a4a1e18..00000000 --- a/dockerbuild.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# 获取当前日期,格式为 YYYYMMDD -DATE=$(date +%Y%m%d) -# 获取最新的 Git commit 哈希值的前 7 位 -COMMIT_HASH=$(git rev-parse HEAD | cut -c 1-7) - -# 构建 full 版本的镜像 -docker build --build-arg IMAGE_TYPE=full -t breakstring/gpt-sovits:latest . -# 为同一个镜像添加带日期的标签 -docker tag breakstring/gpt-sovits:latest breakstring/gpt-sovits:dev-$DATE -# 为同一个镜像添加带当前代码库Commit哈希值的标签 -docker tag breakstring/gpt-sovits:latest breakstring/gpt-sovits:dev-$COMMIT_HASH - - -# 构建 elite 版本的镜像(无模型下载步骤,需手工将模型下载安装进容器) -docker build --build-arg IMAGE_TYPE=elite -t breakstring/gpt-sovits:latest-elite . -# 为同一个镜像添加带日期的标签 -docker tag breakstring/gpt-sovits:latest-elite breakstring/gpt-sovits:dev-$DATE-elite -# 为同一个镜像添加带当前代码库Commit哈希值的标签 -docker tag breakstring/gpt-sovits:latest-elite breakstring/gpt-sovits:dev-$COMMIT_HASH-elite From d887460901f20d29f5c8bb8a7fcc03c48baeb0f4 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 18:14:39 +0100 Subject: [PATCH 002/183] Rename --- .github/workflows/{docker-publish.yml => docker-publish.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{docker-publish.yml => docker-publish.yaml} (100%) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yaml similarity index 100% rename from .github/workflows/docker-publish.yml rename to .github/workflows/docker-publish.yaml From 292e58708822b92890e1e100eefedd187f8d34af Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 18:24:40 +0100 Subject: [PATCH 003/183] Update --- .github/workflows/docker-publish.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index eef763cf..c6e68a5e 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -2,6 +2,9 @@ name: Build and Publish Docker Image on: workflow_dispatch: + push: + branches: + - Docker jobs: build-and-push: From b51b87b2d12167a67c9746c5685c880807696981 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 18:33:53 +0100 Subject: [PATCH 004/183] Fix Bugs --- .github/workflows/docker-publish.yaml | 5 +-- Dockerfile | 10 ++--- install.sh | 60 +++++++++++++-------------- 3 files changed, 35 insertions(+), 40 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index c6e68a5e..6aa93c32 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -2,9 +2,6 @@ name: Build and Publish Docker Image on: workflow_dispatch: - push: - branches: - - Docker jobs: build-and-push: @@ -28,7 +25,7 @@ jobs: run: | DATE=$(date +'%Y%m%d') COMMIT=$(git rev-parse --short=6 HEAD) - echo "::set-output name=tag::${DATE}-${COMMIT}" + echo "tag=${DATE}-${COMMIT}" >> $GITHUB_OUTPUT - name: Build and Push Lite Docker Image uses: docker/build-push-action@v5 diff --git a/Dockerfile b/Dockerfile index 5637c38b..9fb6e41a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ WORKDIR /workspace/GPT-SoVITS COPY . /workspace/GPT-SoVITS -RUN wget --tries=25 --wait=3 --read-timeout=40 -O anaconda.sh "https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ +RUN wget -nv --show-progress --tries=25 --wait=3 --read-timeout=40 -O anaconda.sh "https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ bash anaconda.sh -b -p /root/anaconda3 && \ rm anaconda.sh @@ -37,7 +37,7 @@ ARG USE_FASTERWHISPER=false RUN if [ "$USE_FUNASR" = "true" ]; then \ echo "Downloading funasr..." && \ - wget --tries=25 --wait=3 --read-timeout=40 "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/funasr.zip" && \ + wget -nv --show-progress --tries=25 --wait=3 --read-timeout=40 "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/funasr.zip" && \ unzip funasr.zip -d tools/asr/models/ && \ rm -rf funasr.zip ; \ else \ @@ -46,7 +46,7 @@ RUN if [ "$USE_FUNASR" = "true" ]; then \ RUN if [ "$USE_FASTERWHISPER" = "true" ]; then \ echo "Downloading faster-whisper..." && \ - wget --tries=25 --wait=3 --read-timeout=40 "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/faster-whisper.zip" && \ + wget -nv --show-progress --tries=25 --wait=3 --read-timeout=40 "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/faster-whisper.zip" && \ unzip faster-whisper.zip -d tools/asr/models/ && \ rm -rf faster-whisper.zip ; \ else \ @@ -65,13 +65,11 @@ ENV MAKEFLAGS="-j$(nproc)" RUN source /root/anaconda3/etc/profile.d/conda.sh && \ conda activate GPTSoVITS && \ - bash /workspace/install.sh --source HF --download-uvr5 && \ + bash install.sh --source HF --download-uvr5 && \ pip cache purge RUN rm -rf /root/anaconda3/pkgs EXPOSE 9871 9872 9873 9874 9880 -WORKDIR /workspace/GPT-SoVITS - CMD ["/bin/bash", "-c", "source /root/anaconda3/etc/profile.d/conda.sh && conda activate GPTSoVITS && export PYTHONPATH=$(pwd) && exec bash"] \ No newline at end of file diff --git a/install.sh b/install.sh index e45b91b1..598dff11 100644 --- a/install.sh +++ b/install.sh @@ -41,38 +41,38 @@ fi # Parse arguments while [[ $# -gt 0 ]]; do case "$1" in - --source) - case "$2" in - HF) - is_HF=true - ;; - HF-Mirror) - is_HF_MIRROR=true - ;; - ModelScope) - is_MODELSCOPE=true - ;; - *) - echo "Error: Invalid Download Source: $2" - echo "Choose From: [HF, HF-Mirror, ModelScope]" - exit 1 - ;; - esac - shift 2 + --source) + case "$2" in + HF) + is_HF=true ;; - --download-uvr5) - DOWNLOAD_UVR5=true - shift + HF-Mirror) + is_HF_MIRROR=true ;; - -h|--help) - print_help - exit 0 + ModelScope) + is_MODELSCOPE=true ;; *) - echo "Unknown Argument: $1" - echo "Use -h or --help to see available options." + echo "Error: Invalid Download Source: $2" + echo "Choose From: [HF, HF-Mirror, ModelScope]" exit 1 ;; + esac + shift 2 + ;; + --download-uvr5) + DOWNLOAD_UVR5=true + shift + ;; + -h | --help) + print_help + exit 0 + ;; + *) + echo "Unknown Argument: $1" + echo "Use -h or --help to see available options." + exit 1 + ;; esac done @@ -104,7 +104,7 @@ if find "GPT_SoVITS/pretrained_models" -mindepth 1 ! -name '.gitignore' | grep - echo "Pretrained Model Exists" else echo "Download Pretrained Models" - wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$PRETRINED_URL" + wget -nv --show-progress --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$PRETRINED_URL" unzip pretrained_models.zip rm -rf pretrained_models.zip @@ -114,7 +114,7 @@ fi if [ ! -d "GPT_SoVITS/text/G2PWModel" ]; then echo "Download G2PWModel" - wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$G2PW_URL" + wget -nv --show-progress --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$G2PW_URL" unzip G2PWModel.zip rm -rf G2PWModel.zip @@ -123,12 +123,12 @@ else echo "G2PWModel Exists" fi -if [ "$DOWNLOAD_UVR5" = "true" ];then +if [ "$DOWNLOAD_UVR5" = "true" ]; then if find "tools/uvr5/uvr5_weights" -mindepth 1 ! -name '.gitignore' | grep -q .; then echo "UVR5 Model Exists" else echo "Download UVR5 Model" - wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$UVR5_URL" + wget -nv --show-progress --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$UVR5_URL" unzip uvr5_weights.zip rm -rf uvr5_weights.zip From 15bc02489fb1893594773df698f7b652e9523a8c Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 19:10:56 +0100 Subject: [PATCH 005/183] Disable Progress Bar When workflows triggered --- .github/workflows/docker-publish.yaml | 4 +++- Dockerfile | 16 +++++++++++++--- install.sh | 12 +++++++++--- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 6aa93c32..ab335516 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -1,6 +1,6 @@ name: Build and Publish Docker Image -on: +on: workflow_dispatch: jobs: @@ -37,6 +37,7 @@ jobs: USE_FUNASR=true USE_FASTERWHISPER=false CUDA_VERSION=12.4 + WGET_SHOW_PROGRESS=0 tags: | xxxxrt666/gpt-sovits:lite-cu124-${{ steps.meta.outputs.tag }} xxxxrt666/gpt-sovits:latest-lite @@ -53,6 +54,7 @@ jobs: USE_FUNASR=true USE_FASTERWHISPER=true CUDA_VERSION=12.4 + WGET_SHOW_PROGRESS=0 tags: | xxxxrt666/gpt-sovits:cu124-${{ steps.meta.outputs.tag }} xxxxrt666/gpt-sovits:latest diff --git a/Dockerfile b/Dockerfile index 9fb6e41a..e037e787 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,17 @@ WORKDIR /workspace/GPT-SoVITS COPY . /workspace/GPT-SoVITS -RUN wget -nv --show-progress --tries=25 --wait=3 --read-timeout=40 -O anaconda.sh "https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ +ARG WGET_SHOW_PROGRESS=1 + +RUN if [ "$WGET_SHOW_PROGRESS" = "0" ]; then \ + echo 'WGET_CMD=wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404' >> /env.list; \ + else \ + echo 'WGET_CMD=wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404' >> /env.list; \ + fi + +ENV $(cat /env.list) + +RUN $WGET_CMD -O anaconda.sh "https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ bash anaconda.sh -b -p /root/anaconda3 && \ rm anaconda.sh @@ -37,7 +47,7 @@ ARG USE_FASTERWHISPER=false RUN if [ "$USE_FUNASR" = "true" ]; then \ echo "Downloading funasr..." && \ - wget -nv --show-progress --tries=25 --wait=3 --read-timeout=40 "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/funasr.zip" && \ + $WGET_CMD "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/funasr.zip" && \ unzip funasr.zip -d tools/asr/models/ && \ rm -rf funasr.zip ; \ else \ @@ -46,7 +56,7 @@ RUN if [ "$USE_FUNASR" = "true" ]; then \ RUN if [ "$USE_FASTERWHISPER" = "true" ]; then \ echo "Downloading faster-whisper..." && \ - wget -nv --show-progress --tries=25 --wait=3 --read-timeout=40 "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/faster-whisper.zip" && \ + $WGET_CMD "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/faster-whisper.zip" && \ unzip faster-whisper.zip -d tools/asr/models/ && \ rm -rf faster-whisper.zip ; \ else \ diff --git a/install.sh b/install.sh index 598dff11..4e931767 100644 --- a/install.sh +++ b/install.sh @@ -100,11 +100,17 @@ elif [ "$is_MODELSCOPE" = "true" ]; then UVR5_URL="https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/uvr5_weights.zip" fi +if [ "$WGET_SHOW_PROGRESS" = "0" ]; then + WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +else + WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +fi + if find "GPT_SoVITS/pretrained_models" -mindepth 1 ! -name '.gitignore' | grep -q .; then echo "Pretrained Model Exists" else echo "Download Pretrained Models" - wget -nv --show-progress --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$PRETRINED_URL" + $WGET_CMD "$PRETRINED_URL" unzip pretrained_models.zip rm -rf pretrained_models.zip @@ -114,7 +120,7 @@ fi if [ ! -d "GPT_SoVITS/text/G2PWModel" ]; then echo "Download G2PWModel" - wget -nv --show-progress --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$G2PW_URL" + $WGET_CMD "$G2PW_URL" unzip G2PWModel.zip rm -rf G2PWModel.zip @@ -128,7 +134,7 @@ if [ "$DOWNLOAD_UVR5" = "true" ]; then echo "UVR5 Model Exists" else echo "Download UVR5 Model" - wget -nv --show-progress --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$UVR5_URL" + $WGET_CMD "$UVR5_URL" unzip uvr5_weights.zip rm -rf uvr5_weights.zip From 982dd5c35c8a2d513268769e987ef7af329f7fbb Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 19:16:43 +0100 Subject: [PATCH 006/183] Fix Wget --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e037e787..0461ef1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,7 @@ RUN if [ "$WGET_SHOW_PROGRESS" = "0" ]; then \ ENV $(cat /env.list) -RUN $WGET_CMD -O anaconda.sh "https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ +RUN eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ bash anaconda.sh -b -p /root/anaconda3 && \ rm anaconda.sh From 76a20109bf0371601c9f2349648ac68f8d16c4b6 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 19:27:19 +0100 Subject: [PATCH 007/183] Fix Bugs --- .github/workflows/docker-publish.yaml | 4 ++-- Dockerfile | 10 +--------- install.sh | 6 +----- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index ab335516..22985463 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -37,7 +37,7 @@ jobs: USE_FUNASR=true USE_FASTERWHISPER=false CUDA_VERSION=12.4 - WGET_SHOW_PROGRESS=0 + WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" tags: | xxxxrt666/gpt-sovits:lite-cu124-${{ steps.meta.outputs.tag }} xxxxrt666/gpt-sovits:latest-lite @@ -54,7 +54,7 @@ jobs: USE_FUNASR=true USE_FASTERWHISPER=true CUDA_VERSION=12.4 - WGET_SHOW_PROGRESS=0 + WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" tags: | xxxxrt666/gpt-sovits:cu124-${{ steps.meta.outputs.tag }} xxxxrt666/gpt-sovits:latest diff --git a/Dockerfile b/Dockerfile index 0461ef1e..cd8962ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,15 +28,7 @@ WORKDIR /workspace/GPT-SoVITS COPY . /workspace/GPT-SoVITS -ARG WGET_SHOW_PROGRESS=1 - -RUN if [ "$WGET_SHOW_PROGRESS" = "0" ]; then \ - echo 'WGET_CMD=wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404' >> /env.list; \ - else \ - echo 'WGET_CMD=wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404' >> /env.list; \ - fi - -ENV $(cat /env.list) +ARG WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" RUN eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ bash anaconda.sh -b -p /root/anaconda3 && \ diff --git a/install.sh b/install.sh index 4e931767..5454cb4e 100644 --- a/install.sh +++ b/install.sh @@ -100,11 +100,7 @@ elif [ "$is_MODELSCOPE" = "true" ]; then UVR5_URL="https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/uvr5_weights.zip" fi -if [ "$WGET_SHOW_PROGRESS" = "0" ]; then - WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" -else - WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" -fi +WGET_CMD="${WGET_CMD:-wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404}" if find "GPT_SoVITS/pretrained_models" -mindepth 1 ! -name '.gitignore' | grep -q .; then echo "Pretrained Model Exists" From 10603e0d22d610a54144dad62991f2a34b799dc4 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 19:41:24 +0100 Subject: [PATCH 008/183] Fix Bugs --- .github/workflows/docker-publish.yaml | 4 ++-- Dockerfile | 2 +- docker_build.sh | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 22985463..cb83a2c7 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -37,7 +37,7 @@ jobs: USE_FUNASR=true USE_FASTERWHISPER=false CUDA_VERSION=12.4 - WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" + WGET_CMD=wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 tags: | xxxxrt666/gpt-sovits:lite-cu124-${{ steps.meta.outputs.tag }} xxxxrt666/gpt-sovits:latest-lite @@ -54,7 +54,7 @@ jobs: USE_FUNASR=true USE_FASTERWHISPER=true CUDA_VERSION=12.4 - WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" + WGET_CMD=wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 tags: | xxxxrt666/gpt-sovits:cu124-${{ steps.meta.outputs.tag }} xxxxrt666/gpt-sovits:latest diff --git a/Dockerfile b/Dockerfile index cd8962ee..aa0b7fd7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ WORKDIR /workspace/GPT-SoVITS COPY . /workspace/GPT-SoVITS -ARG WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +ARG WGET_CMD RUN eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ bash anaconda.sh -b -p /root/anaconda3 && \ diff --git a/docker_build.sh b/docker_build.sh index 212c8d1b..6f13cd4f 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -16,6 +16,7 @@ trap 'echo "Error Occured at \"$BASH_COMMAND\" with exit code $?"; exit 1' ERR USE_FUNASR=false USE_FASTERWHISPER=false CUDA_VERSION=12.4 +WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" print_help() { echo "Usage: bash docker_build.sh [OPTIONS]" @@ -78,5 +79,6 @@ docker build \ --build-arg CUDA_VERSION=$CUDA_VERSION \ --build-arg USE_FUNASR=$USE_FUNASR \ --build-arg USE_FASTERWHISPER=$USE_FASTERWHISPER \ + --build-arg WGET_CMD="$WGET_CMD" \ -t "${USER}/gpt-sovits:local" \ . From d9a7b8314c1a2a7ea93665656ad0462381dec2da Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 19:51:07 +0100 Subject: [PATCH 009/183] Update Wget --- Dockerfile | 3 ++- docker_build.sh | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index aa0b7fd7..14e9ef39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,8 @@ WORKDIR /workspace/GPT-SoVITS COPY . /workspace/GPT-SoVITS -ARG WGET_CMD +ARG WGET_CMD=wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 +ENV WGET_CMD=${WGET_CMD} RUN eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ bash anaconda.sh -b -p /root/anaconda3 && \ diff --git a/docker_build.sh b/docker_build.sh index 6f13cd4f..212c8d1b 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -16,7 +16,6 @@ trap 'echo "Error Occured at \"$BASH_COMMAND\" with exit code $?"; exit 1' ERR USE_FUNASR=false USE_FASTERWHISPER=false CUDA_VERSION=12.4 -WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" print_help() { echo "Usage: bash docker_build.sh [OPTIONS]" @@ -79,6 +78,5 @@ docker build \ --build-arg CUDA_VERSION=$CUDA_VERSION \ --build-arg USE_FUNASR=$USE_FUNASR \ --build-arg USE_FASTERWHISPER=$USE_FASTERWHISPER \ - --build-arg WGET_CMD="$WGET_CMD" \ -t "${USER}/gpt-sovits:local" \ . From 2e03b9ad41b7aae7b072cc1d6d8bbe47ca3c9c77 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 20:06:22 +0100 Subject: [PATCH 010/183] Update Workflows --- .github/workflows/docker-publish.yaml | 11 ++++++++++- Dockerfile | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index cb83a2c7..02760b62 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -10,6 +10,15 @@ jobs: steps: - name: Checkout Code uses: actions/checkout@v4 + + - name: Free up disk space + run: | + echo "Before cleanup:" + df -h + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc + sudo apt clean + echo "After cleanup:" + df -h - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -26,7 +35,7 @@ jobs: DATE=$(date +'%Y%m%d') COMMIT=$(git rev-parse --short=6 HEAD) echo "tag=${DATE}-${COMMIT}" >> $GITHUB_OUTPUT - + - name: Build and Push Lite Docker Image uses: docker/build-push-action@v5 with: diff --git a/Dockerfile b/Dockerfile index 14e9ef39..157361f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG CUDA_VERSION=12.4 -FROM nvidia/cuda:${CUDA_VERSION}.1-cudnn-devel-ubuntu22.04 +FROM nvidia/cuda:${CUDA_VERSION}.1-cudnn-runtime-ubuntu22.04 LABEL maintainer="XXXXRT" LABEL version="V4-0429" From a373df3e512ec8b76b55328078efc684575e1db4 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 21:06:19 +0100 Subject: [PATCH 011/183] Accelerate Docker Image Building --- .github/workflows/docker-publish.yaml | 74 ++++++++++++--------- Dockerfile | 6 +- docker_build.sh | 5 +- install.sh | 96 ++++++++++++++++++++------- 4 files changed, 118 insertions(+), 63 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 02760b62..f371107e 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -1,16 +1,47 @@ name: Build and Publish Docker Image -on: +on: workflow_dispatch: jobs: - build-and-push: + generate-meta: runs-on: ubuntu-latest + outputs: + tag: ${{ steps.meta.outputs.tag }} + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Generate Tag + id: meta + run: | + DATE=$(date +'%Y%m%d') + COMMIT=$(git rev-parse --short=6 HEAD) + echo "tag=${DATE}-${COMMIT}" >> $GITHUB_OUTPUT + + build-and-push: + needs: generate-meta + runs-on: ubuntu-latest + strategy: + matrix: + include: + - cuda_version: 12.4 + use_fasterwhisper: false + tag_prefix: lite-cu124 + - cuda_version: 12.4 + use_fasterwhisper: true + tag_prefix: cu124 + - cuda_version: 12.8 + use_fasterwhisper: false + tag_prefix: lite-cu128 + - cuda_version: 12.8 + use_fasterwhisper: true + tag_prefix: cu128 steps: - name: Checkout Code uses: actions/checkout@v4 - + - name: Free up disk space run: | echo "Before cleanup:" @@ -19,6 +50,7 @@ jobs: sudo apt clean echo "After cleanup:" df -h + sudo du -hxd1 / | sort -hr | head -n 20 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -26,32 +58,8 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Generate Tag - id: meta - run: | - DATE=$(date +'%Y%m%d') - COMMIT=$(git rev-parse --short=6 HEAD) - echo "tag=${DATE}-${COMMIT}" >> $GITHUB_OUTPUT - - - name: Build and Push Lite Docker Image - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - push: true - build-args: | - USE_FUNASR=true - USE_FASTERWHISPER=false - CUDA_VERSION=12.4 - WGET_CMD=wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 - tags: | - xxxxrt666/gpt-sovits:lite-cu124-${{ steps.meta.outputs.tag }} - xxxxrt666/gpt-sovits:latest-lite - cache-from: type=gha - cache-to: type=gha,mode=max + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} - name: Build and Push Docker Image uses: docker/build-push-action@v5 @@ -61,11 +69,11 @@ jobs: push: true build-args: | USE_FUNASR=true - USE_FASTERWHISPER=true - CUDA_VERSION=12.4 + USE_FASTERWHISPER=${{ matrix.use_fasterwhisper }} + CUDA_VERSION=${{ matrix.cuda_version }} WGET_CMD=wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 tags: | - xxxxrt666/gpt-sovits:cu124-${{ steps.meta.outputs.tag }} - xxxxrt666/gpt-sovits:latest + xxxxrt666/gpt-sovits:${{ matrix.tag_prefix }}-${{ needs.generate-meta.outputs.tag }} + xxxxrt666/gpt-sovits:latest-${{ matrix.tag_prefix }} cache-from: type=gha cache-to: type=gha,mode=max \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 157361f0..42f20caf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,10 @@ ARG CUDA_VERSION=12.4 FROM nvidia/cuda:${CUDA_VERSION}.1-cudnn-runtime-ubuntu22.04 +ARG CUDA_VERSION + +ENV CUDA_VERSION=${CUDA_VERSION} + LABEL maintainer="XXXXRT" LABEL version="V4-0429" LABEL description="Docker image for GPT-SoVITS" @@ -68,7 +72,7 @@ ENV MAKEFLAGS="-j$(nproc)" RUN source /root/anaconda3/etc/profile.d/conda.sh && \ conda activate GPTSoVITS && \ - bash install.sh --source HF --download-uvr5 && \ + bash install.sh --device CU${CUDA_VERSION//./} --source HF --download-uvr5 && \ pip cache purge RUN rm -rf /root/anaconda3/pkgs diff --git a/docker_build.sh b/docker_build.sh index 212c8d1b..ea817970 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -41,9 +41,6 @@ while [[ $# -gt 0 ]]; do case "$1" in --cuda) case "$2" in - 12.1) - CUDA_VERSION=12.1 - ;; 12.4) CUDA_VERSION=12.4 ;; @@ -52,7 +49,7 @@ while [[ $# -gt 0 ]]; do ;; *) echo "Error: Invalid CUDA_VERSION: $2" - echo "Choose From: [12.1, 12.4, 12.8]" + echo "Choose From: [12.4, 12.8]" exit 1 ;; esac diff --git a/install.sh b/install.sh index 5454cb4e..fdd003a9 100644 --- a/install.sh +++ b/install.sh @@ -14,18 +14,23 @@ fi trap 'echo "Error Occured at \"$BASH_COMMAND\" with exit code $?"; exit 1' ERR -is_HF=false -is_HF_MIRROR=false -is_MODELSCOPE=false +USE_CUDA=false +USE_ROCM=false +USE_CPU=false + +USE_HF=false +USE_HF_MIRROR=false +USE_MODELSCOPE=false DOWNLOAD_UVR5=false print_help() { echo "Usage: bash install.sh [OPTIONS]" echo "" echo "Options:" - echo " --source HF|HF-Mirror|ModelScope Specify the model source (REQUIRED)" - echo " --download-uvr5 Enable downloading the UVR5 model" - echo " -h, --help Show this help message and exit" + echo " --device CU124|CU128|ROCM|MPS|CPU Specify the Device (REQUIRED)" + echo " --source HF|HF-Mirror|ModelScope Specify the model source (REQUIRED)" + echo " --download-uvr5 Enable downloading the UVR5 model" + echo " -h, --help Show this help message and exit" echo "" echo "Examples:" echo " bash install.sh --source HF --download-uvr5" @@ -44,13 +49,13 @@ while [[ $# -gt 0 ]]; do --source) case "$2" in HF) - is_HF=true + USE_HF=true ;; HF-Mirror) - is_HF_MIRROR=true + USE_HF_MIRROR=true ;; ModelScope) - is_MODELSCOPE=true + USE_MODELSCOPE=true ;; *) echo "Error: Invalid Download Source: $2" @@ -60,6 +65,33 @@ while [[ $# -gt 0 ]]; do esac shift 2 ;; + --cuda) + case "$2" in + CU124) + CUDA_VERSION=124 + USE_CUDA=true + ;; + CU128) + CUDA_VERSION=128 + USE_CUDA=true + ;; + ROCM) + USE_ROCM=true + ;; + MPS) + USE_CPU=true + ;; + CPU) + USE_CPU=true + ;; + *) + echo "Error: Invalid Device: $2" + echo "Choose From: [CU124, CU128, ROCM, MPS, CPU]" + exit 1 + ;; + esac + shift 2 + ;; --download-uvr5) DOWNLOAD_UVR5=true shift @@ -76,24 +108,31 @@ while [[ $# -gt 0 ]]; do esac done -if ! $is_HF && ! $is_HF_MIRROR && ! $is_MODELSCOPE; then +if ! $USE_CUDA && ! $USE_ROCM && ! $USE_CPU; then + echo "Error: Device is REQUIRED" + echo "" + print_help + exit 1 +fi + +if ! $USE_HF && ! $USE_HF_MIRROR && ! $USE_MODELSCOPE; then echo "Error: Download Source is REQUIRED" echo "" print_help exit 1 fi -if [ "$is_HF" = "true" ]; then +if [ "$USE_HF" = "true" ]; then echo "Download Model From HuggingFace" PRETRINED_URL="https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/pretrained_models.zip" G2PW_URL="https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/G2PWModel.zip" UVR5_URL="https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/uvr5_weights.zip" -elif [ "$is_HF_MIRROR" = "true" ]; then +elif [ "$USE_HF_MIRROR" = "true" ]; then echo "Download Model From HuggingFace-Mirror" PRETRINED_URL="https://hf-mirror.com/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/pretrained_models.zip" G2PW_URL="https://hf-mirror.com/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/G2PWModel.zip" UVR5_URL="https://hf-mirror.com/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/uvr5_weights.zip" -elif [ "$is_MODELSCOPE" = "true" ]; then +elif [ "$USE_MODELSCOPE" = "true" ]; then echo "Download Model From ModelScope" PRETRINED_URL="https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/pretrained_models.zip" G2PW_URL="https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/G2PWModel.zip" @@ -156,19 +195,19 @@ conda install zip -y git-lfs install -echo "Checking for CUDA installation..." -if command -v nvidia-smi &>/dev/null; then - USE_CUDA=true - echo "CUDA found." -else - echo "CUDA not found." - USE_CUDA=false +if [ "$USE_CUDA" = true ]; then + echo "Checking for CUDA installation..." + if command -v nvidia-smi &>/dev/null; then + echo "CUDA found." + else + USE_CUDA=false + echo "CUDA not found." + fi fi -if [ "$USE_CUDA" = false ]; then +if [ "$USE_ROCM" = true ]; then echo "Checking for ROCm installation..." if [ -d "/opt/rocm" ]; then - USE_ROCM=true echo "ROCm found." if grep -qi "microsoft" /proc/version; then echo "You are running WSL." @@ -178,20 +217,27 @@ if [ "$USE_CUDA" = false ]; then IS_WSL=false fi else - echo "ROCm not found." USE_ROCM=false + echo "ROCm not found." fi fi if [ "$USE_CUDA" = true ]; then echo "Installing PyTorch with CUDA support..." - pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 + if [ "$CUDA_VERSION" = 128 ]; then + pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128 + elif [ "$CUDA_VERSION" = 124 ]; then + pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 + fi elif [ "$USE_ROCM" = true ]; then echo "Installing PyTorch with ROCm support..." pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/rocm6.2 -else +elif [ "$USE_CPU" = true ]; then echo "Installing PyTorch for CPU..." pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cpu +else + echo "Unknown Err" + exit 1 fi echo "Installing Python dependencies from requirements.txt..." From 153753745953a0c60404d8bba1b7cefc6705d87a Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 21:12:21 +0100 Subject: [PATCH 012/183] Fix Install.sh --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index fdd003a9..b376361d 100644 --- a/install.sh +++ b/install.sh @@ -65,7 +65,7 @@ while [[ $# -gt 0 ]]; do esac shift 2 ;; - --cuda) + --device) case "$2" in CU124) CUDA_VERSION=124 From 99b74c8bea71b99ee121068c6c216e9561e2dcdf Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 21:29:16 +0100 Subject: [PATCH 013/183] Add Skip-Check For Action Runner --- .github/workflows/docker-publish.yaml | 1 + Dockerfile | 5 ++++- install.sh | 18 ++++++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index f371107e..9fa3f633 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -72,6 +72,7 @@ jobs: USE_FASTERWHISPER=${{ matrix.use_fasterwhisper }} CUDA_VERSION=${{ matrix.cuda_version }} WGET_CMD=wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 + SKIP_CHECK=true tags: | xxxxrt666/gpt-sovits:${{ matrix.tag_prefix }}-${{ needs.generate-meta.outputs.tag }} xxxxrt666/gpt-sovits:latest-${{ matrix.tag_prefix }} diff --git a/Dockerfile b/Dockerfile index 42f20caf..dfd5186e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,9 +70,12 @@ ENV PATH="/usr/local/cuda/bin:$PATH" ENV CUDA_HOME="/usr/local/cuda" ENV MAKEFLAGS="-j$(nproc)" +ARG SKIP_CHECK = false +ENV SKIP_CHECK=${SKIP_CHECK} + RUN source /root/anaconda3/etc/profile.d/conda.sh && \ conda activate GPTSoVITS && \ - bash install.sh --device CU${CUDA_VERSION//./} --source HF --download-uvr5 && \ + bash install.sh --device CU${CUDA_VERSION//./} --source HF --skip-check ${SKIP_CHECK} --download-uvr5 && \ pip cache purge RUN rm -rf /root/anaconda3/pkgs diff --git a/install.sh b/install.sh index b376361d..a3589545 100644 --- a/install.sh +++ b/install.sh @@ -17,6 +17,7 @@ trap 'echo "Error Occured at \"$BASH_COMMAND\" with exit code $?"; exit 1' ERR USE_CUDA=false USE_ROCM=false USE_CPU=false +SKIP_CHECK=false USE_HF=false USE_HF_MIRROR=false @@ -65,6 +66,17 @@ while [[ $# -gt 0 ]]; do esac shift 2 ;; + --skip-check) + case "$2" in + true) + SKIP_CHECK=true + ;; + *) + : + ;; + esac + shift 2 + ;; --device) case "$2" in CU124) @@ -195,17 +207,18 @@ conda install zip -y git-lfs install -if [ "$USE_CUDA" = true ]; then +if [ "$USE_CUDA" = true ] && [ $SKIP_CHECK = false ]; then echo "Checking for CUDA installation..." if command -v nvidia-smi &>/dev/null; then echo "CUDA found." else USE_CUDA=false + USE_CPU=true echo "CUDA not found." fi fi -if [ "$USE_ROCM" = true ]; then +if [ "$USE_ROCM" = true ] && [ $SKIP_CHECK = false ]; then echo "Checking for ROCm installation..." if [ -d "/opt/rocm" ]; then echo "ROCm found." @@ -218,6 +231,7 @@ if [ "$USE_ROCM" = true ]; then fi else USE_ROCM=false + USE_CPU=true echo "ROCm not found." fi fi From ceff5a774b33ee0bfb610283142b48f4f2334e58 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 21:34:23 +0100 Subject: [PATCH 014/183] Fix Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index dfd5186e..f7233c32 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,7 +70,7 @@ ENV PATH="/usr/local/cuda/bin:$PATH" ENV CUDA_HOME="/usr/local/cuda" ENV MAKEFLAGS="-j$(nproc)" -ARG SKIP_CHECK = false +ARG SKIP_CHECK=false ENV SKIP_CHECK=${SKIP_CHECK} RUN source /root/anaconda3/etc/profile.d/conda.sh && \ From 97624377503c0330b1cd45a2fdebece7498e5e86 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 21:46:15 +0100 Subject: [PATCH 015/183] . --- .github/workflows/docker-publish.yaml | 3 +++ Dockerfile | 3 ++- install.sh | 31 ++++++++++++--------------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 9fa3f633..d1f5c8cb 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -51,6 +51,9 @@ jobs: echo "After cleanup:" df -h sudo du -hxd1 / | sort -hr | head -n 20 + ls -a /usr + ls -a /opt + ls -a /home - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/Dockerfile b/Dockerfile index f7233c32..ec0a887f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -76,7 +76,8 @@ ENV SKIP_CHECK=${SKIP_CHECK} RUN source /root/anaconda3/etc/profile.d/conda.sh && \ conda activate GPTSoVITS && \ bash install.sh --device CU${CUDA_VERSION//./} --source HF --skip-check ${SKIP_CHECK} --download-uvr5 && \ - pip cache purge + pip cache purge && \ + pip show torch RUN rm -rf /root/anaconda3/pkgs diff --git a/install.sh b/install.sh index a3589545..5da9d4b6 100644 --- a/install.sh +++ b/install.sh @@ -134,6 +134,20 @@ if ! $USE_HF && ! $USE_HF_MIRROR && ! $USE_MODELSCOPE; then exit 1 fi +# 安装构建工具 +# Install build tools +echo "Installing GCC..." +conda install -c conda-forge gcc=14 -y + +echo "Installing G++..." +conda install -c conda-forge gxx -y + +echo "Installing ffmpeg and cmake..." +conda install ffmpeg cmake make -y + +echo "Installing unzip..." +conda install unzip -y + if [ "$USE_HF" = "true" ]; then echo "Download Model From HuggingFace" PRETRINED_URL="https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/pretrained_models.zip" @@ -190,23 +204,6 @@ if [ "$DOWNLOAD_UVR5" = "true" ]; then fi fi -# 安装构建工具 -# Install build tools -echo "Installing GCC..." -conda install -c conda-forge gcc=14 -y - -echo "Installing G++..." -conda install -c conda-forge gxx -y - -echo "Installing ffmpeg and cmake..." -conda install ffmpeg cmake -y - -echo "Installing git-lfs and zip..." -conda install git-lfs -y -conda install zip -y - -git-lfs install - if [ "$USE_CUDA" = true ] && [ $SKIP_CHECK = false ]; then echo "Checking for CUDA installation..." if command -v nvidia-smi &>/dev/null; then From 1f00a14e2ac82415b6aed888211e6084ee09a057 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 21:48:33 +0100 Subject: [PATCH 016/183] . --- .github/workflows/docker-publish.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index d1f5c8cb..1be0cf27 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -51,9 +51,9 @@ jobs: echo "After cleanup:" df -h sudo du -hxd1 / | sort -hr | head -n 20 - ls -a /usr - ls -a /opt - ls -a /home + du -h --max-depth=1 /usr + du -h --max-depth=1 /opt + du -h --max-depth=1 /home - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 69a5fe5745d828a128fe239a03d4442e5dedff62 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 21:52:40 +0100 Subject: [PATCH 017/183] . --- .github/workflows/docker-publish.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 1be0cf27..1ad13f23 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -51,9 +51,12 @@ jobs: echo "After cleanup:" df -h sudo du -hxd1 / | sort -hr | head -n 20 - du -h --max-depth=1 /usr - du -h --max-depth=1 /opt - du -h --max-depth=1 /home + echo 1 + du -h --max-depth=1 /usr 2>/dev/null + echo 2 + du -h --max-depth=1 /opt 2>/dev/null + echo 3 + du -h --max-depth=1 /home 2>/dev/null - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 40d58a52a2205fc49db7fd4d6f23bfac073b27c6 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 21:57:37 +0100 Subject: [PATCH 018/183] . --- .github/workflows/docker-publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 1ad13f23..0816c5b6 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -56,7 +56,7 @@ jobs: echo 2 du -h --max-depth=1 /opt 2>/dev/null echo 3 - du -h --max-depth=1 /home 2>/dev/null + du -h --max-depth=1 /opt/hostedtoolcache - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 2a442990332744a8f7f7d461d0bb7c80f3f7b597 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:09:00 +0100 Subject: [PATCH 019/183] Delete File in Runner --- .github/workflows/docker-publish.yaml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 0816c5b6..a7d424c1 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -47,16 +47,25 @@ jobs: echo "Before cleanup:" df -h sudo rm -rf /usr/share/dotnet /usr/local/lib/android /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 apt clean echo "After cleanup:" df -h sudo du -hxd1 / | sort -hr | head -n 20 echo 1 - du -h --max-depth=1 /usr 2>/dev/null + du -h --max-depth=1 /usr/lib 2>/dev/null echo 2 - du -h --max-depth=1 /opt 2>/dev/null + du -h --max-depth=1 /usr/local 2>/dev/null echo 3 - du -h --max-depth=1 /opt/hostedtoolcache + du -h --max-depth=1 /usr/share 2>/dev/null - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 3f6793b5e26612be33dcb86d3a56b1390127581c Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:14:40 +0100 Subject: [PATCH 020/183] Add Sort --- .github/workflows/docker-publish.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index a7d424c1..c8fa11b8 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -61,11 +61,11 @@ jobs: df -h sudo du -hxd1 / | sort -hr | head -n 20 echo 1 - du -h --max-depth=1 /usr/lib 2>/dev/null + du -h --max-depth=1 /usr/lib | sort -hr echo 2 - du -h --max-depth=1 /usr/local 2>/dev/null + du -h --max-depth=1 /usr/local | sort -hr echo 3 - du -h --max-depth=1 /usr/share 2>/dev/null + du -h --max-depth=1 /usr/share | sort -hr - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 605db32295eb3dfc8b2500d72618b73427569631 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:23:25 +0100 Subject: [PATCH 021/183] Delete More Files --- .github/workflows/docker-publish.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index c8fa11b8..eba53d55 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -56,16 +56,23 @@ jobs: 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/.ghcup + sudo rm -rf /usr/local/julia1.11.5 + sudo rm -rf /usr/share/swift + sudo rm -rf /usr/share/miniconda + sudo rm -rf /usr/share/az_12.1.0 sudo apt clean echo "After cleanup:" df -h + sudo du -hxd1 / | sort -hr | head -n 20 echo 1 - du -h --max-depth=1 /usr/lib | sort -hr + du -h --max-depth=1 /usr/local/share | sort -hr echo 2 du -h --max-depth=1 /usr/local | sort -hr - echo 3 - du -h --max-depth=1 /usr/share | sort -hr - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From d21082f50933713f29a384a1bdcb7083263d2701 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:28:58 +0100 Subject: [PATCH 022/183] Delete More --- .github/workflows/docker-publish.yaml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index eba53d55..e65c4135 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -45,8 +45,9 @@ jobs: - name: Free up disk space run: | echo "Before cleanup:" - df -h - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc + 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 @@ -56,24 +57,26 @@ jobs: 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 apt clean + sudo rm -rf /usr/share/dotnet + + echo "After cleanup:" df -h - - sudo du -hxd1 / | sort -hr | head -n 20 - echo 1 - du -h --max-depth=1 /usr/local/share | sort -hr - echo 2 - du -h --max-depth=1 /usr/local | sort -hr - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 100ed29ecbe7ed2428367b63b49b5aa9cd9fda17 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:29:24 +0100 Subject: [PATCH 023/183] . --- .github/workflows/docker-publish.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index e65c4135..3ae00801 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -77,6 +77,7 @@ jobs: echo "After cleanup:" df -h + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 7a57151f47bfea185b4d266e421326df4ef82050 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 00:37:38 +0100 Subject: [PATCH 024/183] . --- .github/workflows/docker-publish.yaml | 4 ++-- Dockerfile | 24 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 3ae00801..f7774ad5 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -77,7 +77,7 @@ jobs: echo "After cleanup:" df -h - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -103,4 +103,4 @@ jobs: xxxxrt666/gpt-sovits:${{ matrix.tag_prefix }}-${{ needs.generate-meta.outputs.tag }} xxxxrt666/gpt-sovits:latest-${{ matrix.tag_prefix }} cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file + # cache-to: type=gha,mode=max \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ec0a887f..ce762c76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ g++ \ wget \ curl \ - bzip2 \ unzip \ git \ vim \ @@ -24,8 +23,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ procps \ ca-certificates \ locales \ - net-tools \ - iputils-ping \ && rm -rf /var/lib/apt/lists/* WORKDIR /workspace/GPT-SoVITS @@ -35,10 +32,21 @@ COPY . /workspace/GPT-SoVITS ARG WGET_CMD=wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 ENV WGET_CMD=${WGET_CMD} +RUN echo "== /usr ==" && du -h --max-depth=1 /usr | sort -hr | head -n 10 && \ + echo "== /opt ==" && du -h --max-depth=1 /opt | sort -hr | head -n 10 && \ + echo "== /root ==" && du -h --max-depth=1 /root | sort -hr | head -n 10 && \ + echo "==workspace==" && du -h --max-depth=1 /workspace/GPTSoVITS | sort -hr | head -n 10 + RUN eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ bash anaconda.sh -b -p /root/anaconda3 && \ rm anaconda.sh + +RUN echo "== /usr ==" && du -h --max-depth=1 /usr | sort -hr | head -n 10 && \ + echo "== /opt ==" && du -h --max-depth=1 /opt | sort -hr | head -n 10 && \ + echo "== /root ==" && du -h --max-depth=1 /root | sort -hr | head -n 10 && \ + echo "==workspace==" && du -h --max-depth=1 /workspace/GPTSoVITS | sort -hr | head -n 10 + ARG USE_FUNASR=false ARG USE_FASTERWHISPER=false @@ -60,6 +68,11 @@ RUN if [ "$USE_FASTERWHISPER" = "true" ]; then \ echo "Skipping faster-whisper download" ; \ fi +RUN echo "== /usr ==" && du -h --max-depth=1 /usr | sort -hr | head -n 10 && \ + echo "== /opt ==" && du -h --max-depth=1 /opt | sort -hr | head -n 10 && \ + echo "== /root ==" && du -h --max-depth=1 /root | sort -hr | head -n 10 && \ + echo "==workspace==" && du -h --max-depth=1 /workspace/GPTSoVITS | sort -hr | head -n 10 + ENV PATH="/root/anaconda3/bin:$PATH" SHELL ["/bin/bash", "-c"] @@ -79,6 +92,11 @@ RUN source /root/anaconda3/etc/profile.d/conda.sh && \ pip cache purge && \ pip show torch +RUN echo "== /usr ==" && du -h --max-depth=1 /usr | sort -hr | head -n 10 && \ + echo "== /opt ==" && du -h --max-depth=1 /opt | sort -hr | head -n 10 && \ + echo "== /root ==" && du -h --max-depth=1 /root | sort -hr | head -n 10 && \ + echo "==workspace==" && du -h --max-depth=1 /workspace/GPTSoVITS | sort -hr | head -n 10 + RUN rm -rf /root/anaconda3/pkgs EXPOSE 9871 9872 9873 9874 9880 From bf90e8f4aa3a1c36bfd947bc1448c2faf826d434 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 00:42:59 +0100 Subject: [PATCH 025/183] . --- .github/workflows/docker-publish.yaml | 2 +- Dockerfile | 32 +++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index f7774ad5..976783c8 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -92,7 +92,7 @@ jobs: with: context: . file: ./Dockerfile - push: true + push: false build-args: | USE_FUNASR=true USE_FASTERWHISPER=${{ matrix.use_fasterwhisper }} diff --git a/Dockerfile b/Dockerfile index ce762c76..f3690e9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,20 +32,20 @@ COPY . /workspace/GPT-SoVITS ARG WGET_CMD=wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 ENV WGET_CMD=${WGET_CMD} -RUN echo "== /usr ==" && du -h --max-depth=1 /usr | sort -hr | head -n 10 && \ - echo "== /opt ==" && du -h --max-depth=1 /opt | sort -hr | head -n 10 && \ - echo "== /root ==" && du -h --max-depth=1 /root | sort -hr | head -n 10 && \ - echo "==workspace==" && du -h --max-depth=1 /workspace/GPTSoVITS | sort -hr | head -n 10 +RUN echo "== /usr ==" && du -h --max-depth=2 /usr | sort -hr | head -n 10 && \ + echo "== /opt ==" && du -h --max-depth=2 /opt | sort -hr | head -n 10 && \ + echo "== /root ==" && du -h --max-depth=2 /root | sort -hr | head -n 10 && \ + echo "==workspace==" && du -h --max-depth=2 /workspace/GPT-SoVITS | sort -hr | head -n 10 RUN eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ bash anaconda.sh -b -p /root/anaconda3 && \ rm anaconda.sh -RUN echo "== /usr ==" && du -h --max-depth=1 /usr | sort -hr | head -n 10 && \ - echo "== /opt ==" && du -h --max-depth=1 /opt | sort -hr | head -n 10 && \ - echo "== /root ==" && du -h --max-depth=1 /root | sort -hr | head -n 10 && \ - echo "==workspace==" && du -h --max-depth=1 /workspace/GPTSoVITS | sort -hr | head -n 10 +RUN echo "== /usr ==" && du -h --max-depth=2 /usr | sort -hr | head -n 10 && \ + echo "== /opt ==" && du -h --max-depth=2 /opt | sort -hr | head -n 10 && \ + echo "== /root ==" && du -h --max-depth=2 /root | sort -hr | head -n 10 && \ + echo "==workspace==" && du -h --max-depth=2 /workspace/GPT-SoVITS | sort -hr | head -n 10 ARG USE_FUNASR=false ARG USE_FASTERWHISPER=false @@ -68,10 +68,10 @@ RUN if [ "$USE_FASTERWHISPER" = "true" ]; then \ echo "Skipping faster-whisper download" ; \ fi -RUN echo "== /usr ==" && du -h --max-depth=1 /usr | sort -hr | head -n 10 && \ - echo "== /opt ==" && du -h --max-depth=1 /opt | sort -hr | head -n 10 && \ - echo "== /root ==" && du -h --max-depth=1 /root | sort -hr | head -n 10 && \ - echo "==workspace==" && du -h --max-depth=1 /workspace/GPTSoVITS | sort -hr | head -n 10 +RUN echo "== /usr ==" && du -h --max-depth=2 /usr | sort -hr | head -n 10 && \ + echo "== /opt ==" && du -h --max-depth=2 /opt | sort -hr | head -n 10 && \ + echo "== /root ==" && du -h --max-depth=2 /root | sort -hr | head -n 10 && \ + echo "==workspace==" && du -h --max-depth=2 /workspace/GPT-SoVITS | sort -hr | head -n 10 ENV PATH="/root/anaconda3/bin:$PATH" @@ -92,10 +92,10 @@ RUN source /root/anaconda3/etc/profile.d/conda.sh && \ pip cache purge && \ pip show torch -RUN echo "== /usr ==" && du -h --max-depth=1 /usr | sort -hr | head -n 10 && \ - echo "== /opt ==" && du -h --max-depth=1 /opt | sort -hr | head -n 10 && \ - echo "== /root ==" && du -h --max-depth=1 /root | sort -hr | head -n 10 && \ - echo "==workspace==" && du -h --max-depth=1 /workspace/GPTSoVITS | sort -hr | head -n 10 +RUN echo "== /usr ==" && du -h --max-depth=2 /usr | sort -hr | head -n 10 && \ + echo "== /opt ==" && du -h --max-depth=2 /opt | sort -hr | head -n 10 && \ + echo "== /root ==" && du -h --max-depth=2 /root | sort -hr | head -n 10 && \ + echo "==workspace==" && du -h --max-depth=2 /workspace/GPT-SoVITS | sort -hr | head -n 10 RUN rm -rf /root/anaconda3/pkgs From 8c6abbf930a3230430da724b497dc8b1be90f542 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 20:40:30 +0100 Subject: [PATCH 026/183] Add Pre-Commit Hook Update Docker --- .github/workflows/docker-publish.yaml | 15 +++-- .pre-commit-config.yaml | 15 +++++ Docker/anaconda_install.sh | 30 ++++++++++ Docker/setup.sh | 63 ++++++++++++++++++++ Dockerfile | 85 +++++++-------------------- docker-compose.yaml | 2 - install.sh | 17 +----- 7 files changed, 140 insertions(+), 87 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 Docker/anaconda_install.sh create mode 100644 Docker/setup.sh diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 976783c8..1f6aa35f 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -26,16 +26,16 @@ jobs: matrix: include: - cuda_version: 12.4 - use_fasterwhisper: false + lite: false tag_prefix: lite-cu124 - cuda_version: 12.4 - use_fasterwhisper: true + lite: true tag_prefix: cu124 - cuda_version: 12.8 - use_fasterwhisper: false + lite: false tag_prefix: lite-cu128 - cuda_version: 12.8 - use_fasterwhisper: true + lite: true tag_prefix: cu128 steps: @@ -93,12 +93,11 @@ jobs: context: . file: ./Dockerfile push: false + platforms: linux/amd64,linux/arm64 build-args: | - USE_FUNASR=true - USE_FASTERWHISPER=${{ matrix.use_fasterwhisper }} + LITE=${{ matrix.lite }} CUDA_VERSION=${{ matrix.cuda_version }} - WGET_CMD=wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 - SKIP_CHECK=true + WORKFLOW=true tags: | xxxxrt666/gpt-sovits:${{ matrix.tag_prefix }}-${{ needs.generate-meta.outputs.tag }} xxxxrt666/gpt-sovits:latest-${{ matrix.tag_prefix }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..d2f215e3 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +ci: + autoupdate_schedule: monthly + +repos: +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.11.7 + hooks: + # Run the linter. + - id: ruff + types_or: [ python, pyi ] + args: [ --fix ] + # Run the formatter. + - id: ruff-format + types_or: [ python, pyi ] + args: [--line-length=120] \ No newline at end of file diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh new file mode 100644 index 00000000..0ce71883 --- /dev/null +++ b/Docker/anaconda_install.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" + +cd "$SCRIPT_DIR" || exit 1 + +cd .. || exit 1 + +WORKFLOW=${WORKFLOW:-"false"} +TARGETPLATFORM=${TARGETPLATFORM:-"linux/amd64"} + +if [ "$WORKFLOW" = "true" ]; then + WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +else + WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +fi + +if [ "$TARGETPLATFORM" = "linux/amd64" ]; then + eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh" +elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then + eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-aarch.sh" +else + exit 1 +fi + +bash anaconda.sh -b -p "$HOME/anaconda3" + +rm anaconda.sh diff --git a/Docker/setup.sh b/Docker/setup.sh new file mode 100644 index 00000000..3f04509c --- /dev/null +++ b/Docker/setup.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" + +cd "$SCRIPT_DIR" || exit 1 + +cd .. || exit 1 + +set -e + +WORKFLOW=${WORKFLOW:-"false"} +LITE=${LITE:-"false"} + +if [ "$WORKFLOW" = "true" ]; then + WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +else + WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +fi + +USE_FUNASR=false +USE_FASTERWHISPER=false + +if [ "$LITE" = "true" ]; then + USE_FUNASR=true + USE_FASTERWHISPER=false +else + USE_FUNASR=true + USE_FASTERWHISPER=true +fi + +if [ "$USE_FUNASR" = "true" ]; then + echo "Downloading funasr..." && + $WGET_CMD "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/funasr.zip" && + unzip funasr.zip -d tools/asr/models/ && + rm -rf funasr.zip +else + echo "Skipping funasr download" +fi + +if [ "$USE_FASTERWHISPER" = "true" ]; then + echo "Downloading faster-whisper..." && + $WGET_CMD "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/faster-whisper.zip" && + unzip faster-whisper.zip -d tools/asr/models/ && + rm -rf faster-whisper.zip +else + echo "Skipping faster-whisper download" +fi + +source "$HOME/anaconda3/etc/profile.d/conda.sh" + +if [ "$LITE" = "true" ]; then + bash install.sh --device "CU${CUDA_VERSION//./}" --source HF --skip-check "$WORKFLOW" +elif [ "$LITE" = "false" ]; then + bash install.sh --device "CU${CUDA_VERSION//./}" --source HF --skip-check "$WORKFLOW" --download-uvr5 +else + exit 1 +fi + +pip cache purge + +pip show torch + +rm -rf "$HOME/.cache" /tmp/* /var/tmp/* diff --git a/Dockerfile b/Dockerfile index f3690e9d..5b13cb2b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,15 @@ ARG CUDA_VERSION=12.4 -FROM nvidia/cuda:${CUDA_VERSION}.1-cudnn-runtime-ubuntu22.04 - -ARG CUDA_VERSION - -ENV CUDA_VERSION=${CUDA_VERSION} +FROM nvidia/cuda:${CUDA_VERSION}.1-cudnn-devel-ubuntu22.04 LABEL maintainer="XXXXRT" -LABEL version="V4-0429" +LABEL version="V4-0501" LABEL description="Docker image for GPT-SoVITS" +ARG CUDA_VERSION=12.4 + +ENV CUDA_VERSION=${CUDA_VERSION} + RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ gcc \ @@ -29,76 +29,35 @@ WORKDIR /workspace/GPT-SoVITS COPY . /workspace/GPT-SoVITS -ARG WGET_CMD=wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 -ENV WGET_CMD=${WGET_CMD} +ARG LITE=false +ENV LITE=${LITE} -RUN echo "== /usr ==" && du -h --max-depth=2 /usr | sort -hr | head -n 10 && \ - echo "== /opt ==" && du -h --max-depth=2 /opt | sort -hr | head -n 10 && \ - echo "== /root ==" && du -h --max-depth=2 /root | sort -hr | head -n 10 && \ - echo "==workspace==" && du -h --max-depth=2 /workspace/GPT-SoVITS | sort -hr | head -n 10 +ARG WORKFLOW=false +ENV WORKFLOW=${WORKFLOW} -RUN eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh" && \ - bash anaconda.sh -b -p /root/anaconda3 && \ - rm anaconda.sh +ARG TARGETPLATFORM=linux/amd64 +ENV TARGETPLATFORM=${TARGETPLATFORM} +RUN bash Docker/anaconda_install.sh -RUN echo "== /usr ==" && du -h --max-depth=2 /usr | sort -hr | head -n 10 && \ - echo "== /opt ==" && du -h --max-depth=2 /opt | sort -hr | head -n 10 && \ - echo "== /root ==" && du -h --max-depth=2 /root | sort -hr | head -n 10 && \ - echo "==workspace==" && du -h --max-depth=2 /workspace/GPT-SoVITS | sort -hr | head -n 10 +RUN echo "== $HOME/anaconda3/pkgs ==" && du -h --max-depth=2 $HOME/anaconda3/pkgs | sort -hr | head -n 10 && \ + echo "== $HOME/anaconda3 ==" && du -h --max-depth=2 $HOME/anaconda3 | sort -hr | head -n 10 -ARG USE_FUNASR=false -ARG USE_FASTERWHISPER=false - -RUN if [ "$USE_FUNASR" = "true" ]; then \ - echo "Downloading funasr..." && \ - $WGET_CMD "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/funasr.zip" && \ - unzip funasr.zip -d tools/asr/models/ && \ - rm -rf funasr.zip ; \ - else \ - echo "Skipping funasr download" ; \ - fi - -RUN if [ "$USE_FASTERWHISPER" = "true" ]; then \ - echo "Downloading faster-whisper..." && \ - $WGET_CMD "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/faster-whisper.zip" && \ - unzip faster-whisper.zip -d tools/asr/models/ && \ - rm -rf faster-whisper.zip ; \ - else \ - echo "Skipping faster-whisper download" ; \ - fi - -RUN echo "== /usr ==" && du -h --max-depth=2 /usr | sort -hr | head -n 10 && \ - echo "== /opt ==" && du -h --max-depth=2 /opt | sort -hr | head -n 10 && \ - echo "== /root ==" && du -h --max-depth=2 /root | sort -hr | head -n 10 && \ - echo "==workspace==" && du -h --max-depth=2 /workspace/GPT-SoVITS | sort -hr | head -n 10 - -ENV PATH="/root/anaconda3/bin:$PATH" +ENV PATH="$HOME/anaconda3/bin:$PATH" SHELL ["/bin/bash", "-c"] -RUN conda create -n GPTSoVITS python=3.10 -y - ENV PATH="/usr/local/cuda/bin:$PATH" ENV CUDA_HOME="/usr/local/cuda" ENV MAKEFLAGS="-j$(nproc)" -ARG SKIP_CHECK=false -ENV SKIP_CHECK=${SKIP_CHECK} +RUN bash Docker/setup.sh -RUN source /root/anaconda3/etc/profile.d/conda.sh && \ - conda activate GPTSoVITS && \ - bash install.sh --device CU${CUDA_VERSION//./} --source HF --skip-check ${SKIP_CHECK} --download-uvr5 && \ - pip cache purge && \ - pip show torch - -RUN echo "== /usr ==" && du -h --max-depth=2 /usr | sort -hr | head -n 10 && \ - echo "== /opt ==" && du -h --max-depth=2 /opt | sort -hr | head -n 10 && \ - echo "== /root ==" && du -h --max-depth=2 /root | sort -hr | head -n 10 && \ - echo "==workspace==" && du -h --max-depth=2 /workspace/GPT-SoVITS | sort -hr | head -n 10 - -RUN rm -rf /root/anaconda3/pkgs +RUN echo "== $HOME/anaconda3/pkgs ==" && du -h --max-depth=2 $HOME/anaconda3/pkgs | sort -hr | head -n 10 && \ + echo "== $HOME/anaconda3 ==" && du -h --max-depth=2 $HOME/anaconda3 | sort -hr | head -n 10 EXPOSE 9871 9872 9873 9874 9880 -CMD ["/bin/bash", "-c", "source /root/anaconda3/etc/profile.d/conda.sh && conda activate GPTSoVITS && export PYTHONPATH=$(pwd) && exec bash"] \ No newline at end of file +ENV PYTHONPATH="/workspace/GPT-SoVITS" + +CMD ["/bin/bash", "-c", "source $HOME/anaconda3/etc/profile.d/conda.sh && exec bash"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 649db4f3..f05c4e23 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -16,7 +16,6 @@ services: - /workspace/tools/asr/models - /workspace/tools/uvr5/uvr5_weights environment: - - PYTHONPATH=/workspace/GPT-SoVITS - is_half=true tty: true stdin_open: true @@ -38,7 +37,6 @@ services: - /workspace/tools/asr/models - /workspace/tools/uvr5/uvr5_weights environment: - - PYTHONPATH=/workspace/GPT-SoVITS - is_half=true tty: true stdin_open: true diff --git a/install.sh b/install.sh index 5da9d4b6..615bec47 100644 --- a/install.sh +++ b/install.sh @@ -17,7 +17,7 @@ trap 'echo "Error Occured at \"$BASH_COMMAND\" with exit code $?"; exit 1' ERR USE_CUDA=false USE_ROCM=false USE_CPU=false -SKIP_CHECK=false +WORKFLOW=${WORKFLOW:-"false"} USE_HF=false USE_HF_MIRROR=false @@ -66,17 +66,6 @@ while [[ $# -gt 0 ]]; do esac shift 2 ;; - --skip-check) - case "$2" in - true) - SKIP_CHECK=true - ;; - *) - : - ;; - esac - shift 2 - ;; --device) case "$2" in CU124) @@ -204,7 +193,7 @@ if [ "$DOWNLOAD_UVR5" = "true" ]; then fi fi -if [ "$USE_CUDA" = true ] && [ $SKIP_CHECK = false ]; then +if [ "$USE_CUDA" = true ] && [ "$WORKFLOW" = false ]; then echo "Checking for CUDA installation..." if command -v nvidia-smi &>/dev/null; then echo "CUDA found." @@ -215,7 +204,7 @@ if [ "$USE_CUDA" = true ] && [ $SKIP_CHECK = false ]; then fi fi -if [ "$USE_ROCM" = true ] && [ $SKIP_CHECK = false ]; then +if [ "$USE_ROCM" = true ] && [ "$WORKFLOW" = false ]; then echo "Checking for ROCm installation..." if [ -d "/opt/rocm" ]; then echo "ROCm found." From de0fc044c733d2ab5f0e357f141b2a17835adf13 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 20:48:42 +0100 Subject: [PATCH 027/183] Add Code Spell Check --- .pre-commit-config.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2f215e3..31a27a15 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,4 +12,10 @@ repos: # Run the formatter. - id: ruff-format types_or: [ python, pyi ] - args: [--line-length=120] \ No newline at end of file + args: [--line-length=120] + +- repo: https://github.com/codespell-project/codespell + rev: v2.4.1 + hooks: + - id: codespell + files: ^.*\.(py|md)$ \ No newline at end of file From af318a082ce27cd7cdcab199988581dd795969e3 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 20:51:21 +0100 Subject: [PATCH 028/183] [pre-commit.ci] trigger From 0b52e5e835b346ae87342a032f19deae65274936 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 20:51:28 +0100 Subject: [PATCH 029/183] [pre-commit.ci] trigger From af7d3e45d52b2321a31ed7bc387afd73adbc1d67 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 20:53:55 +0100 Subject: [PATCH 030/183] [pre-commit.ci] trigger From 0487d7668a3b75558dd3a430abe1694b3ee49921 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 21:02:59 +0100 Subject: [PATCH 031/183] Fix Bugs --- Docker/anaconda_install.sh | 2 +- Docker/setup.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index 0ce71883..92965659 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -20,7 +20,7 @@ fi if [ "$TARGETPLATFORM" = "linux/amd64" ]; then eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh" elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then - eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-aarch.sh" + eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-aarch64.sh" else exit 1 fi diff --git a/Docker/setup.sh b/Docker/setup.sh index 3f04509c..43c81eb1 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -12,9 +12,9 @@ WORKFLOW=${WORKFLOW:-"false"} LITE=${LITE:-"false"} if [ "$WORKFLOW" = "true" ]; then - WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" -else WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +else + WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" fi USE_FUNASR=false From 8f1d85cd39072a6b3b07b3dcf05bdbedbdcc1867 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 21:05:06 +0100 Subject: [PATCH 032/183] . --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 5b13cb2b..e0e434a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,7 @@ ENV WORKFLOW=${WORKFLOW} ARG TARGETPLATFORM=linux/amd64 ENV TARGETPLATFORM=${TARGETPLATFORM} +RUN echo "${TARGETPLATFORM}" RUN bash Docker/anaconda_install.sh From 8e5e624a7277551574859f882b12b16d3e18eea2 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 21:15:33 +0100 Subject: [PATCH 033/183] Disable Progress Bar and Logs while using GitHub Actions --- Docker/anaconda_install.sh | 4 ++-- Dockerfile | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index 92965659..5d1017b9 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -12,9 +12,9 @@ WORKFLOW=${WORKFLOW:-"false"} TARGETPLATFORM=${TARGETPLATFORM:-"linux/amd64"} if [ "$WORKFLOW" = "true" ]; then - WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" -else WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +else + WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" fi if [ "$TARGETPLATFORM" = "linux/amd64" ]; then diff --git a/Dockerfile b/Dockerfile index e0e434a3..2df777f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,8 @@ ARG CUDA_VERSION=12.4 ENV CUDA_VERSION=${CUDA_VERSION} -RUN apt-get update && apt-get install -y --no-install-recommends \ +RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ + apt-get install -y -q --no-install-recommends \ build-essential \ gcc \ g++ \ @@ -37,7 +38,7 @@ ENV WORKFLOW=${WORKFLOW} ARG TARGETPLATFORM=linux/amd64 ENV TARGETPLATFORM=${TARGETPLATFORM} -RUN echo "${TARGETPLATFORM}" +RUN echo "${TARGETPLATFORM}" && echo ${WORKFLOW} RUN bash Docker/anaconda_install.sh From b11931c1bd7037d98b9327adca9bd764c23d38cd Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 21:34:02 +0100 Subject: [PATCH 034/183] . --- Docker/anaconda_install.sh | 16 +++++++++++++++- Dockerfile | 6 ++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index 5d1017b9..f4ac6f7c 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -25,6 +25,20 @@ else exit 1 fi -bash anaconda.sh -b -p "$HOME/anaconda3" +LOG_PATH="/tmp/anaconda-install.log" + +bash anaconda.sh -b -p "$HOME/anaconda3" >"$LOG_PATH" 2>&1 + +if [ $? -eq 0 ]; then + echo "== Anaconda Installed ==" +else + echo "Failed to Install Anaconda" + tail -n 50 "$LOG_PATH" + exit 1 +fi rm anaconda.sh + +rm $LOG_PATH + +"$HOME/anaconda3/bin/conda" clean -p diff --git a/Dockerfile b/Dockerfile index 2df777f0..ca9e7d8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ ARG CUDA_VERSION=12.4 ENV CUDA_VERSION=${CUDA_VERSION} RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ - apt-get install -y -q --no-install-recommends \ + apt-get install -y -qq --no-install-recommends \ build-essential \ gcc \ g++ \ @@ -36,10 +36,12 @@ ENV LITE=${LITE} ARG WORKFLOW=false ENV WORKFLOW=${WORKFLOW} -ARG TARGETPLATFORM=linux/amd64 +ARG TARGETPLATFORM ENV TARGETPLATFORM=${TARGETPLATFORM} RUN echo "${TARGETPLATFORM}" && echo ${WORKFLOW} +ENV HOME="/root" + RUN bash Docker/anaconda_install.sh RUN echo "== $HOME/anaconda3/pkgs ==" && du -h --max-depth=2 $HOME/anaconda3/pkgs | sort -hr | head -n 10 && \ From 1d2c6c5cbb36702b3ffe1eb6b90fcce1382f7fac Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 21:49:14 +0100 Subject: [PATCH 035/183] . --- Docker/anaconda_install.sh | 4 +++- Docker/setup.sh | 8 ++++---- Dockerfile | 2 +- docker_build.sh | 17 +++++------------ install.sh | 6 +++--- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index f4ac6f7c..a22ae66f 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -41,4 +41,6 @@ rm anaconda.sh rm $LOG_PATH -"$HOME/anaconda3/bin/conda" clean -p +rm -rf "$HOME/anaconda3/pkgs" + +mkdir "$HOME/anaconda3/pkgs" diff --git a/Docker/setup.sh b/Docker/setup.sh index 43c81eb1..69d813b7 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -31,7 +31,7 @@ fi if [ "$USE_FUNASR" = "true" ]; then echo "Downloading funasr..." && $WGET_CMD "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/funasr.zip" && - unzip funasr.zip -d tools/asr/models/ && + unzip -q funasr.zip -d tools/asr/models/ && rm -rf funasr.zip else echo "Skipping funasr download" @@ -40,7 +40,7 @@ fi if [ "$USE_FASTERWHISPER" = "true" ]; then echo "Downloading faster-whisper..." && $WGET_CMD "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/faster-whisper.zip" && - unzip faster-whisper.zip -d tools/asr/models/ && + unzip -q faster-whisper.zip -d tools/asr/models/ && rm -rf faster-whisper.zip else echo "Skipping faster-whisper download" @@ -49,9 +49,9 @@ fi source "$HOME/anaconda3/etc/profile.d/conda.sh" if [ "$LITE" = "true" ]; then - bash install.sh --device "CU${CUDA_VERSION//./}" --source HF --skip-check "$WORKFLOW" + bash install.sh --device "CU${CUDA_VERSION//./}" --source HF elif [ "$LITE" = "false" ]; then - bash install.sh --device "CU${CUDA_VERSION//./}" --source HF --skip-check "$WORKFLOW" --download-uvr5 + bash install.sh --device "CU${CUDA_VERSION//./}" --source HF --download-uvr5 else exit 1 fi diff --git a/Dockerfile b/Dockerfile index ca9e7d8f..11e09c71 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ ARG CUDA_VERSION=12.4 ENV CUDA_VERSION=${CUDA_VERSION} -RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ +RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq && \ apt-get install -y -qq --no-install-recommends \ build-essential \ gcc \ diff --git a/docker_build.sh b/docker_build.sh index ea817970..28e731ae 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -13,8 +13,7 @@ fi trap 'echo "Error Occured at \"$BASH_COMMAND\" with exit code $?"; exit 1' ERR -USE_FUNASR=false -USE_FASTERWHISPER=false +LITE=false CUDA_VERSION=12.4 print_help() { @@ -22,8 +21,7 @@ print_help() { echo "" echo "Options:" echo " --cuda 12.4|12.8 Specify the CUDA VERSION (REQUIRED)" - echo " --funasr Build with FunASR Paraformer Model" - echo " --faster-whisper Build with Faster-Whisper-Large-V3 Model" + echo " --lite Build a Lite Image" echo " -h, --help Show this help message and exit" echo "" echo "Examples:" @@ -55,12 +53,8 @@ while [[ $# -gt 0 ]]; do esac shift 2 ;; - --funasr) - USE_FUNASR=true - shift - ;; - --faster-whisper) - USE_FASTERWHISPER=true + --lite) + LITE=true shift ;; *) @@ -73,7 +67,6 @@ done docker build \ --build-arg CUDA_VERSION=$CUDA_VERSION \ - --build-arg USE_FUNASR=$USE_FUNASR \ - --build-arg USE_FASTERWHISPER=$USE_FASTERWHISPER \ + --build-arg LITE=$LITE \ -t "${USER}/gpt-sovits:local" \ . diff --git a/install.sh b/install.sh index 615bec47..c26abfa5 100644 --- a/install.sh +++ b/install.sh @@ -162,7 +162,7 @@ else echo "Download Pretrained Models" $WGET_CMD "$PRETRINED_URL" - unzip pretrained_models.zip + unzip -q pretrained_models.zip rm -rf pretrained_models.zip mv pretrained_models/* GPT_SoVITS/pretrained_models rm -rf pretrained_models @@ -172,7 +172,7 @@ if [ ! -d "GPT_SoVITS/text/G2PWModel" ]; then echo "Download G2PWModel" $WGET_CMD "$G2PW_URL" - unzip G2PWModel.zip + unzip -q G2PWModel.zip rm -rf G2PWModel.zip mv G2PWModel GPT_SoVITS/text/G2PWModel else @@ -186,7 +186,7 @@ if [ "$DOWNLOAD_UVR5" = "true" ]; then echo "Download UVR5 Model" $WGET_CMD "$UVR5_URL" - unzip uvr5_weights.zip + unzip -q uvr5_weights.zip rm -rf uvr5_weights.zip mv uvr5_weights/* tools/uvr5/uvr5_weights rm -rf uvr5_weights From 41142a62345c7aabf960f043c927bc9430b5ff12 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 22:17:34 +0100 Subject: [PATCH 036/183] Fix Bugs --- Docker/anaconda_install.sh | 4 ++-- Docker/setup.sh | 12 +++++++++++- Dockerfile | 2 +- install.sh | 12 ++++++------ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index a22ae66f..aae4c1c5 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -41,6 +41,6 @@ rm anaconda.sh rm $LOG_PATH -rm -rf "$HOME/anaconda3/pkgs" +rm -rf "$HOME/anaconda3/pkgs/*" -mkdir "$HOME/anaconda3/pkgs" +rm -rf "$HOME/.conda" "$HOME/.cache" diff --git a/Docker/setup.sh b/Docker/setup.sh index 69d813b7..17b59251 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -48,6 +48,12 @@ fi source "$HOME/anaconda3/etc/profile.d/conda.sh" +conda config --add channels conda-forge + +conda config --set channel_priority strict + +conda update -n base -c conda-forge conda -y + if [ "$LITE" = "true" ]; then bash install.sh --device "CU${CUDA_VERSION//./}" --source HF elif [ "$LITE" = "false" ]; then @@ -60,4 +66,8 @@ pip cache purge pip show torch -rm -rf "$HOME/.cache" /tmp/* /var/tmp/* +rm -rf /tmp/* /var/tmp/* + +rm -rf "$HOME/anaconda3/pkgs/*" + +rm -rf /root/.conda /root/.cache diff --git a/Dockerfile b/Dockerfile index 11e09c71..ccab9b9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq && \ curl \ unzip \ git \ - vim \ + nano \ htop \ procps \ ca-certificates \ diff --git a/install.sh b/install.sh index c26abfa5..cb784385 100644 --- a/install.sh +++ b/install.sh @@ -126,16 +126,16 @@ fi # 安装构建工具 # Install build tools echo "Installing GCC..." -conda install -c conda-forge gcc=14 -y +conda install -c conda-forge gcc=14 -y --quiet echo "Installing G++..." -conda install -c conda-forge gxx -y +conda install -c conda-forge gxx -y --quiet echo "Installing ffmpeg and cmake..." -conda install ffmpeg cmake make -y +conda install ffmpeg cmake make -y --quiet echo "Installing unzip..." -conda install unzip -y +conda install unzip -y --quiet if [ "$USE_HF" = "true" ]; then echo "Download Model From HuggingFace" @@ -246,9 +246,9 @@ echo "Installing Python dependencies from requirements.txt..." # Refresh environment hash -r -pip install -r extra-req.txt --no-deps +pip install -r extra-req.txt --no-deps --quiet -pip install -r requirements.txt +pip install -r requirements.txt --quiet python -c "import nltk; nltk.download(['averaged_perceptron_tagger','averaged_perceptron_tagger_eng','cmudict'])" From 559dbfc7114a19c2513a38bc5b5434a14fb6d085 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 22:33:23 +0100 Subject: [PATCH 037/183] update conda --- Docker/setup.sh | 2 +- install.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Docker/setup.sh b/Docker/setup.sh index 17b59251..55ef884c 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -52,7 +52,7 @@ conda config --add channels conda-forge conda config --set channel_priority strict -conda update -n base -c conda-forge conda -y +conda install -n base -c conda-forge conda=25.3.1 if [ "$LITE" = "true" ]; then bash install.sh --device "CU${CUDA_VERSION//./}" --source HF diff --git a/install.sh b/install.sh index cb784385..67c59ffb 100644 --- a/install.sh +++ b/install.sh @@ -154,7 +154,11 @@ elif [ "$USE_MODELSCOPE" = "true" ]; then UVR5_URL="https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/uvr5_weights.zip" fi -WGET_CMD="${WGET_CMD:-wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404}" +if [ "$WORKFLOW" = "true" ]; then + WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +else + WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +fi if find "GPT_SoVITS/pretrained_models" -mindepth 1 ! -name '.gitignore' | grep -q .; then echo "Pretrained Model Exists" From 756e0e3a9f0ad4a77b1c39dd59f959721c6cbb67 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 22:46:31 +0100 Subject: [PATCH 038/183] fix bugs --- .github/workflows/docker-publish.yaml | 8 ++++---- Docker/setup.sh | 4 +--- docker_build.sh | 5 ++++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 1f6aa35f..20dcea89 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -26,16 +26,16 @@ jobs: matrix: include: - cuda_version: 12.4 - lite: false + lite: true tag_prefix: lite-cu124 - cuda_version: 12.4 - lite: true + lite: false tag_prefix: cu124 - cuda_version: 12.8 - lite: false + lite: true tag_prefix: lite-cu128 - cuda_version: 12.8 - lite: true + lite: false tag_prefix: cu128 steps: diff --git a/Docker/setup.sh b/Docker/setup.sh index 55ef884c..14f4d8f2 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -50,9 +50,7 @@ source "$HOME/anaconda3/etc/profile.d/conda.sh" conda config --add channels conda-forge -conda config --set channel_priority strict - -conda install -n base -c conda-forge conda=25.3.1 +conda update --all -y if [ "$LITE" = "true" ]; then bash install.sh --device "CU${CUDA_VERSION//./}" --source HF diff --git a/docker_build.sh b/docker_build.sh index 28e731ae..ea4960cd 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -65,8 +65,11 @@ while [[ $# -gt 0 ]]; do esac done +TARGETPLATFORM=$(uname -m | grep -q 'x86_64' && echo "linux/amd64" || echo "linux/arm64") + docker build \ --build-arg CUDA_VERSION=$CUDA_VERSION \ --build-arg LITE=$LITE \ - -t "${USER}/gpt-sovits:local" \ + --build-arg TARGETPLATFORM="$TARGETPLATFORM" +-t "${USER}/gpt-sovits:local" \ . From b6d7e971a915dc381e4c3ca003fd7ab45ca6552d Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 23:20:30 +0100 Subject: [PATCH 039/183] Fix Bugs --- Docker/anaconda_install.sh | 4 +++- Docker/setup.sh | 10 +++++++++- Dockerfile | 1 - docker_build.sh | 4 ++-- install.sh | 4 ++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index aae4c1c5..f5bce252 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -41,6 +41,8 @@ rm anaconda.sh rm $LOG_PATH -rm -rf "$HOME/anaconda3/pkgs/*" +sudo rm -rf "$HOME/anaconda3/pkgs" + +mkdir "$HOME/anaconda3/pkgs" rm -rf "$HOME/.conda" "$HOME/.cache" diff --git a/Docker/setup.sh b/Docker/setup.sh index 14f4d8f2..392a8043 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -52,6 +52,12 @@ conda config --add channels conda-forge conda update --all -y +if [ "$CUDA_VERSION" = 128 ]; then + pip install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128 +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 +fi + if [ "$LITE" = "true" ]; then bash install.sh --device "CU${CUDA_VERSION//./}" --source HF elif [ "$LITE" = "false" ]; then @@ -66,6 +72,8 @@ pip show torch rm -rf /tmp/* /var/tmp/* -rm -rf "$HOME/anaconda3/pkgs/*" +sudo rm -rf "$HOME/anaconda3/pkgs" + +mkdir "$HOME/anaconda3/pkgs" rm -rf /root/.conda /root/.cache diff --git a/Dockerfile b/Dockerfile index ccab9b9f..ed53883d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,6 @@ ENV WORKFLOW=${WORKFLOW} ARG TARGETPLATFORM ENV TARGETPLATFORM=${TARGETPLATFORM} -RUN echo "${TARGETPLATFORM}" && echo ${WORKFLOW} ENV HOME="/root" diff --git a/docker_build.sh b/docker_build.sh index ea4960cd..88bf1a3c 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -70,6 +70,6 @@ TARGETPLATFORM=$(uname -m | grep -q 'x86_64' && echo "linux/amd64" || echo "linu docker build \ --build-arg CUDA_VERSION=$CUDA_VERSION \ --build-arg LITE=$LITE \ - --build-arg TARGETPLATFORM="$TARGETPLATFORM" --t "${USER}/gpt-sovits:local" \ + --build-arg TARGETPLATFORM="$TARGETPLATFORM" \ + -t "${USER}/gpt-sovits:local" \ . diff --git a/install.sh b/install.sh index 67c59ffb..30ed3ca0 100644 --- a/install.sh +++ b/install.sh @@ -226,14 +226,14 @@ if [ "$USE_ROCM" = true ] && [ "$WORKFLOW" = false ]; then fi fi -if [ "$USE_CUDA" = true ]; then +if [ "$USE_CUDA" = true ] && [ "$WORKFLOW" = false ]; then echo "Installing PyTorch with CUDA support..." if [ "$CUDA_VERSION" = 128 ]; then pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128 elif [ "$CUDA_VERSION" = 124 ]; then pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 fi -elif [ "$USE_ROCM" = true ]; then +elif [ "$USE_ROCM" = true ] && [ "$WORKFLOW" = false ]; then echo "Installing PyTorch with ROCm support..." pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/rocm6.2 elif [ "$USE_CPU" = true ]; then From 0ac28b42aee056da3247b87f56101e65e4789ef9 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 23:27:21 +0100 Subject: [PATCH 040/183] fix bugs --- Docker/anaconda_install.sh | 2 +- Docker/setup.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index f5bce252..29550c17 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -41,7 +41,7 @@ rm anaconda.sh rm $LOG_PATH -sudo rm -rf "$HOME/anaconda3/pkgs" +rm -rf "$HOME/anaconda3/pkgs" mkdir "$HOME/anaconda3/pkgs" diff --git a/Docker/setup.sh b/Docker/setup.sh index 392a8043..bca6d1e6 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -52,6 +52,10 @@ conda config --add channels conda-forge conda update --all -y +rm -rf "$HOME/anaconda3/pkgs" + +mkdir "$HOME/anaconda3/pkgs" + if [ "$CUDA_VERSION" = 128 ]; then pip install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128 elif [ "$CUDA_VERSION" = 124 ]; then @@ -72,7 +76,7 @@ pip show torch rm -rf /tmp/* /var/tmp/* -sudo rm -rf "$HOME/anaconda3/pkgs" +rm -rf "$HOME/anaconda3/pkgs" mkdir "$HOME/anaconda3/pkgs" From ac5ed0ad61a541d73974fd11bf362fdc3b8f3986 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 23:37:22 +0100 Subject: [PATCH 041/183] . --- Dockerfile | 3 ++- docker_build.sh | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ed53883d..ddefd9b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ ARG CUDA_VERSION=12.4 +ARG CUDA_BASE=runtime -FROM nvidia/cuda:${CUDA_VERSION}.1-cudnn-devel-ubuntu22.04 +FROM nvidia/cuda:${CUDA_VERSION}.1-cudnn-${CUDA_BASE}-ubuntu22.04 LABEL maintainer="XXXXRT" LABEL version="V4-0501" diff --git a/docker_build.sh b/docker_build.sh index 88bf1a3c..8aa9a063 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -67,9 +67,16 @@ done TARGETPLATFORM=$(uname -m | grep -q 'x86_64' && echo "linux/amd64" || echo "linux/arm64") +if [ $LITE = true ]; then + CUDA_BASE="runtime" +else + CUDA_BASE="devel" +fi + docker build \ --build-arg CUDA_VERSION=$CUDA_VERSION \ --build-arg LITE=$LITE \ --build-arg TARGETPLATFORM="$TARGETPLATFORM" \ + --build-arg CUDA_BASE=$CUDA_BASE \ -t "${USER}/gpt-sovits:local" \ . From f192a5da9a0111f91ac6a3165f618c9b2d0f3fa0 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 23:40:24 +0100 Subject: [PATCH 042/183] . --- Docker/anaconda_install.sh | 6 ++++++ Docker/setup.sh | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index 29550c17..1b13de3a 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -39,6 +39,12 @@ fi rm anaconda.sh +source "$HOME/anaconda3/etc/profile.d/conda.sh" + +"$HOME/anaconda3/bin/conda" config --add channels conda-forge + +"$HOME/anaconda3/bin/conda" update --all -y + rm $LOG_PATH rm -rf "$HOME/anaconda3/pkgs" diff --git a/Docker/setup.sh b/Docker/setup.sh index bca6d1e6..097746dc 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -48,14 +48,6 @@ fi source "$HOME/anaconda3/etc/profile.d/conda.sh" -conda config --add channels conda-forge - -conda update --all -y - -rm -rf "$HOME/anaconda3/pkgs" - -mkdir "$HOME/anaconda3/pkgs" - if [ "$CUDA_VERSION" = 128 ]; then pip install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128 elif [ "$CUDA_VERSION" = 124 ]; then From 313327906a7560140358536c2d7e3afc31f86db4 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 23:42:29 +0100 Subject: [PATCH 043/183] Quiet Installation --- Docker/anaconda_install.sh | 2 +- install.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index 1b13de3a..69d8f7a0 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -43,7 +43,7 @@ source "$HOME/anaconda3/etc/profile.d/conda.sh" "$HOME/anaconda3/bin/conda" config --add channels conda-forge -"$HOME/anaconda3/bin/conda" update --all -y +"$HOME/anaconda3/bin/conda" update -q --all -y rm $LOG_PATH diff --git a/install.sh b/install.sh index 30ed3ca0..9602c731 100644 --- a/install.sh +++ b/install.sh @@ -126,13 +126,13 @@ fi # 安装构建工具 # Install build tools echo "Installing GCC..." -conda install -c conda-forge gcc=14 -y --quiet +conda install -c conda-forge gcc=14 -q -y echo "Installing G++..." -conda install -c conda-forge gxx -y --quiet +conda install -c conda-forge gxx -q -y echo "Installing ffmpeg and cmake..." -conda install ffmpeg cmake make -y --quiet +conda install ffmpeg cmake make -q -y echo "Installing unzip..." conda install unzip -y --quiet From d21d3d1f5af5740998f749270832e041d19c639b Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 30 Apr 2025 23:50:52 +0100 Subject: [PATCH 044/183] fix bugs --- install.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 9602c731..f141be7f 100644 --- a/install.sh +++ b/install.sh @@ -236,12 +236,9 @@ if [ "$USE_CUDA" = true ] && [ "$WORKFLOW" = false ]; then elif [ "$USE_ROCM" = true ] && [ "$WORKFLOW" = false ]; then echo "Installing PyTorch with ROCm support..." pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/rocm6.2 -elif [ "$USE_CPU" = true ]; then +elif [ "$USE_CPU" = true ] && [ "$WORKFLOW" = false ]; then echo "Installing PyTorch for CPU..." pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cpu -else - echo "Unknown Err" - exit 1 fi echo "Installing Python dependencies from requirements.txt..." From 32caca79bffb9cfa7359bb7697204c4c0ef1d531 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 00:10:49 +0100 Subject: [PATCH 045/183] . --- Docker/anaconda_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index 69d8f7a0..3b578ad0 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -43,7 +43,7 @@ source "$HOME/anaconda3/etc/profile.d/conda.sh" "$HOME/anaconda3/bin/conda" config --add channels conda-forge -"$HOME/anaconda3/bin/conda" update -q --all -y +"$HOME/anaconda3/bin/conda" update -q --all -y 1>/dev/null rm $LOG_PATH From 5cb3fe777cddba644d3eb2857ee0e78aebd4641c Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 00:46:33 +0100 Subject: [PATCH 046/183] fix bug --- Docker/setup.sh | 5 +++++ Dockerfile | 16 +++++++++------- docker-compose.yaml | 12 ++++++------ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Docker/setup.sh b/Docker/setup.sh index 097746dc..28dab49c 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -62,6 +62,11 @@ else exit 1 fi +mkdir -p /workspace/model +mv /workspace/GPT-SoVITS/pretrained_models /workspace/model/ +mv /workspace/tools/asr/models /workspace/model/ +mv /workspace/tools/uvr5/uvr5_weights /workspace/model/ + pip cache purge pip show torch diff --git a/Dockerfile b/Dockerfile index ddefd9b0..371fe032 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,9 +44,6 @@ ENV HOME="/root" RUN bash Docker/anaconda_install.sh -RUN echo "== $HOME/anaconda3/pkgs ==" && du -h --max-depth=2 $HOME/anaconda3/pkgs | sort -hr | head -n 10 && \ - echo "== $HOME/anaconda3 ==" && du -h --max-depth=2 $HOME/anaconda3 | sort -hr | head -n 10 - ENV PATH="$HOME/anaconda3/bin:$PATH" SHELL ["/bin/bash", "-c"] @@ -57,11 +54,16 @@ ENV MAKEFLAGS="-j$(nproc)" RUN bash Docker/setup.sh -RUN echo "== $HOME/anaconda3/pkgs ==" && du -h --max-depth=2 $HOME/anaconda3/pkgs | sort -hr | head -n 10 && \ - echo "== $HOME/anaconda3 ==" && du -h --max-depth=2 $HOME/anaconda3 | sort -hr | head -n 10 - EXPOSE 9871 9872 9873 9874 9880 ENV PYTHONPATH="/workspace/GPT-SoVITS" -CMD ["/bin/bash", "-c", "source $HOME/anaconda3/etc/profile.d/conda.sh && exec bash"] \ No newline at end of file +CMD ["/bin/bash", "-c", "\ + source $HOME/anaconda3/etc/profile.d/conda.sh && \ + rm -rf /workspace/GPT-SoVITS/pretrained_models && \ + rm -rf /workspace/tools/asr/models && \ + rm -rf /workspace/tools/uvr5/uvr5_weights && \ + ln -s /workspace/model/pretrained_models /workspace/GPT-SoVITS/pretrained_models && \ + ln -s /workspace/model/models /workspace/tools/asr/models && \ + ln -s /workspace/model/uvr5_weights /workspace/tools/uvr5/uvr5_weights && \ + exec bash"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index f05c4e23..28ef3a63 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -12,9 +12,9 @@ services: - "9880:9880" volumes: - .:/workspace/GPT-SoVITS - - /workspace/GPT-SoVITS/pretrained_models - - /workspace/tools/asr/models - - /workspace/tools/uvr5/uvr5_weights + - /dev/null:/workspace/GPT-SoVITS/pretrained_models + - /dev/null:/workspace/tools/asr/models + - /dev/null:/workspace/tools/uvr5/uvr5_weights environment: - is_half=true tty: true @@ -33,9 +33,9 @@ services: - "9880:9880" volumes: - .:/workspace/GPT-SoVITS - - /workspace/GPT-SoVITS/pretrained_models - - /workspace/tools/asr/models - - /workspace/tools/uvr5/uvr5_weights + - /dev/null:/workspace/GPT-SoVITS/pretrained_models + - /dev/null:/workspace/tools/asr/models + - /dev/null:/workspace/tools/uvr5/uvr5_weights environment: - is_half=true tty: true From 1662c45a1755e8ff7d301595dfabd7b9b4666247 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 00:53:22 +0100 Subject: [PATCH 047/183] . --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 371fe032..9b995329 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ ARG CUDA_VERSION=12.4 ENV CUDA_VERSION=${CUDA_VERSION} -RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq && \ +RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq 1>/dev/null && \ apt-get install -y -qq --no-install-recommends \ build-essential \ gcc \ @@ -25,6 +25,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq && \ procps \ ca-certificates \ locales \ + 1>/dev/null \ && rm -rf /var/lib/apt/lists/* WORKDIR /workspace/GPT-SoVITS From 1c780def2efe822f0593409042be24d09a0418d0 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 02:29:57 +0100 Subject: [PATCH 048/183] Fix pre-commit.ci and Docker --- .pre-commit-config.yaml | 4 ++-- Docker/setup.sh | 6 +++--- Dockerfile | 12 ++++++------ docker_build.sh | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 31a27a15..ce29fa73 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,11 +8,11 @@ repos: # Run the linter. - id: ruff types_or: [ python, pyi ] - args: [ --fix ] + args: [ --fix, --exit-zero ] # Run the formatter. - id: ruff-format types_or: [ python, pyi ] - args: [--line-length=120] + args: [ --line-length=120, --target-version py310 ] - repo: https://github.com/codespell-project/codespell rev: v2.4.1 diff --git a/Docker/setup.sh b/Docker/setup.sh index 28dab49c..9653be42 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -63,9 +63,9 @@ else fi mkdir -p /workspace/model -mv /workspace/GPT-SoVITS/pretrained_models /workspace/model/ -mv /workspace/tools/asr/models /workspace/model/ -mv /workspace/tools/uvr5/uvr5_weights /workspace/model/ +mv /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models /workspace/model/ +mv /workspace/GPT-SoVITS/tools/asr/models /workspace/model/ +mv /workspace/GPT-SoVITS/tools/uvr5/uvr5_weights /workspace/model/ pip cache purge diff --git a/Dockerfile b/Dockerfile index 9b995329..70e27808 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,10 +61,10 @@ ENV PYTHONPATH="/workspace/GPT-SoVITS" CMD ["/bin/bash", "-c", "\ source $HOME/anaconda3/etc/profile.d/conda.sh && \ - rm -rf /workspace/GPT-SoVITS/pretrained_models && \ - rm -rf /workspace/tools/asr/models && \ - rm -rf /workspace/tools/uvr5/uvr5_weights && \ - ln -s /workspace/model/pretrained_models /workspace/GPT-SoVITS/pretrained_models && \ - ln -s /workspace/model/models /workspace/tools/asr/models && \ - ln -s /workspace/model/uvr5_weights /workspace/tools/uvr5/uvr5_weights && \ + rm -rf /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models && \ + rm -rf /workspace/GPT-SoVITS/tools/asr/models && \ + rm -rf /workspace/GPT-SoVITS/tools/uvr5/uvr5_weights && \ + ln -s /workspace/model/pretrained_models /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models && \ + ln -s /workspace/model/models /workspace/GPT-SoVITS/tools/asr/models && \ + ln -s /workspace/model/uvr5_weights /workspace/GPT-SoVITS/tools/uvr5/uvr5_weights && \ exec bash"] \ No newline at end of file diff --git a/docker_build.sh b/docker_build.sh index 8aa9a063..d156fd85 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -65,7 +65,7 @@ while [[ $# -gt 0 ]]; do esac done -TARGETPLATFORM=$(uname -m | grep -q 'x86_64' && echo "linux/amd64" || echo "linux/arm64") +TARGETPLATFORM=$(uname -m | grep -q 'x86' && echo "linux/amd64" || echo "linux/arm64") if [ $LITE = true ]; then CUDA_BASE="runtime" From c14575ffec6c6628657206a33d47efaebb747e58 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 03:05:50 +0100 Subject: [PATCH 049/183] fix bugs --- .github/workflows/docker-publish.yaml | 4 ++-- Docker/anaconda_install.sh | 2 ++ Docker/setup.sh | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 20dcea89..767a4743 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -27,13 +27,13 @@ jobs: include: - cuda_version: 12.4 lite: true - tag_prefix: lite-cu124 + tag_prefix: cu124-lite - cuda_version: 12.4 lite: false tag_prefix: cu124 - cuda_version: 12.8 lite: true - tag_prefix: lite-cu128 + tag_prefix: cu128-lite - cuda_version: 12.8 lite: false tag_prefix: cu128 diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index 3b578ad0..da916714 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -45,6 +45,8 @@ source "$HOME/anaconda3/etc/profile.d/conda.sh" "$HOME/anaconda3/bin/conda" update -q --all -y 1>/dev/null +"$HOME/anaconda3/bin/conda" install python=3.11 -q -y + rm $LOG_PATH rm -rf "$HOME/anaconda3/pkgs" diff --git a/Docker/setup.sh b/Docker/setup.sh index 9653be42..381d7e40 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -48,9 +48,13 @@ fi source "$HOME/anaconda3/etc/profile.d/conda.sh" +echo "CUDA_VERSION: $CUDA_VERSION" + if [ "$CUDA_VERSION" = 128 ]; then + echo 1111111 pip install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128 elif [ "$CUDA_VERSION" = 124 ]; then + echo 2222222 pip install torch==2.5.1 torchaudio==2.5.1 --no-cache-dir --index-url https://download.pytorch.org/whl/cu124 fi From 4c4a84f63a46ad3d8f1f6a473372aeae59e8ae33 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 03:47:02 +0100 Subject: [PATCH 050/183] . --- Docker/setup.sh | 8 ++------ install.sh | 10 ++++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Docker/setup.sh b/Docker/setup.sh index 381d7e40..2b4c093e 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -48,13 +48,9 @@ fi source "$HOME/anaconda3/etc/profile.d/conda.sh" -echo "CUDA_VERSION: $CUDA_VERSION" - -if [ "$CUDA_VERSION" = 128 ]; then - echo 1111111 +if [ "$CUDA_VERSION" = 12.8 ]; then pip install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128 -elif [ "$CUDA_VERSION" = 124 ]; then - echo 2222222 +elif [ "$CUDA_VERSION" = 12.4 ]; then pip install torch==2.5.1 torchaudio==2.5.1 --no-cache-dir --index-url https://download.pytorch.org/whl/cu124 fi diff --git a/install.sh b/install.sh index f141be7f..fdb91c33 100644 --- a/install.sh +++ b/install.sh @@ -69,11 +69,11 @@ while [[ $# -gt 0 ]]; do --device) case "$2" in CU124) - CUDA_VERSION=124 + CUDA=124 USE_CUDA=true ;; CU128) - CUDA_VERSION=128 + CUDA=128 USE_CUDA=true ;; ROCM) @@ -228,9 +228,11 @@ fi if [ "$USE_CUDA" = true ] && [ "$WORKFLOW" = false ]; then echo "Installing PyTorch with CUDA support..." - if [ "$CUDA_VERSION" = 128 ]; then + if [ "$CUDA" = 128 ]; then + echo 11111 pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128 - elif [ "$CUDA_VERSION" = 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 fi elif [ "$USE_ROCM" = true ] && [ "$WORKFLOW" = false ]; then From e0868625952d898c68e7f9cd5167cee610c52c50 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 11:01:12 +0100 Subject: [PATCH 051/183] Update Docker & Pre-Commit --- .github/workflows/docker-publish.yaml | 184 +++++++++++++++++++++++--- .pre-commit-config.yaml | 2 +- Docker/anaconda_install.sh | 6 + Docker/setup.sh | 8 +- Dockerfile | 21 +-- docker_build.sh | 4 +- install.sh | 5 +- 7 files changed, 186 insertions(+), 44 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 767a4743..f83ee1eb 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -5,7 +5,7 @@ on: jobs: generate-meta: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: tag: ${{ steps.meta.outputs.tag }} steps: @@ -18,24 +18,27 @@ jobs: DATE=$(date +'%Y%m%d') COMMIT=$(git rev-parse --short=6 HEAD) echo "tag=${DATE}-${COMMIT}" >> $GITHUB_OUTPUT - - build-and-push: + build-amd64: needs: generate-meta - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: include: - - cuda_version: 12.4 + - cuda_version: 124 lite: true + cuda_base: runtime tag_prefix: cu124-lite - - cuda_version: 12.4 + - cuda_version: 124 lite: false + cuda_base: devel tag_prefix: cu124 - - cuda_version: 12.8 + - cuda_version: 128 lite: true + cuda_base: runtime tag_prefix: cu128-lite - - cuda_version: 12.8 + - cuda_version: 128 lite: false + cuda_base: devel tag_prefix: cu128 steps: @@ -73,7 +76,6 @@ jobs: 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 @@ -87,19 +89,169 @@ jobs: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - name: Build and Push Docker Image + - name: Build and Push Docker Image (amd64) uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile - push: false - platforms: linux/amd64,linux/arm64 + push: true + platforms: linux/amd64 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 }} - xxxxrt666/gpt-sovits:latest-${{ matrix.tag_prefix }} - cache-from: type=gha - # cache-to: type=gha,mode=max \ No newline at end of file + xxxxrt666/gpt-sovits:${{ matrix.tag_prefix }}-${{ needs.generate-meta.outputs.tag }}-amd64 + xxxxrt666/gpt-sovits:latest-${{ matrix.tag_prefix }}-amd64 + + 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 \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ce29fa73..76213841 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: # Run the formatter. - id: ruff-format 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 rev: v2.4.1 diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index da916714..e97974da 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -8,6 +8,10 @@ cd "$SCRIPT_DIR" || exit 1 cd .. || exit 1 +if [ -d "$HOME/anaconda3" ]; then + exit 0 +fi + WORKFLOW=${WORKFLOW:-"false"} 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 gcc=14 gxx ffmpeg cmake make unzip -q -y + rm $LOG_PATH rm -rf "$HOME/anaconda3/pkgs" diff --git a/Docker/setup.sh b/Docker/setup.sh index 2b4c093e..af907015 100644 --- a/Docker/setup.sh +++ b/Docker/setup.sh @@ -48,16 +48,16 @@ fi 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 -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 fi 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 - bash install.sh --device "CU${CUDA_VERSION//./}" --source HF --download-uvr5 + bash install.sh --device "CU${CUDA_VERSION}" --source HF --download-uvr5 else exit 1 fi diff --git a/Dockerfile b/Dockerfile index 70e27808..a945e1d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -ARG CUDA_VERSION=12.4 +ARG CUDA_VERSION=124 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 version="V4-0501" @@ -11,23 +11,6 @@ ARG CUDA_VERSION=12.4 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 COPY . /workspace/GPT-SoVITS diff --git a/docker_build.sh b/docker_build.sh index d156fd85..0bc9ae1a 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -40,10 +40,10 @@ while [[ $# -gt 0 ]]; do --cuda) case "$2" in 12.4) - CUDA_VERSION=12.4 + CUDA_VERSION=124 ;; 12.8) - CUDA_VERSION=12.8 + CUDA_VERSION=128 ;; *) echo "Error: Invalid CUDA_VERSION: $2" diff --git a/install.sh b/install.sh index fdb91c33..006022f5 100644 --- a/install.sh +++ b/install.sh @@ -229,10 +229,8 @@ fi if [ "$USE_CUDA" = true ] && [ "$WORKFLOW" = false ]; then echo "Installing PyTorch with CUDA support..." if [ "$CUDA" = 128 ]; then - echo 11111 pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128 elif [ "$CUDA" = 124 ]; then - echo 22222 pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 fi 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 echo "Installing PyTorch for 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 echo "Installing Python dependencies from requirements.txt..." From cb94e52aa51e2831b0e79a1186ab90135481083f Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 11:04:53 +0100 Subject: [PATCH 052/183] fix bugs --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a945e1d0..edf63a4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG CUDA_VERSION=124 ARG CUDA_BASE=runtime -FROM xxxxrt666/gpt-sovits:latest-cu{CUDA_VERSION}-${CUDA_BASE}-base +FROM xxxxrt666/gpt-sovits:latest-cu${CUDA_VERSION}-${CUDA_BASE}-base LABEL maintainer="XXXXRT" LABEL version="V4-0501" From adbcdc22a54dd0b1f27437500451a23323f7b408 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 11:21:09 +0100 Subject: [PATCH 053/183] Update Req --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 9703b250..418b81f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,8 +6,8 @@ numba pytorch-lightning>=2.4 gradio<5 ffmpeg-python -onnxruntime; sys_platform == 'darwin' -onnxruntime-gpu; sys_platform != 'darwin' +onnxruntime; platform_machine in ("aarch64", "arm64") +onnxruntime-gpu; platform_machine in ("x86_64", "AMD64") tqdm funasr==1.0.27 cn2an From 893c29e711e91f4108fa13df67d92d0bb9106492 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 11:31:04 +0100 Subject: [PATCH 054/183] Update Req --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 418b81f3..5d8a0c5c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,8 +6,8 @@ numba pytorch-lightning>=2.4 gradio<5 ffmpeg-python -onnxruntime; platform_machine in ("aarch64", "arm64") -onnxruntime-gpu; platform_machine in ("x86_64", "AMD64") +onnxruntime; platform_machine == "aarch64" or platform_machine == "arm64" +onnxruntime-gpu; platform_machine == "x86_64" or platform_machine == "AMD64" tqdm funasr==1.0.27 cn2an From 0f3b8bd8cc7c2e23061c87f09311b63b4a2bc573 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 12:05:11 +0100 Subject: [PATCH 055/183] Update OpenCC --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 5d8a0c5c..07431a06 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +--no-binary=opencc numpy<2.0 scipy tensorboard @@ -31,8 +32,7 @@ rotary_embedding_torch ToJyutping g2pk2 ko_pron -opencc; sys_platform != 'linux' -opencc==1.1.1; sys_platform == 'linux' +opencc python_mecab_ko; sys_platform != 'win32' fastapi[standard]>=0.115.2 x_transformers From 4b1a8b298952983d92cb177c23d4284e1e6db4d8 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 12:07:24 +0100 Subject: [PATCH 056/183] update precommit --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 76213841..fa541354 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,8 +14,8 @@ repos: types_or: [ python, pyi ] args: [ --line-length, "120", --target-version, "py310" ] -- repo: https://github.com/codespell-project/codespell - rev: v2.4.1 - hooks: - - id: codespell - files: ^.*\.(py|md)$ \ No newline at end of file +# - repo: https://github.com/codespell-project/codespell +# rev: v2.4.1 +# hooks: +# - id: codespell +# files: ^.*\.(py|md)$ \ No newline at end of file From d3176bc50ec0a2d2e313f078b409c0c7d5e35d09 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 12:16:21 +0100 Subject: [PATCH 057/183] . --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa541354..d5e92658 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: # Run the linter. - id: ruff types_or: [ python, pyi ] - args: [ --fix, --exit-zero ] + args: [ --fix, --exit-zero, --quiet ] # Run the formatter. - id: ruff-format types_or: [ python, pyi ] From d6f9c53700bbd7849a28b5e27d5253c73eed6f4d Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 12:27:07 +0100 Subject: [PATCH 058/183] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d5e92658..f3829691 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,9 +13,3 @@ repos: - id: ruff-format types_or: [ python, pyi ] args: [ --line-length, "120", --target-version, "py310" ] - -# - repo: https://github.com/codespell-project/codespell -# rev: v2.4.1 -# hooks: -# - id: codespell -# files: ^.*\.(py|md)$ \ No newline at end of file From 5fc2bf893e4ddadc8e755a063607810a3765f29b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 1 May 2025 11:28:24 +0000 Subject: [PATCH 059/183] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- GPT_SoVITS/TTS_infer_pack/TTS.py | 40 ++++---- GPT_SoVITS/inference_webui.py | 118 ++++++++++++--------- GPT_SoVITS/inference_webui_fast.py | 8 +- GPT_SoVITS/module/data_utils.py | 5 +- GPT_SoVITS/module/mel_processing.py | 66 ++++++++---- GPT_SoVITS/module/models.py | 11 +- GPT_SoVITS/process_ckpt.py | 8 +- GPT_SoVITS/s2_train_v3_lora.py | 8 +- tools/uvr5/lib/lib_v5/dataset.py | 28 ++--- tools/uvr5/lib/lib_v5/layers.py | 24 ++--- tools/uvr5/lib/lib_v5/layers_123812KB.py | 24 ++--- tools/uvr5/lib/lib_v5/layers_123821KB.py | 24 ++--- tools/uvr5/lib/lib_v5/layers_33966KB.py | 32 ++---- tools/uvr5/lib/lib_v5/layers_537227KB.py | 32 ++---- tools/uvr5/lib/lib_v5/layers_537238KB.py | 32 ++---- tools/uvr5/lib/lib_v5/layers_new.py | 28 ++--- tools/uvr5/lib/lib_v5/model_param_init.py | 7 +- tools/uvr5/lib/lib_v5/nets.py | 2 - tools/uvr5/lib/lib_v5/nets_537227KB.py | 1 - tools/uvr5/lib/lib_v5/nets_537238KB.py | 1 - tools/uvr5/lib/lib_v5/nets_new.py | 16 +-- tools/uvr5/lib/lib_v5/spec_utils.py | 119 +++++++--------------- tools/uvr5/lib/utils.py | 16 +-- webui.py | 36 +++++-- 24 files changed, 292 insertions(+), 394 deletions(-) diff --git a/GPT_SoVITS/TTS_infer_pack/TTS.py b/GPT_SoVITS/TTS_infer_pack/TTS.py index d20daee3..6ef46eb8 100644 --- a/GPT_SoVITS/TTS_infer_pack/TTS.py +++ b/GPT_SoVITS/TTS_infer_pack/TTS.py @@ -108,7 +108,7 @@ resample_transform_dict = {} def resample(audio_tensor, sr0, sr1, device): global resample_transform_dict - key="%s-%s"%(sr0,sr1) + key = "%s-%s" % (sr0, sr1) if key not in resample_transform_dict: resample_transform_dict[key] = torchaudio.transforms.Resample(sr0, sr1).to(device) return resample_transform_dict[key](audio_tensor) @@ -252,7 +252,6 @@ class TTS_Config: "cnhuhbert_base_path": "GPT_SoVITS/pretrained_models/chinese-hubert-base", "bert_base_path": "GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large", }, - } configs: dict = None v1_languages: list = ["auto", "en", "zh", "ja", "all_zh", "all_ja"] @@ -432,7 +431,6 @@ class TTS: "aux_ref_audio_paths": [], } - self.stop_flag: bool = False self.precision: torch.dtype = torch.float16 if self.configs.is_half else torch.float32 @@ -468,7 +466,7 @@ class TTS: path_sovits = self.configs.default_configs[model_version]["vits_weights_path"] if if_lora_v3 == True and os.path.exists(path_sovits) == False: - info = path_sovits + i18n("SoVITS %s 底模缺失,无法加载相应 LoRA 权重"%model_version) + info = path_sovits + i18n("SoVITS %s 底模缺失,无法加载相应 LoRA 权重" % model_version) raise FileExistsError(info) # dict_s2 = torch.load(weights_path, map_location=self.configs.device,weights_only=False) @@ -507,7 +505,7 @@ class TTS: ) self.configs.use_vocoder = False else: - kwargs["version"]=model_version + kwargs["version"] = model_version vits_model = SynthesizerTrnV3( self.configs.filter_length // 2 + 1, self.configs.segment_size // self.configs.hop_length, @@ -572,7 +570,7 @@ class TTS: self.vocoder.cpu() del self.vocoder self.empty_cache() - + self.vocoder = BigVGAN.from_pretrained( "%s/GPT_SoVITS/pretrained_models/models--nvidia--bigvgan_v2_24khz_100band_256x" % (now_dir,), use_cuda_kernel=False, @@ -595,18 +593,21 @@ class TTS: self.empty_cache() self.vocoder = Generator( - initial_channel=100, - resblock="1", - resblock_kernel_sizes=[3, 7, 11], - resblock_dilation_sizes=[[1, 3, 5], [1, 3, 5], [1, 3, 5]], - upsample_rates=[10, 6, 2, 2, 2], - upsample_initial_channel=512, - upsample_kernel_sizes=[20, 12, 4, 4, 4], - gin_channels=0, is_bias=True - ) + initial_channel=100, + resblock="1", + resblock_kernel_sizes=[3, 7, 11], + resblock_dilation_sizes=[[1, 3, 5], [1, 3, 5], [1, 3, 5]], + upsample_rates=[10, 6, 2, 2, 2], + upsample_initial_channel=512, + upsample_kernel_sizes=[20, 12, 4, 4, 4], + gin_channels=0, + is_bias=True, + ) self.vocoder.remove_weight_norm() - state_dict_g = torch.load("%s/GPT_SoVITS/pretrained_models/gsv-v4-pretrained/vocoder.pth" % (now_dir,), map_location="cpu") - print("loading vocoder",self.vocoder.load_state_dict(state_dict_g)) + state_dict_g = torch.load( + "%s/GPT_SoVITS/pretrained_models/gsv-v4-pretrained/vocoder.pth" % (now_dir,), map_location="cpu" + ) + print("loading vocoder", self.vocoder.load_state_dict(state_dict_g)) self.vocoder_configs["sr"] = 48000 self.vocoder_configs["T_ref"] = 500 @@ -614,9 +615,6 @@ class TTS: self.vocoder_configs["upsample_rate"] = 480 self.vocoder_configs["overlapped_len"] = 12 - - - self.vocoder = self.vocoder.eval() if self.configs.is_half == True: self.vocoder = self.vocoder.half().to(self.configs.device) @@ -1439,7 +1437,7 @@ class TTS: ref_audio = ref_audio.to(self.configs.device).float() if ref_audio.shape[0] == 2: ref_audio = ref_audio.mean(0).unsqueeze(0) - + # tgt_sr = self.vocoder_configs["sr"] tgt_sr = 24000 if self.configs.version == "v3" else 32000 if ref_sr != tgt_sr: diff --git a/GPT_SoVITS/inference_webui.py b/GPT_SoVITS/inference_webui.py index 4bee27cd..3e779344 100644 --- a/GPT_SoVITS/inference_webui.py +++ b/GPT_SoVITS/inference_webui.py @@ -106,7 +106,7 @@ cnhubert.cnhubert_base_path = cnhubert_base_path import random -from GPT_SoVITS.module.models import SynthesizerTrn, SynthesizerTrnV3,Generator +from GPT_SoVITS.module.models import SynthesizerTrn, SynthesizerTrnV3, Generator def set_seed(seed): @@ -226,9 +226,9 @@ else: resample_transform_dict = {} -def resample(audio_tensor, sr0,sr1): +def resample(audio_tensor, sr0, sr1): global resample_transform_dict - key="%s-%s"%(sr0,sr1) + key = "%s-%s" % (sr0, sr1) if key not in resample_transform_dict: resample_transform_dict[key] = torchaudio.transforms.Resample(sr0, sr1).to(device) return resample_transform_dict[key](audio_tensor) @@ -238,14 +238,18 @@ def resample(audio_tensor, sr0,sr1): # symbol_version-model_version-if_lora_v3 from process_ckpt import get_sovits_version_from_path_fast, load_sovits_new -v3v4set={"v3","v4"} +v3v4set = {"v3", "v4"} + + def change_sovits_weights(sovits_path, prompt_language=None, text_language=None): global vq_model, hps, version, model_version, dict_language, if_lora_v3 version, model_version, if_lora_v3 = get_sovits_version_from_path_fast(sovits_path) - print(sovits_path,version, model_version, if_lora_v3) - is_exist=is_exist_s2gv3 if model_version=="v3"else is_exist_s2gv4 + print(sovits_path, version, model_version, if_lora_v3) + is_exist = is_exist_s2gv3 if model_version == "v3" else is_exist_s2gv4 if if_lora_v3 == True and is_exist == False: - info = "GPT_SoVITS/pretrained_models/s2Gv3.pth" + i18n("SoVITS %s 底模缺失,无法加载相应 LoRA 权重"%model_version) + info = "GPT_SoVITS/pretrained_models/s2Gv3.pth" + i18n( + "SoVITS %s 底模缺失,无法加载相应 LoRA 权重" % model_version + ) gr.Warning(info) raise FileExistsError(info) dict_language = dict_language_v1 if version == "v1" else dict_language_v2 @@ -276,10 +280,15 @@ def change_sovits_weights(sovits_path, prompt_language=None, text_language=None) prompt_language_update, text_update, text_language_update, - {"__type__": "update", "visible": visible_sample_steps, "value": 32 if model_version=="v3"else 8,"choices":[4, 8, 16, 32,64,128]if model_version=="v3"else [4, 8, 16, 32]}, + { + "__type__": "update", + "visible": visible_sample_steps, + "value": 32 if model_version == "v3" else 8, + "choices": [4, 8, 16, 32, 64, 128] if model_version == "v3" else [4, 8, 16, 32], + }, {"__type__": "update", "visible": visible_inp_refs}, {"__type__": "update", "value": False, "interactive": True if model_version not in v3v4set else False}, - {"__type__": "update", "visible": True if model_version =="v3" else False}, + {"__type__": "update", "visible": True if model_version == "v3" else False}, {"__type__": "update", "value": i18n("模型加载中,请等待"), "interactive": False}, ) @@ -304,7 +313,7 @@ def change_sovits_weights(sovits_path, prompt_language=None, text_language=None) ) model_version = version else: - hps.model.version=model_version + hps.model.version = model_version vq_model = SynthesizerTrnV3( hps.data.filter_length // 2 + 1, hps.train.segment_size // hps.data.hop_length, @@ -326,7 +335,7 @@ def change_sovits_weights(sovits_path, prompt_language=None, text_language=None) else: path_sovits = path_sovits_v3 if model_version == "v3" else path_sovits_v4 print( - "loading sovits_%spretrained_G"%model_version, + "loading sovits_%spretrained_G" % model_version, vq_model.load_state_dict(load_sovits_new(path_sovits)["weight"], strict=False), ) lora_rank = dict_s2["lora_rank"] @@ -337,7 +346,7 @@ def change_sovits_weights(sovits_path, prompt_language=None, text_language=None) init_lora_weights=True, ) vq_model.cfm = get_peft_model(vq_model.cfm, lora_config) - print("loading sovits_%s_lora%s" % (model_version,lora_rank)) + print("loading sovits_%s_lora%s" % (model_version, lora_rank)) vq_model.load_state_dict(dict_s2["weight"], strict=False) vq_model.cfm = vq_model.cfm.merge_and_unload() # torch.save(vq_model.state_dict(),"merge_win.pth") @@ -350,10 +359,15 @@ def change_sovits_weights(sovits_path, prompt_language=None, text_language=None) prompt_language_update, text_update, text_language_update, - {"__type__": "update", "visible": visible_sample_steps, "value":32 if model_version=="v3"else 8,"choices":[4, 8, 16, 32,64,128]if model_version=="v3"else [4, 8, 16, 32]}, + { + "__type__": "update", + "visible": visible_sample_steps, + "value": 32 if model_version == "v3" else 8, + "choices": [4, 8, 16, 32, 64, 128] if model_version == "v3" else [4, 8, 16, 32], + }, {"__type__": "update", "visible": visible_inp_refs}, {"__type__": "update", "value": False, "interactive": True if model_version not in v3v4set else False}, - {"__type__": "update", "visible": True if model_version =="v3" else False}, + {"__type__": "update", "visible": True if model_version == "v3" else False}, {"__type__": "update", "value": i18n("合成语音"), "interactive": True}, ) with open("./weight.json") as f: @@ -400,7 +414,7 @@ now_dir = os.getcwd() def init_bigvgan(): - global bigvgan_model,hifigan_model + global bigvgan_model, hifigan_model from BigVGAN import bigvgan bigvgan_model = bigvgan.BigVGAN.from_pretrained( @@ -411,17 +425,20 @@ def init_bigvgan(): bigvgan_model.remove_weight_norm() bigvgan_model = bigvgan_model.eval() if hifigan_model: - hifigan_model=hifigan_model.cpu() - hifigan_model=None - try:torch.cuda.empty_cache() - except:pass + hifigan_model = hifigan_model.cpu() + hifigan_model = None + try: + torch.cuda.empty_cache() + except: + pass if is_half == True: bigvgan_model = bigvgan_model.half().to(device) else: bigvgan_model = bigvgan_model.to(device) + def init_hifigan(): - global hifigan_model,bigvgan_model + global hifigan_model, bigvgan_model hifigan_model = Generator( initial_channel=100, resblock="1", @@ -430,26 +447,32 @@ def init_hifigan(): upsample_rates=[10, 6, 2, 2, 2], upsample_initial_channel=512, upsample_kernel_sizes=[20, 12, 4, 4, 4], - gin_channels=0, is_bias=True + gin_channels=0, + is_bias=True, ) hifigan_model.eval() hifigan_model.remove_weight_norm() - state_dict_g = torch.load("%s/GPT_SoVITS/pretrained_models/gsv-v4-pretrained/vocoder.pth" % (now_dir,), map_location="cpu") - print("loading vocoder",hifigan_model.load_state_dict(state_dict_g)) + state_dict_g = torch.load( + "%s/GPT_SoVITS/pretrained_models/gsv-v4-pretrained/vocoder.pth" % (now_dir,), map_location="cpu" + ) + print("loading vocoder", hifigan_model.load_state_dict(state_dict_g)) if bigvgan_model: - bigvgan_model=bigvgan_model.cpu() - bigvgan_model=None - try:torch.cuda.empty_cache() - except:pass + bigvgan_model = bigvgan_model.cpu() + bigvgan_model = None + try: + torch.cuda.empty_cache() + except: + pass if is_half == True: hifigan_model = hifigan_model.half().to(device) else: hifigan_model = hifigan_model.to(device) -bigvgan_model=hifigan_model=None -if model_version=="v3": + +bigvgan_model = hifigan_model = None +if model_version == "v3": init_bigvgan() -if model_version=="v4": +if model_version == "v4": init_hifigan() @@ -831,17 +854,17 @@ def get_tts_wav( ref_audio = ref_audio.to(device).float() if ref_audio.shape[0] == 2: ref_audio = ref_audio.mean(0).unsqueeze(0) - tgt_sr=24000 if model_version=="v3"else 32000 + tgt_sr = 24000 if model_version == "v3" else 32000 if sr != tgt_sr: - ref_audio = resample(ref_audio, sr,tgt_sr) + ref_audio = resample(ref_audio, sr, tgt_sr) # print("ref_audio",ref_audio.abs().mean()) - mel2 = mel_fn(ref_audio)if model_version=="v3"else mel_fn_v4(ref_audio) + mel2 = mel_fn(ref_audio) if model_version == "v3" else mel_fn_v4(ref_audio) mel2 = norm_spec(mel2) T_min = min(mel2.shape[2], fea_ref.shape[2]) mel2 = mel2[:, :, :T_min] fea_ref = fea_ref[:, :, :T_min] - Tref=468 if model_version=="v3"else 500 - Tchunk=934 if model_version=="v3"else 1000 + Tref = 468 if model_version == "v3" else 500 + Tchunk = 934 if model_version == "v3" else 1000 if T_min > Tref: mel2 = mel2[:, :, -Tref:] fea_ref = fea_ref[:, :, -Tref:] @@ -866,13 +889,13 @@ def get_tts_wav( cfm_resss.append(cfm_res) cfm_res = torch.cat(cfm_resss, 2) cfm_res = denorm_spec(cfm_res) - if model_version=="v3": + if model_version == "v3": if bigvgan_model == None: init_bigvgan() - else:#v4 + else: # v4 if hifigan_model == None: init_hifigan() - vocoder_model=bigvgan_model if model_version=="v3"else hifigan_model + vocoder_model = bigvgan_model if model_version == "v3" else hifigan_model with torch.inference_mode(): wav_gen = vocoder_model(cfm_res) audio = wav_gen[0][0] # .cpu().detach().numpy() @@ -886,9 +909,12 @@ def get_tts_wav( t1 = ttime() print("%.3f\t%.3f\t%.3f\t%.3f" % (t[0], sum(t[1::3]), sum(t[2::3]), sum(t[3::3]))) audio_opt = torch.cat(audio_opt, 0) # np.concatenate - if model_version in {"v1","v2"}:opt_sr=32000 - elif model_version=="v3":opt_sr=24000 - else:opt_sr=48000#v4 + if model_version in {"v1", "v2"}: + opt_sr = 32000 + elif model_version == "v3": + opt_sr = 24000 + else: + opt_sr = 48000 # v4 if if_sr == True and opt_sr == 24000: print(i18n("音频超分中")) audio_opt, opt_sr = audio_sr(audio_opt.unsqueeze(0), opt_sr) @@ -1131,16 +1157,16 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: sample_steps = ( gr.Radio( label=i18n("采样步数,如果觉得电,提高试试,如果觉得慢,降低试试"), - value=32 if model_version=="v3"else 8, - choices=[4, 8, 16, 32,64,128]if model_version=="v3"else [4, 8, 16, 32], + value=32 if model_version == "v3" else 8, + choices=[4, 8, 16, 32, 64, 128] if model_version == "v3" else [4, 8, 16, 32], visible=True, ) if model_version in v3v4set else gr.Radio( label=i18n("采样步数,如果觉得电,提高试试,如果觉得慢,降低试试"), - choices=[4, 8, 16, 32,64,128]if model_version=="v3"else [4, 8, 16, 32], + choices=[4, 8, 16, 32, 64, 128] if model_version == "v3" else [4, 8, 16, 32], visible=False, - value=32 if model_version=="v3"else 8, + value=32 if model_version == "v3" else 8, ) ) if_sr_Checkbox = gr.Checkbox( @@ -1148,7 +1174,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: value=False, interactive=True, show_label=True, - visible=False if model_version !="v3" else True, + visible=False if model_version != "v3" else True, ) gr.Markdown(html_center(i18n("*请填写需要合成的目标文本和语种模式"), "h3")) with gr.Row(): diff --git a/GPT_SoVITS/inference_webui_fast.py b/GPT_SoVITS/inference_webui_fast.py index 311994b8..0b5cbd16 100644 --- a/GPT_SoVITS/inference_webui_fast.py +++ b/GPT_SoVITS/inference_webui_fast.py @@ -262,15 +262,17 @@ SoVITS_names, GPT_names = get_weights_names(GPT_weight_root, SoVITS_weight_root) from process_ckpt import get_sovits_version_from_path_fast -v3v4set={"v3","v4"} +v3v4set = {"v3", "v4"} + + def change_sovits_weights(sovits_path, prompt_language=None, text_language=None): global version, model_version, dict_language, if_lora_v3 version, model_version, if_lora_v3 = get_sovits_version_from_path_fast(sovits_path) # print(sovits_path,version, model_version, if_lora_v3) - is_exist=is_exist_s2gv3 if model_version=="v3"else is_exist_s2gv4 + is_exist = is_exist_s2gv3 if model_version == "v3" else is_exist_s2gv4 path_sovits = path_sovits_v3 if model_version == "v3" else path_sovits_v4 if if_lora_v3 == True and is_exist == False: - info = path_sovits + i18n("SoVITS %s 底模缺失,无法加载相应 LoRA 权重"%model_version) + info = path_sovits + i18n("SoVITS %s 底模缺失,无法加载相应 LoRA 权重" % model_version) gr.Warning(info) raise FileExistsError(info) dict_language = dict_language_v1 if version == "v1" else dict_language_v2 diff --git a/GPT_SoVITS/module/data_utils.py b/GPT_SoVITS/module/data_utils.py index 1bda2b31..11f6b092 100644 --- a/GPT_SoVITS/module/data_utils.py +++ b/GPT_SoVITS/module/data_utils.py @@ -470,6 +470,7 @@ class TextAudioSpeakerCollateV3: # return ssl_padded, spec_padded,mel_padded, ssl_lengths, spec_lengths, text_padded, text_lengths, wav_padded, wav_lengths,mel_lengths return ssl_padded, spec_padded, mel_padded, ssl_lengths, spec_lengths, text_padded, text_lengths, mel_lengths + class TextAudioSpeakerLoaderV4(torch.utils.data.Dataset): """ 1) loads audio, speaker_id, text pairs @@ -596,7 +597,7 @@ class TextAudioSpeakerLoaderV4(torch.utils.data.Dataset): audio_norm, self.filter_length, self.sampling_rate, self.hop_length, self.win_length, center=False ) spec = torch.squeeze(spec, 0) - spec1 = spectrogram_torch(audio_norm, 1280,32000, 320, 1280,center=False) + spec1 = spectrogram_torch(audio_norm, 1280, 32000, 320, 1280, center=False) mel = spec_to_mel_torch(spec1, 1280, 100, 32000, 0, None) mel = self.norm_spec(torch.squeeze(mel, 0)) return spec, mel @@ -643,7 +644,7 @@ class TextAudioSpeakerCollateV4: mel_lengths = torch.LongTensor(len(batch)) spec_padded = torch.FloatTensor(len(batch), batch[0][1].size(0), max_spec_len) - mel_padded = torch.FloatTensor(len(batch), batch[0][2].size(0), max_spec_len*2) + mel_padded = torch.FloatTensor(len(batch), batch[0][2].size(0), max_spec_len * 2) ssl_padded = torch.FloatTensor(len(batch), batch[0][0].size(1), max_ssl_len) text_padded = torch.LongTensor(len(batch), max_text_len) # wav_padded = torch.FloatTensor(len(batch), 1, max_wav_len) diff --git a/GPT_SoVITS/module/mel_processing.py b/GPT_SoVITS/module/mel_processing.py index 7a17c54b..62c7b40e 100644 --- a/GPT_SoVITS/module/mel_processing.py +++ b/GPT_SoVITS/module/mel_processing.py @@ -39,24 +39,36 @@ hann_window = {} def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False): if torch.min(y) < -1.2: - print('min value is ', torch.min(y)) + print("min value is ", torch.min(y)) if torch.max(y) > 1.2: - print('max value is ', torch.max(y)) + print("max value is ", torch.max(y)) global hann_window - dtype_device = str(y.dtype) + '_' + str(y.device) + dtype_device = str(y.dtype) + "_" + str(y.device) # wnsize_dtype_device = str(win_size) + '_' + dtype_device - key = "%s-%s-%s-%s-%s" %(dtype_device,n_fft, sampling_rate, hop_size, win_size) + key = "%s-%s-%s-%s-%s" % (dtype_device, n_fft, sampling_rate, hop_size, win_size) # if wnsize_dtype_device not in hann_window: if key not in hann_window: # hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(dtype=y.dtype, device=y.device) hann_window[key] = torch.hann_window(win_size).to(dtype=y.dtype, device=y.device) - y = torch.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect') + y = torch.nn.functional.pad( + y.unsqueeze(1), (int((n_fft - hop_size) / 2), int((n_fft - hop_size) / 2)), mode="reflect" + ) y = y.squeeze(1) # spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device], - spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[key], - center=center, pad_mode='reflect', normalized=False, onesided=True, return_complex=False) + spec = torch.stft( + y, + n_fft, + hop_length=hop_size, + win_length=win_size, + window=hann_window[key], + center=center, + pad_mode="reflect", + normalized=False, + onesided=True, + return_complex=False, + ) spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-8) return spec @@ -64,9 +76,9 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False) def spec_to_mel_torch(spec, n_fft, num_mels, sampling_rate, fmin, fmax): global mel_basis - dtype_device = str(spec.dtype) + '_' + str(spec.device) + dtype_device = str(spec.dtype) + "_" + str(spec.device) # fmax_dtype_device = str(fmax) + '_' + dtype_device - key = "%s-%s-%s-%s-%s-%s"%(dtype_device,n_fft, num_mels, sampling_rate, fmin, fmax) + key = "%s-%s-%s-%s-%s-%s" % (dtype_device, n_fft, num_mels, sampling_rate, fmin, fmax) # if fmax_dtype_device not in mel_basis: if key not in mel_basis: mel = librosa_mel_fn(sr=sampling_rate, n_fft=n_fft, n_mels=num_mels, fmin=fmin, fmax=fmax) @@ -78,17 +90,25 @@ def spec_to_mel_torch(spec, n_fft, num_mels, sampling_rate, fmin, fmax): return spec - def mel_spectrogram_torch(y, n_fft, num_mels, sampling_rate, hop_size, win_size, fmin, fmax, center=False): if torch.min(y) < -1.2: - print('min value is ', torch.min(y)) + print("min value is ", torch.min(y)) if torch.max(y) > 1.2: - print('max value is ', torch.max(y)) + print("max value is ", torch.max(y)) global mel_basis, hann_window - dtype_device = str(y.dtype) + '_' + str(y.device) + dtype_device = str(y.dtype) + "_" + str(y.device) # fmax_dtype_device = str(fmax) + '_' + dtype_device - fmax_dtype_device = "%s-%s-%s-%s-%s-%s-%s-%s"%(dtype_device,n_fft, num_mels, sampling_rate, hop_size, win_size, fmin, fmax) + fmax_dtype_device = "%s-%s-%s-%s-%s-%s-%s-%s" % ( + dtype_device, + n_fft, + num_mels, + sampling_rate, + hop_size, + win_size, + fmin, + fmax, + ) # wnsize_dtype_device = str(win_size) + '_' + dtype_device wnsize_dtype_device = fmax_dtype_device if fmax_dtype_device not in mel_basis: @@ -97,11 +117,23 @@ def mel_spectrogram_torch(y, n_fft, num_mels, sampling_rate, hop_size, win_size, if wnsize_dtype_device not in hann_window: hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(dtype=y.dtype, device=y.device) - y = torch.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect') + y = torch.nn.functional.pad( + y.unsqueeze(1), (int((n_fft - hop_size) / 2), int((n_fft - hop_size) / 2)), mode="reflect" + ) y = y.squeeze(1) - spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device], - center=center, pad_mode='reflect', normalized=False, onesided=True, return_complex=False) + spec = torch.stft( + y, + n_fft, + hop_length=hop_size, + win_length=win_size, + window=hann_window[wnsize_dtype_device], + center=center, + pad_mode="reflect", + normalized=False, + onesided=True, + return_complex=False, + ) spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-8) diff --git a/GPT_SoVITS/module/models.py b/GPT_SoVITS/module/models.py index 21f60d99..3e37f0ff 100644 --- a/GPT_SoVITS/module/models.py +++ b/GPT_SoVITS/module/models.py @@ -414,7 +414,8 @@ class Generator(torch.nn.Module): upsample_rates, upsample_initial_channel, upsample_kernel_sizes, - gin_channels=0,is_bias=False, + gin_channels=0, + is_bias=False, ): super(Generator, self).__init__() self.num_kernels = len(resblock_kernel_sizes) @@ -1173,7 +1174,7 @@ class SynthesizerTrnV3(nn.Module): quantized = F.interpolate(quantized, scale_factor=2, mode="nearest") ##BCT x, m_p, logs_p, y_mask = self.enc_p(quantized, y_lengths, text, text_lengths, ge) fea = self.bridge(x) - fea = F.interpolate(fea, scale_factor=(1.875 if self.version=="v3"else 2), mode="nearest") ##BCT + fea = F.interpolate(fea, scale_factor=(1.875 if self.version == "v3" else 2), mode="nearest") ##BCT fea, y_mask_ = self.wns1( fea, mel_lengths, ge ) ##If the 1-minute fine-tuning works fine, no need to manually adjust the learning rate. @@ -1196,9 +1197,9 @@ class SynthesizerTrnV3(nn.Module): ge = self.ref_enc(refer[:, :704] * refer_mask, refer_mask) y_lengths = torch.LongTensor([int(codes.size(2) * 2)]).to(codes.device) if speed == 1: - sizee = int(codes.size(2) * (3.875 if self.version=="v3"else 4)) + sizee = int(codes.size(2) * (3.875 if self.version == "v3" else 4)) else: - sizee = int(codes.size(2) * (3.875 if self.version=="v3"else 4) / speed) + 1 + sizee = int(codes.size(2) * (3.875 if self.version == "v3" else 4) / speed) + 1 y_lengths1 = torch.LongTensor([sizee]).to(codes.device) text_lengths = torch.LongTensor([text.size(-1)]).to(text.device) @@ -1207,7 +1208,7 @@ class SynthesizerTrnV3(nn.Module): quantized = F.interpolate(quantized, scale_factor=2, mode="nearest") ##BCT x, m_p, logs_p, y_mask = self.enc_p(quantized, y_lengths, text, text_lengths, ge, speed) fea = self.bridge(x) - fea = F.interpolate(fea, scale_factor=(1.875 if self.version=="v3"else 2), mode="nearest") ##BCT + fea = F.interpolate(fea, scale_factor=(1.875 if self.version == "v3" else 2), mode="nearest") ##BCT ####more wn paramter to learn mel fea, y_mask_ = self.wns1(fea, y_lengths1, ge) return fea, ge diff --git a/GPT_SoVITS/process_ckpt.py b/GPT_SoVITS/process_ckpt.py index 4a2a1bac..1c458a4d 100644 --- a/GPT_SoVITS/process_ckpt.py +++ b/GPT_SoVITS/process_ckpt.py @@ -28,18 +28,18 @@ def my_save(fea, path): #####fix issue: torch.save doesn't support chinese path from io import BytesIO -def my_save2(fea, path,cfm_version): +def my_save2(fea, path, cfm_version): bio = BytesIO() torch.save(fea, bio) bio.seek(0) data = bio.getvalue() - byte=b"03" if cfm_version=="v3"else b"04" + byte = b"03" if cfm_version == "v3" else b"04" data = byte + data[2:] with open(path, "wb") as f: f.write(data) -def savee(ckpt, name, epoch, steps, hps, cfm_version=None,lora_rank=None): +def savee(ckpt, name, epoch, steps, hps, cfm_version=None, lora_rank=None): try: opt = OrderedDict() opt["weight"] = {} @@ -51,7 +51,7 @@ def savee(ckpt, name, epoch, steps, hps, cfm_version=None,lora_rank=None): opt["info"] = "%sepoch_%siteration" % (epoch, steps) if lora_rank: opt["lora_rank"] = lora_rank - my_save2(opt, "%s/%s.pth" % (hps.save_weight_dir, name),cfm_version) + my_save2(opt, "%s/%s.pth" % (hps.save_weight_dir, name), cfm_version) else: my_save(opt, "%s/%s.pth" % (hps.save_weight_dir, name)) return "Success." diff --git a/GPT_SoVITS/s2_train_v3_lora.py b/GPT_SoVITS/s2_train_v3_lora.py index ddeec4fc..4d8d23db 100644 --- a/GPT_SoVITS/s2_train_v3_lora.py +++ b/GPT_SoVITS/s2_train_v3_lora.py @@ -31,7 +31,6 @@ from module.data_utils import ( TextAudioSpeakerLoaderV3, TextAudioSpeakerCollateV4, TextAudioSpeakerLoaderV4, - ) from module.models import ( SynthesizerTrnV3 as SynthesizerTrn, @@ -88,8 +87,8 @@ def run(rank, n_gpus, hps): if torch.cuda.is_available(): torch.cuda.set_device(rank) - TextAudioSpeakerLoader=TextAudioSpeakerLoaderV3 if hps.model.version=="v3"else TextAudioSpeakerLoaderV4 - TextAudioSpeakerCollate=TextAudioSpeakerCollateV3 if hps.model.version=="v3"else TextAudioSpeakerCollateV4 + TextAudioSpeakerLoader = TextAudioSpeakerLoaderV3 if hps.model.version == "v3" else TextAudioSpeakerLoaderV4 + TextAudioSpeakerCollate = TextAudioSpeakerCollateV3 if hps.model.version == "v3" else TextAudioSpeakerCollateV4 train_dataset = TextAudioSpeakerLoader(hps.data) ######## train_sampler = DistributedBucketSampler( train_dataset, @@ -365,7 +364,8 @@ def train_and_evaluate(rank, epoch, hps, nets, optims, schedulers, scaler, loade hps.name + "_e%s_s%s_l%s" % (epoch, global_step, lora_rank), epoch, global_step, - hps,cfm_version=hps.model.version, + hps, + cfm_version=hps.model.version, lora_rank=lora_rank, ), ) diff --git a/tools/uvr5/lib/lib_v5/dataset.py b/tools/uvr5/lib/lib_v5/dataset.py index cfd01a17..1a30eec7 100644 --- a/tools/uvr5/lib/lib_v5/dataset.py +++ b/tools/uvr5/lib/lib_v5/dataset.py @@ -32,18 +32,10 @@ def make_pair(mix_dir, inst_dir): input_exts = [".wav", ".m4a", ".mp3", ".mp4", ".flac"] X_list = sorted( - [ - os.path.join(mix_dir, fname) - for fname in os.listdir(mix_dir) - if os.path.splitext(fname)[1] in input_exts - ] + [os.path.join(mix_dir, fname) for fname in os.listdir(mix_dir) if os.path.splitext(fname)[1] in input_exts] ) y_list = sorted( - [ - os.path.join(inst_dir, fname) - for fname in os.listdir(inst_dir) - if os.path.splitext(fname)[1] in input_exts - ] + [os.path.join(inst_dir, fname) for fname in os.listdir(inst_dir) if os.path.splitext(fname)[1] in input_exts] ) filelist = list(zip(X_list, y_list)) @@ -65,14 +57,10 @@ def train_val_split(dataset_dir, split_mode, val_rate, val_filelist): train_filelist = filelist[:-val_size] val_filelist = filelist[-val_size:] else: - train_filelist = [ - pair for pair in filelist if list(pair) not in val_filelist - ] + train_filelist = [pair for pair in filelist if list(pair) not in val_filelist] elif split_mode == "subdirs": if len(val_filelist) != 0: - raise ValueError( - "The `val_filelist` option is not available in `subdirs` mode" - ) + raise ValueError("The `val_filelist` option is not available in `subdirs` mode") train_filelist = make_pair( os.path.join(dataset_dir, "training/mixtures"), @@ -91,9 +79,7 @@ def augment(X, y, reduction_rate, reduction_mask, mixup_rate, mixup_alpha): perm = np.random.permutation(len(X)) for i, idx in enumerate(tqdm(perm)): if np.random.uniform() < reduction_rate: - y[idx] = spec_utils.reduce_vocal_aggressively( - X[idx], y[idx], reduction_mask - ) + y[idx] = spec_utils.reduce_vocal_aggressively(X[idx], y[idx], reduction_mask) if np.random.uniform() < 0.5: # swap channel @@ -152,9 +138,7 @@ def make_training_set(filelist, cropsize, patches, sr, hop_length, n_fft, offset def make_validation_set(filelist, cropsize, sr, hop_length, n_fft, offset): patch_list = [] - patch_dir = "cs{}_sr{}_hl{}_nf{}_of{}".format( - cropsize, sr, hop_length, n_fft, offset - ) + patch_dir = "cs{}_sr{}_hl{}_nf{}_of{}".format(cropsize, sr, hop_length, n_fft, offset) os.makedirs(patch_dir, exist_ok=True) for i, (X_path, y_path) in enumerate(tqdm(filelist)): diff --git a/tools/uvr5/lib/lib_v5/layers.py b/tools/uvr5/lib/lib_v5/layers.py index 4fc1b5cb..2b9101e0 100644 --- a/tools/uvr5/lib/lib_v5/layers.py +++ b/tools/uvr5/lib/lib_v5/layers.py @@ -63,9 +63,7 @@ class Encoder(nn.Module): class Decoder(nn.Module): - def __init__( - self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False - ): + def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False): super(Decoder, self).__init__() self.conv = Conv2DBNActiv(nin, nout, ksize, 1, pad, activ=activ) self.dropout = nn.Dropout2d(0.1) if dropout else None @@ -91,24 +89,14 @@ class ASPPModule(nn.Module): Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ), ) self.conv2 = Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ) - self.conv3 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[0], dilations[0], activ=activ - ) - self.conv4 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[1], dilations[1], activ=activ - ) - self.conv5 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.bottleneck = nn.Sequential( - Conv2DBNActiv(nin * 5, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1) - ) + self.conv3 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[0], dilations[0], activ=activ) + self.conv4 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[1], dilations[1], activ=activ) + self.conv5 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.bottleneck = nn.Sequential(Conv2DBNActiv(nin * 5, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1)) def forward(self, x): _, _, h, w = x.size() - feat1 = F.interpolate( - self.conv1(x), size=(h, w), mode="bilinear", align_corners=True - ) + feat1 = F.interpolate(self.conv1(x), size=(h, w), mode="bilinear", align_corners=True) feat2 = self.conv2(x) feat3 = self.conv3(x) feat4 = self.conv4(x) diff --git a/tools/uvr5/lib/lib_v5/layers_123812KB.py b/tools/uvr5/lib/lib_v5/layers_123812KB.py index 4fc1b5cb..2b9101e0 100644 --- a/tools/uvr5/lib/lib_v5/layers_123812KB.py +++ b/tools/uvr5/lib/lib_v5/layers_123812KB.py @@ -63,9 +63,7 @@ class Encoder(nn.Module): class Decoder(nn.Module): - def __init__( - self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False - ): + def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False): super(Decoder, self).__init__() self.conv = Conv2DBNActiv(nin, nout, ksize, 1, pad, activ=activ) self.dropout = nn.Dropout2d(0.1) if dropout else None @@ -91,24 +89,14 @@ class ASPPModule(nn.Module): Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ), ) self.conv2 = Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ) - self.conv3 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[0], dilations[0], activ=activ - ) - self.conv4 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[1], dilations[1], activ=activ - ) - self.conv5 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.bottleneck = nn.Sequential( - Conv2DBNActiv(nin * 5, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1) - ) + self.conv3 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[0], dilations[0], activ=activ) + self.conv4 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[1], dilations[1], activ=activ) + self.conv5 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.bottleneck = nn.Sequential(Conv2DBNActiv(nin * 5, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1)) def forward(self, x): _, _, h, w = x.size() - feat1 = F.interpolate( - self.conv1(x), size=(h, w), mode="bilinear", align_corners=True - ) + feat1 = F.interpolate(self.conv1(x), size=(h, w), mode="bilinear", align_corners=True) feat2 = self.conv2(x) feat3 = self.conv3(x) feat4 = self.conv4(x) diff --git a/tools/uvr5/lib/lib_v5/layers_123821KB.py b/tools/uvr5/lib/lib_v5/layers_123821KB.py index 4fc1b5cb..2b9101e0 100644 --- a/tools/uvr5/lib/lib_v5/layers_123821KB.py +++ b/tools/uvr5/lib/lib_v5/layers_123821KB.py @@ -63,9 +63,7 @@ class Encoder(nn.Module): class Decoder(nn.Module): - def __init__( - self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False - ): + def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False): super(Decoder, self).__init__() self.conv = Conv2DBNActiv(nin, nout, ksize, 1, pad, activ=activ) self.dropout = nn.Dropout2d(0.1) if dropout else None @@ -91,24 +89,14 @@ class ASPPModule(nn.Module): Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ), ) self.conv2 = Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ) - self.conv3 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[0], dilations[0], activ=activ - ) - self.conv4 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[1], dilations[1], activ=activ - ) - self.conv5 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.bottleneck = nn.Sequential( - Conv2DBNActiv(nin * 5, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1) - ) + self.conv3 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[0], dilations[0], activ=activ) + self.conv4 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[1], dilations[1], activ=activ) + self.conv5 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.bottleneck = nn.Sequential(Conv2DBNActiv(nin * 5, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1)) def forward(self, x): _, _, h, w = x.size() - feat1 = F.interpolate( - self.conv1(x), size=(h, w), mode="bilinear", align_corners=True - ) + feat1 = F.interpolate(self.conv1(x), size=(h, w), mode="bilinear", align_corners=True) feat2 = self.conv2(x) feat3 = self.conv3(x) feat4 = self.conv4(x) diff --git a/tools/uvr5/lib/lib_v5/layers_33966KB.py b/tools/uvr5/lib/lib_v5/layers_33966KB.py index 9b127bc6..43977778 100644 --- a/tools/uvr5/lib/lib_v5/layers_33966KB.py +++ b/tools/uvr5/lib/lib_v5/layers_33966KB.py @@ -63,9 +63,7 @@ class Encoder(nn.Module): class Decoder(nn.Module): - def __init__( - self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False - ): + def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False): super(Decoder, self).__init__() self.conv = Conv2DBNActiv(nin, nout, ksize, 1, pad, activ=activ) self.dropout = nn.Dropout2d(0.1) if dropout else None @@ -91,30 +89,16 @@ class ASPPModule(nn.Module): Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ), ) self.conv2 = Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ) - self.conv3 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[0], dilations[0], activ=activ - ) - self.conv4 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[1], dilations[1], activ=activ - ) - self.conv5 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.conv6 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.conv7 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.bottleneck = nn.Sequential( - Conv2DBNActiv(nin * 7, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1) - ) + self.conv3 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[0], dilations[0], activ=activ) + self.conv4 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[1], dilations[1], activ=activ) + self.conv5 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.conv6 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.conv7 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.bottleneck = nn.Sequential(Conv2DBNActiv(nin * 7, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1)) def forward(self, x): _, _, h, w = x.size() - feat1 = F.interpolate( - self.conv1(x), size=(h, w), mode="bilinear", align_corners=True - ) + feat1 = F.interpolate(self.conv1(x), size=(h, w), mode="bilinear", align_corners=True) feat2 = self.conv2(x) feat3 = self.conv3(x) feat4 = self.conv4(x) diff --git a/tools/uvr5/lib/lib_v5/layers_537227KB.py b/tools/uvr5/lib/lib_v5/layers_537227KB.py index 9b127bc6..43977778 100644 --- a/tools/uvr5/lib/lib_v5/layers_537227KB.py +++ b/tools/uvr5/lib/lib_v5/layers_537227KB.py @@ -63,9 +63,7 @@ class Encoder(nn.Module): class Decoder(nn.Module): - def __init__( - self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False - ): + def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False): super(Decoder, self).__init__() self.conv = Conv2DBNActiv(nin, nout, ksize, 1, pad, activ=activ) self.dropout = nn.Dropout2d(0.1) if dropout else None @@ -91,30 +89,16 @@ class ASPPModule(nn.Module): Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ), ) self.conv2 = Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ) - self.conv3 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[0], dilations[0], activ=activ - ) - self.conv4 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[1], dilations[1], activ=activ - ) - self.conv5 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.conv6 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.conv7 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.bottleneck = nn.Sequential( - Conv2DBNActiv(nin * 7, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1) - ) + self.conv3 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[0], dilations[0], activ=activ) + self.conv4 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[1], dilations[1], activ=activ) + self.conv5 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.conv6 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.conv7 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.bottleneck = nn.Sequential(Conv2DBNActiv(nin * 7, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1)) def forward(self, x): _, _, h, w = x.size() - feat1 = F.interpolate( - self.conv1(x), size=(h, w), mode="bilinear", align_corners=True - ) + feat1 = F.interpolate(self.conv1(x), size=(h, w), mode="bilinear", align_corners=True) feat2 = self.conv2(x) feat3 = self.conv3(x) feat4 = self.conv4(x) diff --git a/tools/uvr5/lib/lib_v5/layers_537238KB.py b/tools/uvr5/lib/lib_v5/layers_537238KB.py index 9b127bc6..43977778 100644 --- a/tools/uvr5/lib/lib_v5/layers_537238KB.py +++ b/tools/uvr5/lib/lib_v5/layers_537238KB.py @@ -63,9 +63,7 @@ class Encoder(nn.Module): class Decoder(nn.Module): - def __init__( - self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False - ): + def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False): super(Decoder, self).__init__() self.conv = Conv2DBNActiv(nin, nout, ksize, 1, pad, activ=activ) self.dropout = nn.Dropout2d(0.1) if dropout else None @@ -91,30 +89,16 @@ class ASPPModule(nn.Module): Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ), ) self.conv2 = Conv2DBNActiv(nin, nin, 1, 1, 0, activ=activ) - self.conv3 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[0], dilations[0], activ=activ - ) - self.conv4 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[1], dilations[1], activ=activ - ) - self.conv5 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.conv6 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.conv7 = SeperableConv2DBNActiv( - nin, nin, 3, 1, dilations[2], dilations[2], activ=activ - ) - self.bottleneck = nn.Sequential( - Conv2DBNActiv(nin * 7, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1) - ) + self.conv3 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[0], dilations[0], activ=activ) + self.conv4 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[1], dilations[1], activ=activ) + self.conv5 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.conv6 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.conv7 = SeperableConv2DBNActiv(nin, nin, 3, 1, dilations[2], dilations[2], activ=activ) + self.bottleneck = nn.Sequential(Conv2DBNActiv(nin * 7, nout, 1, 1, 0, activ=activ), nn.Dropout2d(0.1)) def forward(self, x): _, _, h, w = x.size() - feat1 = F.interpolate( - self.conv1(x), size=(h, w), mode="bilinear", align_corners=True - ) + feat1 = F.interpolate(self.conv1(x), size=(h, w), mode="bilinear", align_corners=True) feat2 = self.conv2(x) feat3 = self.conv3(x) feat4 = self.conv4(x) diff --git a/tools/uvr5/lib/lib_v5/layers_new.py b/tools/uvr5/lib/lib_v5/layers_new.py index 44153b6a..7d7005c0 100644 --- a/tools/uvr5/lib/lib_v5/layers_new.py +++ b/tools/uvr5/lib/lib_v5/layers_new.py @@ -40,9 +40,7 @@ class Encoder(nn.Module): class Decoder(nn.Module): - def __init__( - self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False - ): + def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.ReLU, dropout=False): super(Decoder, self).__init__() self.conv1 = Conv2DBNActiv(nin, nout, ksize, 1, pad, activ=activ) # self.conv2 = Conv2DBNActiv(nout, nout, ksize, 1, pad, activ=activ) @@ -72,23 +70,15 @@ class ASPPModule(nn.Module): Conv2DBNActiv(nin, nout, 1, 1, 0, activ=activ), ) self.conv2 = Conv2DBNActiv(nin, nout, 1, 1, 0, activ=activ) - self.conv3 = Conv2DBNActiv( - nin, nout, 3, 1, dilations[0], dilations[0], activ=activ - ) - self.conv4 = Conv2DBNActiv( - nin, nout, 3, 1, dilations[1], dilations[1], activ=activ - ) - self.conv5 = Conv2DBNActiv( - nin, nout, 3, 1, dilations[2], dilations[2], activ=activ - ) + self.conv3 = Conv2DBNActiv(nin, nout, 3, 1, dilations[0], dilations[0], activ=activ) + self.conv4 = Conv2DBNActiv(nin, nout, 3, 1, dilations[1], dilations[1], activ=activ) + self.conv5 = Conv2DBNActiv(nin, nout, 3, 1, dilations[2], dilations[2], activ=activ) self.bottleneck = Conv2DBNActiv(nout * 5, nout, 1, 1, 0, activ=activ) self.dropout = nn.Dropout2d(0.1) if dropout else None def forward(self, x): _, _, h, w = x.size() - feat1 = F.interpolate( - self.conv1(x), size=(h, w), mode="bilinear", align_corners=True - ) + feat1 = F.interpolate(self.conv1(x), size=(h, w), mode="bilinear", align_corners=True) feat2 = self.conv2(x) feat3 = self.conv3(x) feat4 = self.conv4(x) @@ -106,12 +96,8 @@ class LSTMModule(nn.Module): def __init__(self, nin_conv, nin_lstm, nout_lstm): super(LSTMModule, self).__init__() self.conv = Conv2DBNActiv(nin_conv, 1, 1, 1, 0) - self.lstm = nn.LSTM( - input_size=nin_lstm, hidden_size=nout_lstm // 2, bidirectional=True - ) - self.dense = nn.Sequential( - nn.Linear(nout_lstm, nin_lstm), nn.BatchNorm1d(nin_lstm), nn.ReLU() - ) + self.lstm = nn.LSTM(input_size=nin_lstm, hidden_size=nout_lstm // 2, bidirectional=True) + self.dense = nn.Sequential(nn.Linear(nout_lstm, nin_lstm), nn.BatchNorm1d(nin_lstm), nn.ReLU()) def forward(self, x): N, _, nbins, nframes = x.size() diff --git a/tools/uvr5/lib/lib_v5/model_param_init.py b/tools/uvr5/lib/lib_v5/model_param_init.py index b995c0bf..79b94d33 100644 --- a/tools/uvr5/lib/lib_v5/model_param_init.py +++ b/tools/uvr5/lib/lib_v5/model_param_init.py @@ -1,5 +1,4 @@ import json -import os import pathlib default_param = {} @@ -48,9 +47,7 @@ class ModelParameters(object): import zipfile with zipfile.ZipFile(config_path, "r") as zip: - self.param = json.loads( - zip.read("param.json"), object_pairs_hook=int_keys - ) + self.param = json.loads(zip.read("param.json"), object_pairs_hook=int_keys) elif ".json" == pathlib.Path(config_path).suffix: with open(config_path, "r") as f: self.param = json.loads(f.read(), object_pairs_hook=int_keys) @@ -65,5 +62,5 @@ class ModelParameters(object): "stereo_n", "reverse", ]: - if not k in self.param: + if k not in self.param: self.param[k] = False diff --git a/tools/uvr5/lib/lib_v5/nets.py b/tools/uvr5/lib/lib_v5/nets.py index 5da3948c..42d7807a 100644 --- a/tools/uvr5/lib/lib_v5/nets.py +++ b/tools/uvr5/lib/lib_v5/nets.py @@ -3,8 +3,6 @@ import torch import torch.nn.functional as F from torch import nn -from . import spec_utils - class BaseASPPNet(nn.Module): def __init__(self, nin, ch, dilations=(4, 8, 16)): diff --git a/tools/uvr5/lib/lib_v5/nets_537227KB.py b/tools/uvr5/lib/lib_v5/nets_537227KB.py index 823b44fb..9bb1df1e 100644 --- a/tools/uvr5/lib/lib_v5/nets_537227KB.py +++ b/tools/uvr5/lib/lib_v5/nets_537227KB.py @@ -1,4 +1,3 @@ -import numpy as np import torch import torch.nn.functional as F from torch import nn diff --git a/tools/uvr5/lib/lib_v5/nets_537238KB.py b/tools/uvr5/lib/lib_v5/nets_537238KB.py index 823b44fb..9bb1df1e 100644 --- a/tools/uvr5/lib/lib_v5/nets_537238KB.py +++ b/tools/uvr5/lib/lib_v5/nets_537238KB.py @@ -1,4 +1,3 @@ -import numpy as np import torch import torch.nn.functional as F from torch import nn diff --git a/tools/uvr5/lib/lib_v5/nets_new.py b/tools/uvr5/lib/lib_v5/nets_new.py index 1c0f4fa9..ba1a5599 100644 --- a/tools/uvr5/lib/lib_v5/nets_new.py +++ b/tools/uvr5/lib/lib_v5/nets_new.py @@ -6,9 +6,7 @@ from . import layers_new class BaseNet(nn.Module): - def __init__( - self, nin, nout, nin_lstm, nout_lstm, dilations=((4, 2), (8, 4), (12, 6)) - ): + def __init__(self, nin, nout, nin_lstm, nout_lstm, dilations=((4, 2), (8, 4), (12, 6))): super(BaseNet, self).__init__() self.enc1 = layers_new.Conv2DBNActiv(nin, nout, 3, 1, 1) self.enc2 = layers_new.Encoder(nout, nout * 2, 3, 2, 1) @@ -56,21 +54,15 @@ class CascadedNet(nn.Module): layers_new.Conv2DBNActiv(nout // 2, nout // 4, 1, 1, 0), ) - self.stg1_high_band_net = BaseNet( - 2, nout // 4, self.nin_lstm // 2, nout_lstm // 2 - ) + self.stg1_high_band_net = BaseNet(2, nout // 4, self.nin_lstm // 2, nout_lstm // 2) self.stg2_low_band_net = nn.Sequential( BaseNet(nout // 4 + 2, nout, self.nin_lstm // 2, nout_lstm), layers_new.Conv2DBNActiv(nout, nout // 2, 1, 1, 0), ) - self.stg2_high_band_net = BaseNet( - nout // 4 + 2, nout // 2, self.nin_lstm // 2, nout_lstm // 2 - ) + self.stg2_high_band_net = BaseNet(nout // 4 + 2, nout // 2, self.nin_lstm // 2, nout_lstm // 2) - self.stg3_full_band_net = BaseNet( - 3 * nout // 4 + 2, nout, self.nin_lstm, nout_lstm - ) + self.stg3_full_band_net = BaseNet(3 * nout // 4 + 2, nout, self.nin_lstm, nout_lstm) self.out = nn.Conv2d(nout, 2, 1, bias=False) self.aux_out = nn.Conv2d(3 * nout // 4, 2, 1, bias=False) diff --git a/tools/uvr5/lib/lib_v5/spec_utils.py b/tools/uvr5/lib/lib_v5/spec_utils.py index da072e4b..4d987cd8 100644 --- a/tools/uvr5/lib/lib_v5/spec_utils.py +++ b/tools/uvr5/lib/lib_v5/spec_utils.py @@ -27,9 +27,7 @@ def crop_center(h1, h2): return h1 -def wave_to_spectrogram( - wave, hop_length, n_fft, mid_side=False, mid_side_b2=False, reverse=False -): +def wave_to_spectrogram(wave, hop_length, n_fft, mid_side=False, mid_side_b2=False, reverse=False): if reverse: wave_left = np.flip(np.asfortranarray(wave[0])) wave_right = np.flip(np.asfortranarray(wave[1])) @@ -43,7 +41,7 @@ def wave_to_spectrogram( wave_left = np.asfortranarray(wave[0]) wave_right = np.asfortranarray(wave[1]) - spec_left = librosa.stft(wave_left, n_fft=n_fft, hop_length=hop_length) + spec_left = librosa.stft(wave_left, n_fft=n_fft, hop_length=hop_length) spec_right = librosa.stft(wave_right, n_fft=n_fft, hop_length=hop_length) spec = np.asfortranarray([spec_left, spec_right]) @@ -51,9 +49,7 @@ def wave_to_spectrogram( return spec -def wave_to_spectrogram_mt( - wave, hop_length, n_fft, mid_side=False, mid_side_b2=False, reverse=False -): +def wave_to_spectrogram_mt(wave, hop_length, n_fft, mid_side=False, mid_side_b2=False, reverse=False): import threading if reverse: @@ -103,21 +99,13 @@ def combine_spectrograms(specs, mp): raise ValueError("Too much bins") # lowpass fiter - if ( - mp.param["pre_filter_start"] > 0 - ): # and mp.param['band'][bands_n]['res_type'] in ['scipy', 'polyphase']: + if mp.param["pre_filter_start"] > 0: # and mp.param['band'][bands_n]['res_type'] in ['scipy', 'polyphase']: if bands_n == 1: - spec_c = fft_lp_filter( - spec_c, mp.param["pre_filter_start"], mp.param["pre_filter_stop"] - ) + spec_c = fft_lp_filter(spec_c, mp.param["pre_filter_start"], mp.param["pre_filter_stop"]) else: gp = 1 - for b in range( - mp.param["pre_filter_start"] + 1, mp.param["pre_filter_stop"] - ): - g = math.pow( - 10, -(b - mp.param["pre_filter_start"]) * (3.5 - gp) / 20.0 - ) + for b in range(mp.param["pre_filter_start"] + 1, mp.param["pre_filter_stop"]): + g = math.pow(10, -(b - mp.param["pre_filter_start"]) * (3.5 - gp) / 20.0) gp = g spec_c[:, b, :] *= g @@ -189,9 +177,7 @@ def mask_silence(mag, ref, thres=0.2, min_range=64, fade_size=32): else: e += fade_size - mag[:, :, s + fade_size : e - fade_size] += ref[ - :, :, s + fade_size : e - fade_size - ] + mag[:, :, s + fade_size : e - fade_size] += ref[:, :, s + fade_size : e - fade_size] old_e = e return mag @@ -207,9 +193,7 @@ def cache_or_load(mix_path, inst_path, mp): mix_basename = os.path.splitext(os.path.basename(mix_path))[0] inst_basename = os.path.splitext(os.path.basename(inst_path))[0] - cache_dir = "mph{}".format( - hashlib.sha1(json.dumps(mp.param, sort_keys=True).encode("utf-8")).hexdigest() - ) + cache_dir = "mph{}".format(hashlib.sha1(json.dumps(mp.param, sort_keys=True).encode("utf-8")).hexdigest()) mix_cache_dir = os.path.join("cache", cache_dir) inst_cache_dir = os.path.join("cache", cache_dir) @@ -230,31 +214,27 @@ def cache_or_load(mix_path, inst_path, mp): if d == len(mp.param["band"]): # high-end band X_wave[d], _ = librosa.load( - mix_path, - sr = bp["sr"], - mono = False, - dtype = np.float32, - res_type = bp["res_type"] + mix_path, sr=bp["sr"], mono=False, dtype=np.float32, res_type=bp["res_type"] ) y_wave[d], _ = librosa.load( inst_path, - sr = bp["sr"], - mono = False, - dtype = np.float32, - res_type = bp["res_type"], + sr=bp["sr"], + mono=False, + dtype=np.float32, + res_type=bp["res_type"], ) else: # lower bands X_wave[d] = librosa.resample( X_wave[d + 1], - orig_sr = mp.param["band"][d + 1]["sr"], - target_sr = bp["sr"], - res_type = bp["res_type"], + orig_sr=mp.param["band"][d + 1]["sr"], + target_sr=bp["sr"], + res_type=bp["res_type"], ) y_wave[d] = librosa.resample( y_wave[d + 1], - orig_sr = mp.param["band"][d + 1]["sr"], - target_sr = bp["sr"], - res_type = bp["res_type"], + orig_sr=mp.param["band"][d + 1]["sr"], + target_sr=bp["sr"], + res_type=bp["res_type"], ) X_wave[d], y_wave[d] = align_wave_head_and_tail(X_wave[d], y_wave[d]) @@ -302,9 +282,7 @@ def spectrogram_to_wave(spec, hop_length, mid_side, mid_side_b2, reverse): if reverse: return np.asfortranarray([np.flip(wave_left), np.flip(wave_right)]) elif mid_side: - return np.asfortranarray( - [np.add(wave_left, wave_right / 2), np.subtract(wave_left, wave_right / 2)] - ) + return np.asfortranarray([np.add(wave_left, wave_right / 2), np.subtract(wave_left, wave_right / 2)]) elif mid_side_b2: return np.asfortranarray( [ @@ -326,9 +304,7 @@ def spectrogram_to_wave_mt(spec, hop_length, mid_side, reverse, mid_side_b2): global wave_left wave_left = librosa.istft(**kwargs) - thread = threading.Thread( - target=run_thread, kwargs={"stft_matrix": spec_left, "hop_length": hop_length} - ) + thread = threading.Thread(target=run_thread, kwargs={"stft_matrix": spec_left, "hop_length": hop_length}) thread.start() wave_right = librosa.istft(spec_right, hop_length=hop_length) thread.join() @@ -336,9 +312,7 @@ def spectrogram_to_wave_mt(spec, hop_length, mid_side, reverse, mid_side_b2): if reverse: return np.asfortranarray([np.flip(wave_left), np.flip(wave_right)]) elif mid_side: - return np.asfortranarray( - [np.add(wave_left, wave_right / 2), np.subtract(wave_left, wave_right / 2)] - ) + return np.asfortranarray([np.add(wave_left, wave_right / 2), np.subtract(wave_left, wave_right / 2)]) elif mid_side_b2: return np.asfortranarray( [ @@ -357,21 +331,15 @@ def cmb_spectrogram_to_wave(spec_m, mp, extra_bins_h=None, extra_bins=None): for d in range(1, bands_n + 1): bp = mp.param["band"][d] - spec_s = np.ndarray( - shape=(2, bp["n_fft"] // 2 + 1, spec_m.shape[2]), dtype=complex - ) + spec_s = np.ndarray(shape=(2, bp["n_fft"] // 2 + 1, spec_m.shape[2]), dtype=complex) h = bp["crop_stop"] - bp["crop_start"] - spec_s[:, bp["crop_start"] : bp["crop_stop"], :] = spec_m[ - :, offset : offset + h, : - ] + spec_s[:, bp["crop_start"] : bp["crop_stop"], :] = spec_m[:, offset : offset + h, :] offset += h if d == bands_n: # higher if extra_bins_h: # if --high_end_process bypass max_bin = bp["n_fft"] // 2 - spec_s[:, max_bin - extra_bins_h : max_bin, :] = extra_bins[ - :, :extra_bins_h, : - ] + spec_s[:, max_bin - extra_bins_h : max_bin, :] = extra_bins[:, :extra_bins_h, :] if bp["hpf_start"] > 0: spec_s = fft_hp_filter(spec_s, bp["hpf_start"], bp["hpf_stop"] - 1) if bands_n == 1: @@ -405,9 +373,9 @@ def cmb_spectrogram_to_wave(spec_m, mp, extra_bins_h=None, extra_bins=None): mp.param["mid_side_b2"], mp.param["reverse"], ), - orig_sr = bp["sr"], - target_sr = sr, - res_type = "sinc_fastest", + orig_sr=bp["sr"], + target_sr=sr, + res_type="sinc_fastest", ) else: # mid spec_s = fft_hp_filter(spec_s, bp["hpf_start"], bp["hpf_stop"] - 1) @@ -456,10 +424,7 @@ def mirroring(a, spec_m, input_high_end, mp): np.abs( spec_m[ :, - mp.param["pre_filter_start"] - - 10 - - input_high_end.shape[1] : mp.param["pre_filter_start"] - - 10, + mp.param["pre_filter_start"] - 10 - input_high_end.shape[1] : mp.param["pre_filter_start"] - 10, :, ] ), @@ -467,19 +432,14 @@ def mirroring(a, spec_m, input_high_end, mp): ) mirror = mirror * np.exp(1.0j * np.angle(input_high_end)) - return np.where( - np.abs(input_high_end) <= np.abs(mirror), input_high_end, mirror - ) + return np.where(np.abs(input_high_end) <= np.abs(mirror), input_high_end, mirror) if "mirroring2" == a: mirror = np.flip( np.abs( spec_m[ :, - mp.param["pre_filter_start"] - - 10 - - input_high_end.shape[1] : mp.param["pre_filter_start"] - - 10, + mp.param["pre_filter_start"] - 10 - input_high_end.shape[1] : mp.param["pre_filter_start"] - 10, :, ] ), @@ -528,7 +488,6 @@ def istft(spec, hl): if __name__ == "__main__": import argparse - import sys import time import cv2 @@ -573,10 +532,10 @@ if __name__ == "__main__": if d == len(mp.param["band"]): # high-end band wave[d], _ = librosa.load( args.input[i], - sr = bp["sr"], - mono = False, - dtype = np.float32, - res_type = bp["res_type"], + sr=bp["sr"], + mono=False, + dtype=np.float32, + res_type=bp["res_type"], ) if len(wave[d].shape) == 1: # mono to stereo @@ -584,9 +543,9 @@ if __name__ == "__main__": else: # lower bands wave[d] = librosa.resample( wave[d + 1], - orig_sr = mp.param["band"][d + 1]["sr"], - target_sr = bp["sr"], - res_type = bp["res_type"], + orig_sr=mp.param["band"][d + 1]["sr"], + target_sr=bp["sr"], + res_type=bp["res_type"], ) spec[d] = wave_to_spectrogram( diff --git a/tools/uvr5/lib/utils.py b/tools/uvr5/lib/utils.py index 5e8cd22f..0166d52b 100644 --- a/tools/uvr5/lib/utils.py +++ b/tools/uvr5/lib/utils.py @@ -27,9 +27,7 @@ def inference(X_spec, device, model, aggressiveness, data): data : dic configs """ - def _execute( - X_mag_pad, roi_size, n_window, device, model, aggressiveness, is_half=True - ): + def _execute(X_mag_pad, roi_size, n_window, device, model, aggressiveness, is_half=True): model.eval() with torch.no_grad(): preds = [] @@ -39,9 +37,7 @@ def inference(X_spec, device, model, aggressiveness, data): total_iterations = sum(iterations) for i in tqdm(range(n_window)): start = i * roi_size - X_mag_window = X_mag_pad[ - None, :, :, start : start + data["window_size"] - ] + X_mag_window = X_mag_pad[None, :, :, start : start + data["window_size"]] X_mag_window = torch.from_numpy(X_mag_window) if is_half: X_mag_window = X_mag_window.half() @@ -76,9 +72,7 @@ def inference(X_spec, device, model, aggressiveness, data): is_half = True else: is_half = False - pred = _execute( - X_mag_pad, roi_size, n_window, device, model, aggressiveness, is_half - ) + pred = _execute(X_mag_pad, roi_size, n_window, device, model, aggressiveness, is_half) pred = pred[:, :, :n_frame] if data["tta"]: @@ -88,9 +82,7 @@ def inference(X_spec, device, model, aggressiveness, data): X_mag_pad = np.pad(X_mag_pre, ((0, 0), (0, 0), (pad_l, pad_r)), mode="constant") - pred_tta = _execute( - X_mag_pad, roi_size, n_window, device, model, aggressiveness, is_half - ) + pred_tta = _execute(X_mag_pad, roi_size, n_window, device, model, aggressiveness, is_half) pred_tta = pred_tta[:, :, roi_size // 2 :] pred_tta = pred_tta[:, :, :n_frame] diff --git a/webui.py b/webui.py index cddbb029..8a9e0856 100644 --- a/webui.py +++ b/webui.py @@ -147,7 +147,9 @@ if torch.cuda.is_available() or ngpu != 0: # mem.append(psutil.virtual_memory().total/ 1024 / 1024 / 1024) # 实测使用系统内存作为显存不会爆显存 -v3v4set={"v3","v4"} +v3v4set = {"v3", "v4"} + + def set_default(): global \ default_batch_size, \ @@ -589,6 +591,7 @@ def close_denoise(): p_train_SoVITS = None process_name_sovits = i18n("SoVITS训练") + def open1Ba( batch_size, total_epoch, @@ -641,7 +644,9 @@ def open1Ba( yield ( process_info(process_name_sovits, "opened"), {"__type__": "update", "visible": False}, - {"__type__": "update", "visible": True},{"__type__": "update"},{"__type__": "update"} + {"__type__": "update", "visible": True}, + {"__type__": "update"}, + {"__type__": "update"}, ) print(cmd) p_train_SoVITS = Popen(cmd, shell=True) @@ -651,13 +656,17 @@ def open1Ba( yield ( process_info(process_name_sovits, "finish"), {"__type__": "update", "visible": True}, - {"__type__": "update", "visible": False},SoVITS_dropdown_update,GPT_dropdown_update + {"__type__": "update", "visible": False}, + SoVITS_dropdown_update, + GPT_dropdown_update, ) else: yield ( process_info(process_name_sovits, "occupy"), {"__type__": "update", "visible": False}, - {"__type__": "update", "visible": True},{"__type__": "update"},{"__type__": "update"} + {"__type__": "update", "visible": True}, + {"__type__": "update"}, + {"__type__": "update"}, ) @@ -726,7 +735,9 @@ def open1Bb( yield ( process_info(process_name_gpt, "opened"), {"__type__": "update", "visible": False}, - {"__type__": "update", "visible": True},{"__type__": "update"},{"__type__": "update"} + {"__type__": "update", "visible": True}, + {"__type__": "update"}, + {"__type__": "update"}, ) print(cmd) p_train_GPT = Popen(cmd, shell=True) @@ -736,13 +747,17 @@ def open1Bb( yield ( process_info(process_name_gpt, "finish"), {"__type__": "update", "visible": True}, - {"__type__": "update", "visible": False},SoVITS_dropdown_update,GPT_dropdown_update + {"__type__": "update", "visible": False}, + SoVITS_dropdown_update, + GPT_dropdown_update, ) else: yield ( process_info(process_name_gpt, "occupy"), {"__type__": "update", "visible": False}, - {"__type__": "update", "visible": True},{"__type__": "update"},{"__type__": "update"} + {"__type__": "update", "visible": True}, + {"__type__": "update"}, + {"__type__": "update"}, ) @@ -1291,6 +1306,7 @@ def close1abc(): {"__type__": "update", "visible": False}, ) + def switch_version(version_): os.environ["version"] = version_ global version @@ -1492,7 +1508,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: with gr.Row(): exp_name = gr.Textbox(label=i18n("*实验/模型名"), value="xxx", interactive=True) gpu_info = gr.Textbox(label=i18n("显卡信息"), value=gpu_info, visible=True, interactive=False) - version_checkbox = gr.Radio(label=i18n("版本"), value=version, choices=["v1", "v2", "v4"])#, "v3" + version_checkbox = gr.Radio(label=i18n("版本"), value=version, choices=["v1", "v2", "v4"]) # , "v3" with gr.Row(): pretrained_s2G = gr.Textbox( label=i18n("预训练SoVITS-G模型路径"), @@ -1915,7 +1931,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: if_grad_ckpt, lora_rank, ], - [info1Ba, button1Ba_open, button1Ba_close,SoVITS_dropdown,GPT_dropdown], + [info1Ba, button1Ba_open, button1Ba_close, SoVITS_dropdown, GPT_dropdown], ) button1Bb_open.click( open1Bb, @@ -1930,7 +1946,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: gpu_numbers1Bb, pretrained_s1, ], - [info1Bb, button1Bb_open, button1Bb_close,SoVITS_dropdown,GPT_dropdown], + [info1Bb, button1Bb_open, button1Bb_close, SoVITS_dropdown, GPT_dropdown], ) version_checkbox.change( switch_version, From b2096b88f85cdd114586d545938c3d3024d81930 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 13:19:15 +0100 Subject: [PATCH 060/183] Update Docs and fix bugs --- .github/workflows/docker-publish.yaml | 2 +- Dockerfile | 3 +- README.md | 92 +++++++++++++-------- docker-compose.yaml | 54 ++++++++++-- docs/cn/README.md | 115 +++++++++++++++----------- docs/ja/README.md | 89 ++++++++++++-------- docs/ko/README.md | 82 +++++++++++------- docs/tr/README.md | 87 ++++++++++++------- 8 files changed, 338 insertions(+), 186 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index f83ee1eb..2d909c94 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -241,7 +241,7 @@ jobs: run: | sudo apt-get update && sudo apt-get install -y jq - TOKEN=$(curl -s -u $DOCKER_HUB_USERNAME:$DOCKER_HUB_TOKEN" \ + 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) diff --git a/Dockerfile b/Dockerfile index edf63a4f..e4d7185a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,8 +42,9 @@ EXPOSE 9871 9872 9873 9874 9880 ENV PYTHONPATH="/workspace/GPT-SoVITS" +RUN conda init bash && echo "conda activate base" >> ~/.bashrc + CMD ["/bin/bash", "-c", "\ - source $HOME/anaconda3/etc/profile.d/conda.sh && \ rm -rf /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models && \ rm -rf /workspace/GPT-SoVITS/tools/asr/models && \ rm -rf /workspace/GPT-SoVITS/tools/uvr5/uvr5_weights && \ diff --git a/README.md b/README.md index 463649ac..5495a142 100644 --- a/README.md +++ b/README.md @@ -44,15 +44,15 @@ For users in China, you can [click here](https://www.codewithgpu.com/i/RVC-Boss/ ### Tested Environments -| Python Version | PyTorch Version | Device | -|----------------|------------------|-----------------| -| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | -| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | -| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | -| Python 3.9 | PyTorch 2.5.1 | Apple silicon | -| Python 3.11 | PyTorch 2.6.0 | Apple silicon | -| Python 3.9 | PyTorch 2.2.2 | CPU | -| Python 3.9 | PyTorch 2.8.0dev | CUDA12.8(for Nvidia50x0) | +| Python Version | PyTorch Version | Device | +| -------------- | ---------------- | -------------------- | +| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | +| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | +| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.9 | PyTorch 2.8.0dev | CUDA12.8 (for sm120) | +| Python 3.9 | PyTorch 2.5.1 | Apple silicon | +| Python 3.11 | PyTorch 2.6.0 | Apple silicon | +| Python 3.9 | PyTorch 2.2.2 | CPU | ### Windows @@ -118,29 +118,51 @@ pip install -r extra-req.txt --no-deps pip install -r requirements.txt ``` -### Using Docker +### Running GPT-SoVITS with Docker -#### docker-compose.yaml configuration +#### Docker Image Selection -0. Regarding image tags: Due to rapid updates in the codebase and the slow process of packaging and testing images, please check [Docker Hub](https://hub.docker.com/r/breakstring/gpt-sovits)(outdated) for the currently packaged latest images and select as per your situation, or alternatively, build locally using a Dockerfile according to your own needs. -1. Environment Variables: - - is_half: Controls half-precision/double-precision. This is typically the cause if the content under the directories 4-cnhubert/5-wav32k is not generated correctly during the "SSL extracting" step. Adjust to True or False based on your actual situation. -2. Volumes Configuration, The application's root directory inside the container is set to /workspace. The default docker-compose.yaml lists some practical examples for uploading/downloading content. -3. shm_size: The default available memory for Docker Desktop on Windows is too small, which can cause abnormal operations. Adjust according to your own situation. -4. Under the deploy section, GPU-related settings should be adjusted cautiously according to your system and actual circumstances. +Due to rapid development in the codebase and a slower Docker image release cycle, please: -#### Running with docker compose +- Check [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) for the latest available image tags. +- Choose an appropriate image tag for your environment. +- Optionally, build the image locally using the provided Dockerfile for the most up-to-date changes. -``` -docker compose -f "docker-compose.yaml" up -d +#### Environment Variables + +- `is_half`: Controls whether half-precision (fp16) is enabled. Set to `true` if your GPU supports it to reduce memory usage. + +#### Shared Memory Configuration + +On Windows (Docker Desktop), the default shared memory size is small and may cause unexpected behavior. Increase `shm_size` (e.g., to `16g`) in your Docker Compose file based on your available system memory. + +#### Choosing a Service + +The `docker-compose.yaml` defines two services: + +- `GPT-SoVITS-CU124` & `GPT-SoVITS-CU128`: Full version with all features. +- `GPT-SoVITS-CU124-Lite` & `GPT-SoVITS-CU128-Lite`: Lightweight version with reduced dependencies and functionality. + +To run a specific service with Docker Compose, use: + +```bash +docker compose run --service-ports ``` -#### Running with docker command +#### Building the Docker Image Locally -As above, modify the corresponding parameters based on your actual situation, then run the following command: +If you want to build the image yourself, use: +```bash +bash docker_build.sh --cuda <12.4|12.8> [--lite] ``` -docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-DockerTest\output:/workspace/output --volume=G:\GPT-SoVITS-DockerTest\logs:/workspace/logs --volume=G:\GPT-SoVITS-DockerTest\SoVITS_weights:/workspace/SoVITS_weights --workdir=/workspace -p 9880:9880 -p 9871:9871 -p 9872:9872 -p 9873:9873 -p 9874:9874 --shm-size="16G" -d breakstring/gpt-sovits:xxxxx + +#### Accessing the Running Container (Bash Shell) + +Once the container is running in the background, you can access it using: + +```bash +docker exec -it bash ``` ## Pretrained Models @@ -168,7 +190,9 @@ docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-Docker The TTS annotation .list file format: ``` + vocal_path|speaker_name|language|text + ``` Language dictionary: @@ -182,7 +206,9 @@ Language dictionary: Example: ``` + D:\GPT-SoVITS\xxx/xxx.wav|xxx|en|I like playing Genshin. + ``` ## Finetune and inference @@ -212,12 +238,12 @@ Or maunally switch version in WebUI #### Path Auto-filling is now supported - 1. Fill in the audio path - 2. Slice the audio into small chunks - 3. Denoise(optinal) - 4. ASR - 5. Proofreading ASR transcriptions - 6. Go to the next Tab, then finetune the model +1. Fill in the audio path +2. Slice the audio into small chunks +3. Denoise(optinal) +4. ASR +5. Proofreading ASR transcriptions +6. Go to the next Tab, then finetune the model ### Open Inference WebUI @@ -322,7 +348,7 @@ Use v4 from v1/v2/v3 environment: Use the command line to open the WebUI for UVR5 -``` +```bash python tools/uvr5/webui.py "" ``` @@ -333,7 +359,7 @@ python mdxnet.py --model --input_root --output_vocal --output_ins --agg_level -- This is how the audio segmentation of the dataset is done using the command line -``` +```bash python audio_slicer.py \ --input_path "" \ --output_root "" \ @@ -345,7 +371,7 @@ python audio_slicer.py \ This is how dataset ASR processing is done using the command line(Only Chinese) -``` +```bash python tools/asr/funasr_asr.py -i -o ``` @@ -353,7 +379,7 @@ ASR processing is performed through Faster_Whisper(ASR marking except Chinese) (No progress bars, GPU performance may cause time delays) -``` +```bash python ./tools/asr/fasterwhisper_asr.py -i -o -l -p ``` diff --git a/docker-compose.yaml b/docker-compose.yaml index 28ef3a63..f519cef3 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,9 +1,9 @@ version: "3.8" services: - GPT-SoVITS: - image: xxxxrt666/gpt-sovits:latest - container_name: GPT-SoVITS + GPT-SoVITS-CU124: + image: xxxxrt666/gpt-sovits:latest-cu124 + container_name: GPT-SoVITS-CU124 ports: - "9871:9871" - "9872:9872" @@ -22,9 +22,51 @@ services: shm_size: "16g" restart: unless-stopped runtime: nvidia - GPT-SoVITS-Lite: - image: xxxxrt666/gpt-sovits:latest-lite - container_name: GPT-SoVITS-Lite + GPT-SoVITS-CU124-Lite: + image: xxxxrt666/gpt-sovits:latest-cu124-lite + container_name: GPT-SoVITS-CU124-Lite + ports: + - "9871:9871" + - "9872:9872" + - "9873:9873" + - "9874:9874" + - "9880:9880" + volumes: + - .:/workspace/GPT-SoVITS + - /dev/null:/workspace/GPT-SoVITS/pretrained_models + - /dev/null:/workspace/tools/asr/models + - /dev/null:/workspace/tools/uvr5/uvr5_weights + environment: + - is_half=true + tty: true + stdin_open: true + shm_size: "16g" + restart: unless-stopped + runtime: nvidia + GPT-SoVITS-CU128: + image: xxxxrt666/gpt-sovits:latest-cu128 + container_name: GPT-SoVITS-CU128 + ports: + - "9871:9871" + - "9872:9872" + - "9873:9873" + - "9874:9874" + - "9880:9880" + volumes: + - .:/workspace/GPT-SoVITS + - /dev/null:/workspace/GPT-SoVITS/pretrained_models + - /dev/null:/workspace/tools/asr/models + - /dev/null:/workspace/tools/uvr5/uvr5_weights + environment: + - is_half=true + tty: true + stdin_open: true + shm_size: "16g" + restart: unless-stopped + runtime: nvidia + GPT-SoVITS-CU128-Lite: + image: xxxxrt666/gpt-sovits:latest-cu128-lite + container_name: GPT-SoVITS-CU128-Lite ports: - "9871:9871" - "9872:9872" diff --git a/docs/cn/README.md b/docs/cn/README.md index cc72b893..097ee9a5 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -20,21 +20,21 @@ --- -## 功能: +## 功能 -1. **零样本文本到语音 (TTS): ** 输入 5 秒的声音样本, 即刻体验文本到语音转换. +1. **零样本文本到语音 (TTS):** 输入 5 秒的声音样本, 即刻体验文本到语音转换. -2. **少样本 TTS: ** 仅需 1 分钟的训练数据即可微调模型, 提升声音相似度和真实感. +2. **少样本 TTS:** 仅需 1 分钟的训练数据即可微调模型, 提升声音相似度和真实感. -3. **跨语言支持: ** 支持与训练数据集不同语言的推理, 目前支持英语、日语、韩语、粤语和中文. +3. **跨语言支持:** 支持与训练数据集不同语言的推理, 目前支持英语、日语、韩语、粤语和中文. -4. **WebUI 工具: ** 集成工具包括声音伴奏分离、自动训练集分割、中文自动语音识别(ASR)和文本标注, 协助初学者创建训练数据集和 GPT/SoVITS 模型. +4. **WebUI 工具:** 集成工具包括声音伴奏分离、自动训练集分割、中文自动语音识别(ASR)和文本标注, 协助初学者创建训练数据集和 GPT/SoVITS 模型. **查看我们的介绍视频 [demo video](https://www.bilibili.com/video/BV12g4y1m7Uw)** -未见过的说话者 few-shot 微调演示: +未见过的说话者 few-shot 微调演示: -https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-80c060ab47fb + **用户手册: [简体中文](https://www.yuque.com/baicaigongchang1145haoyuangong/ib3g1e) | [English](https://rentry.co/GPT-SoVITS-guide#/)** @@ -44,14 +44,15 @@ https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350- ### 测试通过的环境 -| Python Version | PyTorch Version | Device | -|----------------|------------------|-----------------| -| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | -| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | -| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | -| Python 3.9 | PyTorch 2.5.1 | Apple silicon | -| Python 3.11 | PyTorch 2.6.0 | Apple silicon | -| Python 3.9 | PyTorch 2.2.2 | CPU | +| Python Version | PyTorch Version | Device | +| -------------- | ---------------- | -------------------- | +| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | +| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | +| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.9 | PyTorch 2.8.0dev | CUDA12.8 (for sm120) | +| Python 3.9 | PyTorch 2.5.1 | Apple silicon | +| Python 3.11 | PyTorch 2.6.0 | Apple silicon | +| Python 3.9 | PyTorch 2.2.2 | CPU | ### Windows @@ -72,7 +73,7 @@ bash install.sh --source [--download-uvr5] **注: 在 Mac 上使用 GPU 训练的模型效果显著低于其他设备训练的模型, 所以我们暂时使用 CPU 进行训练.** 1. 运行 `xcode-select --install` 安装 Xcode command-line tools. -2. 运行以下的命令来安装本项目: +2. 运行以下的命令来安装本项目: ```bash conda create -n GPTSoVits python=3.9 @@ -117,31 +118,51 @@ pip install -r extra-req.txt --no-deps pip install -r requirements.txt ``` -### 在 Docker 中使用 +### 运行 GPT-SoVITS(使用 Docker) -#### docker-compose.yaml 设置 +#### Docker 镜像选择 -0. image 的标签: 由于代码库更新很快, 镜像的打包和测试又很慢, 所以请自行在 [Docker Hub](https://hub.docker.com/r/breakstring/gpt-sovits)(旧版本) 查看当前打包好的最新的镜像并根据自己的情况选用, 或者在本地根据您自己的需求通过 Dockerfile 进行构建. -1. 环境变量: +由于代码库更新频繁,而 Docker 镜像的发布周期相对较慢,请注意: -- is_half: 半精度/双精度控制.在进行 "SSL extracting" 步骤时如果无法正确生成 4-cnhubert/5-wav32k 目录下的内容时, 一般都是它引起的, 可以根据实际情况来调整为 True 或者 False. +- 前往 [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) 查看最新可用的镜像标签(tags)。 +- 根据你的运行环境选择合适的镜像标签。 +- 可选:为了获得最新的更改,你可以使用提供的 Dockerfile 在本地构建镜像。 -2. Volume 设置, 容器内的应用根目录设置为 /workspace. 默认的 docker-compose.yaml 中列出了一些实际的例子, 便于上传/下载内容. -3. shm_size: Windows 下的 Docker Desktop 默认可用内存过小, 会导致运行异常, 根据自己情况酌情设置. -4. deploy 小节下的 gpu 相关内容, 请根据您的系统和实际情况酌情设置. +#### 环境变量 -#### 通过 docker compose 运行 +- `is_half`:控制是否启用半精度(fp16)。如果你的 GPU 支持,设置为 `true` 可以减少显存占用。 -``` -docker compose -f "docker-compose.yaml" up -d +#### 共享内存配置 + +在 Windows(Docker Desktop)中,默认共享内存大小较小,可能导致运行异常。请在 Docker Compose 文件中根据系统内存情况,增大 `shm_size`(例如设置为 `16g`)。 + +#### 选择服务 + +`docker-compose.yaml` 文件定义了两个主要服务类型: + +- `GPT-SoVITS-CU124` 与 `GPT-SoVITS-CU128`:完整版,包含所有功能。 +- `GPT-SoVITS-CU124-Lite` 与 `GPT-SoVITS-CU128-Lite`:轻量版,依赖更少,功能略有删减。 + +如需使用 Docker Compose 运行指定服务,请执行: + +```bash +docker compose run --service-ports ``` -#### 通过 docker 命令运行 +#### 本地构建 Docker 镜像 -同上, 根据您自己的实际情况修改对应的参数, 然后运行如下命令: +如果你希望自行构建镜像,请使用以下命令: +```bash +bash docker_build.sh --cuda <12.4|12.8> [--lite] ``` -docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-DockerTest\output:/workspace/output --volume=G:\GPT-SoVITS-DockerTest\logs:/workspace/logs --volume=G:\GPT-SoVITS-DockerTest\SoVITS_weights:/workspace/SoVITS_weights --workdir=/workspace -p 9880:9880 -p 9871:9871 -p 9872:9872 -p 9873:9873 -p 9874:9874 --shm-size="16G" -d breakstring/gpt-sovits:xxxxx + +#### 访问运行中的容器(Bash Shell) + +当容器在后台运行时,你可以通过以下命令进入容器: + +```bash +docker exec -it bash ``` ## 预训练模型 @@ -166,13 +187,13 @@ docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-Docker ## 数据集格式 -文本到语音 (TTS) 注释 .list 文件格式: +文本到语音 (TTS) 注释 .list 文件格式: ``` vocal_path|speaker_name|language|text ``` -语言字典: +语言字典: - 'zh': 中文 - 'ja': 日语 @@ -180,7 +201,7 @@ vocal_path|speaker_name|language|text - 'ko': 韩语 - 'yue': 粤语 -示例: +示例: ``` D:\GPT-SoVITS\xxx/xxx.wav|xxx|zh|我爱玩原神. @@ -213,12 +234,12 @@ python webui.py v1 #### 现已支持自动填充路径 - 1. 填入训练音频路径 - 2. 切割音频 - 3. 进行降噪(可选) - 4. 进行ASR - 5. 校对标注 - 6. 前往下一个窗口,点击训练 +1. 填入训练音频路径 +2. 切割音频 +3. 进行降噪(可选) +4. 进行 ASR +5. 校对标注 +6. 前往下一个窗口,点击训练 ### 打开推理 WebUI @@ -286,7 +307,7 @@ python webui.py ## 待办事项清单 -- [x] **高优先级: ** +- [x] **高优先级:** - [x] 日语和英语的本地化. - [x] 用户指南. @@ -304,11 +325,11 @@ python webui.py - [x] 更好的 sovits 基础模型 (增强的音频质量). - [ ] 模型混合. -## (附加) 命令行运行方式 +## (附加) 命令行运行方式 使用命令行打开 UVR5 的 WebUI -``` +```bash python tools/uvr5/webui.py "" ``` @@ -319,7 +340,7 @@ python mdxnet.py --model --input_root --output_vocal --output_ins --agg_level -- 这是使用命令行完成数据集的音频切分的方式 -``` +```bash python audio_slicer.py \ --input_path "" \ --output_root "" \ @@ -331,15 +352,15 @@ python audio_slicer.py \ 这是使用命令行完成数据集 ASR 处理的方式 (仅限中文) -``` +```bash python tools/asr/funasr_asr.py -i -o ``` 通过 Faster_Whisper 进行 ASR 处理 (除中文之外的 ASR 标记) - (没有进度条, GPU 性能可能会导致时间延迟) +(没有进度条, GPU 性能可能会导致时间延迟) -``` +```bash python ./tools/asr/fasterwhisper_asr.py -i -o -l -p ``` @@ -347,7 +368,7 @@ python ./tools/asr/fasterwhisper_asr.py -i -o -l -p ## 致谢 -特别感谢以下项目和贡献者: +特别感谢以下项目和贡献者: ### 理论研究 diff --git a/docs/ja/README.md b/docs/ja/README.md index 145de219..f7908722 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -40,14 +40,15 @@ https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350- ### テスト済みの環境 -| Python Version | PyTorch Version | Device | -|----------------|------------------|-----------------| -| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | -| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | -| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | -| Python 3.9 | PyTorch 2.5.1 | Apple silicon | -| Python 3.11 | PyTorch 2.6.0 | Apple silicon | -| Python 3.9 | PyTorch 2.2.2 | CPU | +| Python Version | PyTorch Version | Device | +| -------------- | ---------------- | -------------------- | +| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | +| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | +| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.9 | PyTorch 2.5.1 | Apple silicon | +| Python 3.11 | PyTorch 2.6.0 | Apple silicon | +| Python 3.9 | PyTorch 2.2.2 | CPU | +| Python 3.9 | PyTorch 2.8.0dev | CUDA12.8 (for sm120) | ### Windows @@ -109,31 +110,51 @@ pip install -r extra-req.txt --no-deps pip install -r requirementx.txt ``` -### Docker の使用 +### GPT-SoVITS の実行(Docker 使用) -#### docker-compose.yaml の設定 +#### Docker イメージの選択 -0. イメージのタグについて: コードベースの更新が速い割に、イメージのパッケージングとテストが遅いため、[Docker Hub](https://hub.docker.com/r/breakstring/gpt-sovits)(古いバージョン) で現在パッケージされている最新のイメージをご覧になり、ご自身の状況に応じて選択するか、またはご自身のニーズに応じて Dockerfile を使用してローカルでビルドしてください. -1. 環境変数: +コードベースの更新が頻繁である一方、Docker イメージのリリースは比較的遅いため、以下を確認してください: - - `is_half`: 半精度/倍精度の制御."SSL 抽出"ステップ中に`4-cnhubert/5-wav32k`ディレクトリ内の内容が正しく生成されない場合、通常これが原因です.実際の状況に応じて True または False に調整してください. +- [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) で最新のイメージタグを確認してください。 +- 環境に合った適切なイメージタグを選択してください。 +- オプション:最新の変更を反映させるため、提供されている Dockerfile を使ってローカルでイメージをビルドすることも可能です。 -2. ボリューム設定: コンテナ内のアプリケーションのルートディレクトリは`/workspace`に設定されます.デフォルトの`docker-compose.yaml`には、アップロード/ダウンロードの内容の実例がいくつか記載されています. -3. `shm_size`: Windows の Docker Desktop のデフォルトの利用可能メモリは小さすぎるため、うまく動作しない可能性があります.状況に応じて適宜設定してください. -4. `deploy`セクションの GPU に関連する内容は、システムと実際の状況に応じて慎重に設定してください. +#### 環境変数 -#### docker compose で実行する +- `is_half`:半精度(fp16)を使用するかどうかを制御します。GPU が対応している場合、`true` に設定することでメモリ使用量を削減できます。 -```markdown -docker compose -f "docker-compose.yaml" up -d +#### 共有メモリの設定 + +Windows(Docker Desktop)では、デフォルトの共有メモリサイズが小さいため、予期しない動作が発生する可能性があります。Docker Compose ファイル内の `shm_size` を(例:`16g`)に増やすことをおすすめします。 + +#### サービスの選択 + +`docker-compose.yaml` ファイルには次の 2 種類のサービスが定義されています: + +- `GPT-SoVITS-CU124` および `GPT-SoVITS-CU128`:すべての機能を含むフルバージョン +- `GPT-SoVITS-CU124-Lite` および `GPT-SoVITS-CU128-Lite`:依存関係を削減した軽量バージョン + +特定のサービスを Docker Compose で実行するには、以下のコマンドを使用します: + +```bash +docker compose run --service-ports ``` -#### docker コマンドで実行する +#### Docker イメージのローカルビルド -上記と同様に、実際の状況に基づいて対応するパラメータを変更し、次のコマンドを実行します: +自分でイメージをビルドするには、以下のコマンドを使ってください: -```markdown -docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-DockerTest\output:/workspace/output --volume=G:\GPT-SoVITS-DockerTest\logs:/workspace/logs --volume=G:\GPT-SoVITS-DockerTest\SoVITS_weights:/workspace/SoVITS_weights --workdir=/workspace -p 9880:9880 -p 9871:9871 -p 9872:9872 -p 9873:9873 -p 9874:9874 --shm-size="16G" -d breakstring/gpt-sovits:xxxxx +```bash +bash docker_build.sh --cuda <12.4|12.8> [--lite] +``` + +#### 実行中のコンテナへアクセス(Bash Shell) + +コンテナがバックグラウンドで実行されている場合、以下のコマンドでシェルにアクセスできます: + +```bash +docker exec -it bash ``` ## 事前訓練済みモデル @@ -201,12 +222,12 @@ python webui.py v1 <言語(オプション)> #### パス自動補完のサポート - 1. 音声パスを入力する - 2. 音声を小さなチャンクに分割する - 3. ノイズ除去 (オプション) - 4. ASR - 5. ASR転写を校正する - 6. 次のタブに移動し、モデルを微調整する +1. 音声パスを入力する +2. 音声を小さなチャンクに分割する +3. ノイズ除去 (オプション) +4. ASR +5. ASR 転写を校正する +6. 次のタブに移動し、モデルを微調整する ### 推論 WebUI を開く @@ -296,7 +317,7 @@ v2 環境から v3 を使用する方法: コマンド ラインを使用して UVR5 の WebUI を開きます -``` +```bash python tools/uvr5/webui.py "" ``` @@ -307,7 +328,7 @@ python mdxnet.py --model --input_root --output_vocal --output_ins --agg_level -- コマンド ラインを使用してデータセットのオーディオ セグメンテーションを行う方法は次のとおりです. -``` +```bash python audio_slicer.py \ --input_path "" \ --output_root "" \ @@ -319,7 +340,7 @@ python audio_slicer.py \ コマンドラインを使用してデータセット ASR 処理を行う方法です (中国語のみ) -``` +```bash python tools/asr/funasr_asr.py -i -o ``` @@ -327,7 +348,7 @@ ASR 処理は Faster_Whisper を通じて実行されます(中国語を除く A (進行状況バーは表示されません.GPU のパフォーマンスにより時間遅延が発生する可能性があります) -``` +```bash python ./tools/asr/fasterwhisper_asr.py -i -o -l -p ``` @@ -335,7 +356,7 @@ python ./tools/asr/fasterwhisper_asr.py -i -o -l -p ## クレジット -特に以下のプロジェクトと貢献者に感謝します: +特に以下のプロジェクトと貢献者に感謝します: ### 理論研究 diff --git a/docs/ko/README.md b/docs/ko/README.md index e9fee8fc..11c00a3c 100644 --- a/docs/ko/README.md +++ b/docs/ko/README.md @@ -40,14 +40,15 @@ https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350- ### 테스트 통과 환경 -| Python Version | PyTorch Version | Device | -|----------------|------------------|-----------------| -| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | -| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | -| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | -| Python 3.9 | PyTorch 2.5.1 | Apple silicon | -| Python 3.11 | PyTorch 2.6.0 | Apple silicon | -| Python 3.9 | PyTorch 2.2.2 | CPU | +| Python Version | PyTorch Version | Device | +| -------------- | ---------------- | -------------------- | +| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | +| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | +| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.9 | PyTorch 2.8.0dev | CUDA12.8 (for sm120) | +| Python 3.9 | PyTorch 2.5.1 | Apple silicon | +| Python 3.11 | PyTorch 2.6.0 | Apple silicon | +| Python 3.9 | PyTorch 2.2.2 | CPU | ### Windows @@ -111,34 +112,51 @@ pip install -r extra-req.txt --no-deps pip install -r requirements.txt ``` -### Docker에서 사용 +### GPT-SoVITS 실행하기 (Docker 사용) -#### docker-compose.yaml 설정 +#### Docker 이미지 선택 -0. 이미지 태그: 코드 저장소가 빠르게 업데이트되고 패키지가 느리게 빌드되고 테스트되므로, 현재 빌드된 최신 도커 이미지를 [Docker Hub](https://hub.docker.com/r/breakstring/gpt-sovits)(오래된 버전) 에서 확인하고 필요에 따라 Dockerfile을 사용하여 로컬에서 빌드할 수 있습니다. +코드베이스가 빠르게 업데이트되는 반면 Docker 이미지 릴리스 주기는 느리기 때문에 다음을 참고하세요: -1. 환경 변수: +- [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits)에서 최신 이미지 태그를 확인하세요. +- 환경에 맞는 적절한 이미지 태그를 선택하세요. +- 선택 사항: 최신 변경사항을 반영하려면 제공된 Dockerfile을 사용하여 로컬에서 직접 이미지를 빌드할 수 있습니다. -- is_half: 반정밀/배정밀 제어. "SSL 추출" 단계에서 4-cnhubert/5-wav32k 디렉토리의 내용을 올바르게 생성할 수 없는 경우, 일반적으로 이것 때문입니다. 실제 상황에 따라 True 또는 False로 조정할 수 있습니다. +#### 환경 변수 -2. 볼륨 설정, 컨테이너 내의 애플리케이션 루트 디렉토리를 /workspace로 설정합니다. 기본 docker-compose.yaml에는 실제 예제가 나열되어 있으므로 업로드/다운로드를 쉽게 할 수 있습니다. +- `is_half`: 반정밀도(fp16) 사용 여부를 제어합니다. GPU가 지원하는 경우 `true`로 설정하면 메모리 사용량을 줄일 수 있습니다. -3. shm_size: Windows의 Docker Desktop의 기본 사용 가능한 메모리가 너무 작아 오류가 발생할 수 있으므로 실제 상황에 따라 조정합니다. +#### 공유 메모리 설정 -4. deploy 섹션의 gpu 관련 내용은 시스템 및 실제 상황에 따라 조정합니다. +Windows(Docker Desktop)에서는 기본 공유 메모리 크기가 작아 예기치 않은 동작이 발생할 수 있습니다. 시스템 메모리 상황에 따라 Docker Compose 파일에서 `shm_size`를 (예: `16g`)로 증가시키는 것이 좋습니다. -#### docker compose로 실행 +#### 서비스 선택 -``` -docker compose -f "docker-compose.yaml" up -d +`docker-compose.yaml` 파일에는 두 가지 서비스 유형이 정의되어 있습니다: + +- `GPT-SoVITS-CU124` 및 `GPT-SoVITS-CU128`: 전체 기능을 포함한 풀 버전 +- `GPT-SoVITS-CU124-Lite` 및 `GPT-SoVITS-CU128-Lite`: 의존성이 줄어든 경량 버전 + +특정 서비스를 Docker Compose로 실행하려면 다음 명령을 사용하세요: + +```bash +docker compose run --service-ports ``` -#### docker 명령으로 실행 +#### Docker 이미지 직접 빌드하기 -위와 동일하게 실제 상황에 맞게 매개변수를 수정한 다음 다음 명령을 실행합니다: +직접 이미지를 빌드하려면 다음 명령어를 사용하세요: +```bash +bash docker_build.sh --cuda <12.4|12.8> [--lite] ``` -docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-DockerTest\output:/workspace/output --volume=G:\GPT-SoVITS-DockerTest\logs:/workspace/logs --volume=G:\GPT-SoVITS-DockerTest\SoVITS_weights:/workspace/SoVITS_weights --workdir=/workspace -p 9880:9880 -p 9871:9871 -p 9872:9872 -p 9873:9873 -p 9874:9874 --shm-size="16G" -d breakstring/gpt-sovits:xxxxx + +#### 실행 중인 컨테이너 접속하기 (Bash Shell) + +컨테이너가 백그라운드에서 실행 중일 때 다음 명령어로 셸에 접속할 수 있습니다: + +```bash +docker exec -it bash ``` ## 사전 학습된 모델 @@ -206,12 +224,12 @@ python webui.py v1 <언어(옵션)> #### 경로 자동 채우기가 지원됩니다 - 1. 오디오 경로를 입력하십시오. - 2. 오디오를 작은 청크로 분할하십시오. - 3. 노이즈 제거(옵션) - 4. ASR 수행 - 5. ASR 전사를 교정하십시오. - 6. 다음 탭으로 이동하여 모델을 미세 조정하십시오. +1. 오디오 경로를 입력하십시오. +2. 오디오를 작은 청크로 분할하십시오. +3. 노이즈 제거(옵션) +4. ASR 수행 +5. ASR 전사를 교정하십시오. +6. 다음 탭으로 이동하여 모델을 미세 조정하십시오. ### 추론 WebUI 열기 @@ -302,7 +320,7 @@ v2 환경에서 v3 사용하기: 명령줄을 사용하여 UVR5용 WebUI 열기 -``` +```bash python tools/uvr5/webui.py "" ``` @@ -313,7 +331,7 @@ python mdxnet.py --model --input_root --output_vocal --output_ins --agg_level -- 명령줄을 사용하여 데이터세트의 오디오 분할을 수행하는 방법은 다음과 같습니다. -``` +```bash python audio_slicer.py \ --input_path "" \ --output_root "" \ @@ -325,7 +343,7 @@ python audio_slicer.py \ 명령줄을 사용하여 데이터 세트 ASR 처리를 수행하는 방법입니다(중국어만 해당). -``` +```bash python tools/asr/funasr_asr.py -i -o ``` @@ -333,7 +351,7 @@ ASR 처리는 Faster_Whisper(중국어를 제외한 ASR 마킹)를 통해 수행 (진행률 표시줄 없음, GPU 성능으로 인해 시간 지연이 발생할 수 있음) -``` +```bash python ./tools/asr/fasterwhisper_asr.py -i -o -l -p ``` diff --git a/docs/tr/README.md b/docs/tr/README.md index d59f66ba..3d5a9dbe 100644 --- a/docs/tr/README.md +++ b/docs/tr/README.md @@ -42,14 +42,15 @@ https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350- ### Test Edilmiş Ortamlar -| Python Version | PyTorch Version | Device | -|----------------|------------------|-----------------| -| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | -| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | -| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | -| Python 3.9 | PyTorch 2.5.1 | Apple silicon | -| Python 3.11 | PyTorch 2.6.0 | Apple silicon | -| Python 3.9 | PyTorch 2.2.2 | CPU | +| Python Version | PyTorch Version | Device | +| -------------- | ---------------- | -------------------- | +| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | +| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | +| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.9 | PyTorch 2.8.0dev | CUDA12.8 (for sm120) | +| Python 3.9 | PyTorch 2.5.1 | Apple silicon | +| Python 3.11 | PyTorch 2.6.0 | Apple silicon | +| Python 3.9 | PyTorch 2.2.2 | CPU | ### Windows @@ -111,29 +112,51 @@ pip install -r extra-req.txt --no-deps pip install -r requirements.txt ``` -### Docker Kullanarak +### GPT-SoVITS Çalıştırma (Docker Kullanarak) -#### docker-compose.yaml yapılandırması +#### Docker İmajı Seçimi -0. Görüntü etiketleri hakkında: Kod tabanındaki hızlı güncellemeler ve görüntüleri paketleme ve test etme işleminin yavaş olması nedeniyle, lütfen şu anda paketlenmiş en son görüntüleri kontrol etmek için [Docker Hub](https://hub.docker.com/r/breakstring/gpt-sovits)(eski sürüm) adresini kontrol edin ve durumunuza göre seçim yapın veya alternatif olarak, kendi ihtiyaçlarınıza göre bir Dockerfile kullanarak yerel olarak oluşturun. -1. Ortam Değişkenleri: - - is_half: Yarım hassasiyet/çift hassasiyeti kontrol eder. Bu genellikle "SSL çıkarma" adımı sırasında 4-cnhubert/5-wav32k dizinleri altındaki içeriğin doğru şekilde oluşturulmamasının nedenidir. Gerçek durumunuza göre True veya False olarak ayarlayın. -2. Birim Yapılandırması, Kapsayıcı içindeki uygulamanın kök dizini /workspace olarak ayarlanmıştır. Varsayılan docker-compose.yaml, içerik yükleme/indirme için bazı pratik örnekler listeler. -3. shm_size: Windows üzerinde Docker Desktop için varsayılan kullanılabilir bellek çok küçüktür, bu da anormal işlemlere neden olabilir. Kendi durumunuza göre ayarlayın. -4. Dağıtım bölümü altında, GPU ile ilgili ayarlar sisteminize ve gerçek koşullara göre dikkatlice ayarlanmalıdır. +Kod tabanı hızla geliştiği halde Docker imajları daha yavaş yayınlandığı için lütfen şu adımları izleyin: -#### docker compose ile çalıştırma +- En güncel kullanılabilir imaj etiketlerini görmek için [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) adresini kontrol edin. +- Ortamınıza uygun bir imaj etiketi seçin. +- Opsiyonel: En güncel değişiklikleri almak için, sağlanan Dockerfile ile yerel olarak imajı kendiniz oluşturabilirsiniz. -``` -docker compose -f "docker-compose.yaml" up -d +#### Ortam Değişkenleri + +- `is_half`: Yarı hassasiyet (fp16) kullanımını kontrol eder. GPU’nuz destekliyorsa, belleği azaltmak için `true` olarak ayarlayın. + +#### Paylaşılan Bellek Yapılandırması + +Windows (Docker Desktop) ortamında, varsayılan paylaşılan bellek boyutu düşüktür ve bu beklenmedik hatalara neden olabilir. Sistem belleğinize göre Docker Compose dosyasındaki `shm_size` değerini (örneğin `16g`) artırmanız önerilir. + +#### Servis Seçimi + +`docker-compose.yaml` dosyasında iki tür servis tanımlanmıştır: + +- `GPT-SoVITS-CU124` ve `GPT-SoVITS-CU128`: Tüm özellikleri içeren tam sürüm. +- `GPT-SoVITS-CU124-Lite` ve `GPT-SoVITS-CU128-Lite`: Daha az bağımlılığa ve sınırlı işlevselliğe sahip hafif sürüm. + +Belirli bir servisi Docker Compose ile çalıştırmak için şu komutu kullanın: + +```bash +docker compose run --service-ports ``` -#### docker komutu ile çalıştırma +#### Docker İmajını Yerel Olarak Oluşturma -Yukarıdaki gibi, ilgili parametreleri gerçek durumunuza göre değiştirin, ardından aşağıdaki komutu çalıştırın: +Docker imajını kendiniz oluşturmak isterseniz şu komutu kullanın: +```bash +bash docker_build.sh --cuda <12.4|12.8> [--lite] ``` -docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-DockerTest\output:/workspace/output --volume=G:\GPT-SoVITS-DockerTest\logs:/workspace/logs --volume=G:\GPT-SoVITS-DockerTest\SoVITS_weights:/workspace/SoVITS_weights --workdir=/workspace -p 9880:9880 -p 9871:9871 -p 9872:9872 -p 9873:9873 -p 9874:9874 --shm-size="16G" -d breakstring/gpt-sovits:xxxxx + +#### Çalışan Konteynere Erişim (Bash Shell) + +Konteyner arka planda çalışırken, aşağıdaki komutla içine girebilirsiniz: + +```bash +docker exec -it bash ``` ## Önceden Eğitilmiş Modeller @@ -203,12 +226,12 @@ veya WebUI'de manuel olarak sürüm değiştirin. #### Yol Otomatik Doldurma artık destekleniyor - 1. Ses yolunu doldurun - 2. Sesi küçük parçalara ayırın - 3. Gürültü azaltma (isteğe bağlı) - 4. ASR - 5. ASR transkripsiyonlarını düzeltin - 6. Bir sonraki sekmeye geçin ve modeli ince ayar yapın +1. Ses yolunu doldurun +2. Sesi küçük parçalara ayırın +3. Gürültü azaltma (isteğe bağlı) +4. ASR +5. ASR transkripsiyonlarını düzeltin +6. Bir sonraki sekmeye geçin ve modeli ince ayar yapın ### Çıkarım WebUI'sini Açın @@ -298,7 +321,7 @@ V1 ortamından V2'yi kullanmak için: UVR5 için Web Arayüzünü açmak için komut satırını kullanın -``` +```bash python tools/uvr5/webui.py "" ``` @@ -309,7 +332,7 @@ python mdxnet.py --model --input_root --output_vocal --output_ins --agg_level -- Veri setinin ses segmentasyonu komut satırı kullanılarak bu şekilde yapılır -``` +```bash python audio_slicer.py \ --input_path "" \ --output_root "" \ @@ -321,7 +344,7 @@ python audio_slicer.py \ Veri seti ASR işleme komut satırı kullanılarak bu şekilde yapılır (Yalnızca Çince) -``` +```bash python tools/asr/funasr_asr.py -i -o <çıktı> ``` @@ -329,7 +352,7 @@ ASR işleme Faster_Whisper aracılığıyla gerçekleştirilir (Çince dışınd (İlerleme çubukları yok, GPU performansı zaman gecikmelerine neden olabilir) -``` +```bash python ./tools/asr/fasterwhisper_asr.py -i -o <çıktı> -l ``` From ae16b63b9eb7aebe87bb449581281ea623f74cfc Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 14:58:38 +0100 Subject: [PATCH 061/183] Fix \ --- README.md | 6 +++--- docs/cn/README.md | 4 ++-- docs/ja/README.md | 4 ++-- docs/ko/README.md | 4 ++-- docs/tr/README.md | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 5495a142..997b9b00 100644 --- a/README.md +++ b/README.md @@ -285,7 +285,7 @@ Use v2 from v1 environment: 2. Clone the latest codes from github. -3. Download v2 pretrained models from [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main/gsv-v2final-pretrained) and put them into `GPT_SoVITS\pretrained_models\gsv-v2final-pretrained`. +3. Download v2 pretrained models from [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main/gsv-v2final-pretrained) and put them into `GPT_SoVITS/pretrained_models/gsv-v2final-pretrained`. Chinese v2 additional: [G2PWModel.zip(HF)](https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/G2PWModel.zip)| [G2PWModel.zip(ModelScope)](https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/G2PWModel.zip)(Download G2PW models, unzip and rename to `G2PWModel`, and then place them in `GPT_SoVITS/text`.) @@ -305,7 +305,7 @@ Use v3 from v2 environment: 2. Clone the latest codes from github. -3. Download v3 pretrained models (s1v3.ckpt, s2Gv3.pth and models--nvidia--bigvgan_v2_24khz_100band_256x folder) from [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main) and put them into `GPT_SoVITS\pretrained_models`. +3. Download v3 pretrained models (s1v3.ckpt, s2Gv3.pth and models--nvidia--bigvgan_v2_24khz_100band_256x folder) from [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main) and put them into `GPT_SoVITS/pretrained_models`. additional: for Audio Super Resolution model, you can read [how to download](./tools/AP_BWE_main/24kto48k/readme.txt) @@ -322,7 +322,7 @@ Use v4 from v1/v2/v3 environment: 2. Clone the latest codes from github. -3. Download v4 pretrained models (gsv-v4-pretrained/s2v4.ckpt, and gsv-v4-pretrained/vocoder.pth) from [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main) and put them into `GPT_SoVITS\pretrained_models`. +3. Download v4 pretrained models (gsv-v4-pretrained/s2v4.ckpt, and gsv-v4-pretrained/vocoder.pth) from [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main) and put them into `GPT_SoVITS/pretrained_models`. ## Todo List diff --git a/docs/cn/README.md b/docs/cn/README.md index 097ee9a5..df41c797 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -281,7 +281,7 @@ python webui.py 2. 需要克隆 github 上的最新代码 -3. 需要从[huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main/gsv-v2final-pretrained) 下载预训练模型文件放到 GPT_SoVITS\pretrained_models\gsv-v2final-pretrained 下 +3. 需要从[huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main/gsv-v2final-pretrained) 下载预训练模型文件放到 GPT_SoVITS/pretrained_models/gsv-v2final-pretrained 下 中文额外需要下载[G2PWModel.zip(HF)](https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/G2PWModel.zip)| [G2PWModel.zip(ModelScope)](https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/G2PWModel.zip) (下载 G2PW 模型,解压并重命名为`G2PWModel`,将其放到`GPT_SoVITS/text`目录下) @@ -301,7 +301,7 @@ python webui.py 2. 需要克隆 github 上的最新代码 -3. 从[huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main)下载这些 v3 新增预训练模型 (s1v3.ckpt, s2Gv3.pth and models--nvidia--bigvgan_v2_24khz_100band_256x folder)将他们放到`GPT_SoVITS\pretrained_models`目录下 +3. 从[huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main)下载这些 v3 新增预训练模型 (s1v3.ckpt, s2Gv3.pth and models--nvidia--bigvgan_v2_24khz_100band_256x folder)将他们放到`GPT_SoVITS/pretrained_models`目录下 如果想用音频超分功能缓解 v3 模型生成 24k 音频觉得闷的问题, 需要下载额外的模型参数, 参考[how to download](../../tools/AP_BWE_main/24kto48k/readme.txt) diff --git a/docs/ja/README.md b/docs/ja/README.md index f7908722..15955f1f 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -269,7 +269,7 @@ V1 環境から V2 を使用するには: 2. 最新のコードを github からクローン -3. [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main/gsv-v2final-pretrained)から V2 の事前学習モデルをダウンロードし、それらを`GPT_SoVITS\pretrained_models\gsv-v2final-pretrained`に配置 +3. [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main/gsv-v2final-pretrained)から V2 の事前学習モデルをダウンロードし、それらを`GPT_SoVITS/pretrained_models/gsv-v2final-pretrained`に配置 中国語 V2 追加: [G2PWModel.zip(HF)](https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/G2PWModel.zip)| [G2PWModel.zip(ModelScope)](https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/G2PWModel.zip) (G2PW モデルをダウンロードし、解凍して`G2PWModel`にリネームし、`GPT_SoVITS/text`に配置します) @@ -289,7 +289,7 @@ v2 環境から v3 を使用する方法: 2. GitHub から最新のコードをクローンします. -3. v3 の事前学習済みモデル (s1v3.ckpt、s2Gv3.pth、models--nvidia--bigvgan_v2_24khz_100band_256x フォルダ) を[Huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main) からダウンロードし、GPT_SoVITS\pretrained_models フォルダに配置します. +3. v3 の事前学習済みモデル (s1v3.ckpt、s2Gv3.pth、models--nvidia--bigvgan_v2_24khz_100band_256x フォルダ) を[Huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main) からダウンロードし、GPT_SoVITS/pretrained_models フォルダに配置します. 追加: 音声超解像モデルについては、[ダウンロード方法](../../tools/AP_BWE_main/24kto48k/readme.txt)を参照してください. diff --git a/docs/ko/README.md b/docs/ko/README.md index 11c00a3c..ce313c3a 100644 --- a/docs/ko/README.md +++ b/docs/ko/README.md @@ -271,7 +271,7 @@ V1 환경에서 V2를 사용하려면: 2. github에서 최신 코드를 클론하십시오. -3. [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main/gsv-v2final-pretrained)에서 V2 사전 학습 모델을 다운로드하여 `GPT_SoVITS\pretrained_models\gsv-v2final-pretrained`에 넣으십시오. +3. [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main/gsv-v2final-pretrained)에서 V2 사전 학습 모델을 다운로드하여 `GPT_SoVITS/pretrained_models/gsv-v2final-pretrained`에 넣으십시오. 중국어 V2 추가: [G2PWModel.zip(HF)](https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/G2PWModel.zip)| [G2PWModel.zip(ModelScope)](https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/G2PWModel.zip) (G2PW 모델을 다운로드하여 압축을 풀고 `G2PWModel`로 이름을 변경한 다음 `GPT_SoVITS/text`에 배치합니다.) @@ -291,7 +291,7 @@ v2 환경에서 v3 사용하기: 2. 최신 코드를 github 에서 클론합니다. -3. v3 사전 훈련된 모델(s1v3.ckpt, s2Gv3.pth, 그리고 models--nvidia--bigvgan_v2_24khz_100band_256x 폴더)을 [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main)에서 다운로드하여 `GPT_SoVITS\pretrained_models` 폴더에 넣습니다. +3. v3 사전 훈련된 모델(s1v3.ckpt, s2Gv3.pth, 그리고 models--nvidia--bigvgan_v2_24khz_100band_256x 폴더)을 [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main)에서 다운로드하여 `GPT_SoVITS/pretrained_models` 폴더에 넣습니다. 추가: 오디오 슈퍼 해상도 모델에 대해서는 [다운로드 방법](../../tools/AP_BWE_main/24kto48k/readme.txt)을 참고하세요. diff --git a/docs/tr/README.md b/docs/tr/README.md index 3d5a9dbe..83b7c160 100644 --- a/docs/tr/README.md +++ b/docs/tr/README.md @@ -273,7 +273,7 @@ V1 ortamından V2'yi kullanmak için: 2. github'dan en son kodları klonlayın. -3. [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main/gsv-v2final-pretrained) adresinden v2 önceden eğitilmiş modelleri indirin ve bunları `GPT_SoVITS\pretrained_models\gsv-v2final-pretrained` dizinine yerleştirin. +3. [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main/gsv-v2final-pretrained) adresinden v2 önceden eğitilmiş modelleri indirin ve bunları `GPT_SoVITS/pretrained_models/gsv-v2final-pretrained` dizinine yerleştirin. Ek olarak Çince V2: [G2PWModel.zip(HF)](https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/G2PWModel.zip)| [G2PWModel.zip(ModelScope)](https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/G2PWModel.zip) (G2PW modellerini indirip, zipten çıkarıp, `G2PWModel` olarak yeniden adlandırıp `GPT_SoVITS/text` dizinine yerleştirin.) @@ -293,7 +293,7 @@ V1 ortamından V2'yi kullanmak için: 2. GitHub'dan en son kodları klonlayın. -3. [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main) üzerinden v3 önceden eğitilmiş modellerini (s1v3.ckpt, s2Gv3.pth ve models--nvidia--bigvgan_v2_24khz_100band_256x klasörünü) indirin ve `GPT_SoVITS\pretrained_models` dizinine yerleştirin. +3. [huggingface](https://huggingface.co/lj1995/GPT-SoVITS/tree/main) üzerinden v3 önceden eğitilmiş modellerini (s1v3.ckpt, s2Gv3.pth ve models--nvidia--bigvgan_v2_24khz_100band_256x klasörünü) indirin ve `GPT_SoVITS/pretrained_models` dizinine yerleştirin. ek: Ses Süper Çözünürlük modeli için [nasıl indirileceği](../../tools/AP_BWE_main/24kto48k/readme.txt) hakkında bilgi alabilirsiniz. From 0e070f4b31730c9e42694f4f468651267214f157 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 1 May 2025 16:03:35 +0100 Subject: [PATCH 062/183] Fix MacOS --- install.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 006022f5..23350d95 100644 --- a/install.sh +++ b/install.sh @@ -125,11 +125,13 @@ fi # 安装构建工具 # Install build tools -echo "Installing GCC..." -conda install -c conda-forge gcc=14 -q -y +if [ "$(uname)" != "Darwin" ]; then + echo "Installing GCC..." + conda install -c conda-forge gcc=14 -q -y -echo "Installing G++..." -conda install -c conda-forge gxx -q -y + echo "Installing G++..." + conda install -c conda-forge gxx -q -y +fi echo "Installing ffmpeg and cmake..." conda install ffmpeg cmake make -q -y From b7c746b5a23cca96bf73b483ecc36c1252f59571 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 2 May 2025 07:33:56 +0100 Subject: [PATCH 063/183] . --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e4d7185a..e1317466 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,9 +42,10 @@ EXPOSE 9871 9872 9873 9874 9880 ENV PYTHONPATH="/workspace/GPT-SoVITS" -RUN conda init bash && echo "conda activate base" >> ~/.bashrc +RUN conda init bash >> ~/.bashrc CMD ["/bin/bash", "-c", "\ + conda activate base && \ rm -rf /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models && \ rm -rf /workspace/GPT-SoVITS/tools/asr/models && \ rm -rf /workspace/GPT-SoVITS/tools/uvr5/uvr5_weights && \ From 0fe64c654f860d080c200ef2ff04f428035e421c Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 2 May 2025 07:37:05 +0100 Subject: [PATCH 064/183] test --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e1317466..aa79d49c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,10 +42,10 @@ EXPOSE 9871 9872 9873 9874 9880 ENV PYTHONPATH="/workspace/GPT-SoVITS" -RUN conda init bash >> ~/.bashrc +RUN conda init bash && echo "conda activate base" >> ~/.bashrc CMD ["/bin/bash", "-c", "\ - conda activate base && \ + echo "echo 111" >> ~/.bashrc && \ rm -rf /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models && \ rm -rf /workspace/GPT-SoVITS/tools/asr/models && \ rm -rf /workspace/GPT-SoVITS/tools/uvr5/uvr5_weights && \ From 915740c0f1699752d237a9d6cd3e3482393fcfc4 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 2 May 2025 07:47:59 +0100 Subject: [PATCH 065/183] . --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index aa79d49c..e4d7185a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,7 +45,6 @@ ENV PYTHONPATH="/workspace/GPT-SoVITS" RUN conda init bash && echo "conda activate base" >> ~/.bashrc CMD ["/bin/bash", "-c", "\ - echo "echo 111" >> ~/.bashrc && \ rm -rf /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models && \ rm -rf /workspace/GPT-SoVITS/tools/asr/models && \ rm -rf /workspace/GPT-SoVITS/tools/uvr5/uvr5_weights && \ From 9624de2fe575aad25c6749a5cf3d9d66d24d20aa Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 2 May 2025 09:14:49 +0100 Subject: [PATCH 066/183] Add Tag Alias --- .github/workflows/docker-publish.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 2d909c94..4c8c8f6b 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -231,6 +231,12 @@ jobs: --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: Create Default Tag + run: | + docker buildx imagetools create \ + --tag ${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest \ + ${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest-cu124-lite - name: Delete old platform-specific tags via Docker Hub API env: @@ -242,7 +248,7 @@ jobs: 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" \ + "https://auth.docker.io/token?service=registry.docker.io&scope=repository:$DOCKER_HUB_USERNAME/gpt-sovits:pull,push,delete" \ | jq -r .token) for PLATFORM in amd64 arm64; do From 004278a7df0db1b93467d158cb3cb80120e26b6d Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 2 May 2025 09:51:20 +0100 Subject: [PATCH 067/183] . --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e4d7185a..aaa92a3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ ARG CUDA_VERSION=124 ARG CUDA_BASE=runtime -FROM xxxxrt666/gpt-sovits:latest-cu${CUDA_VERSION}-${CUDA_BASE}-base +FROM xxxxrt666/cuda-base:cu${CUDA_VERSION}-${CUDA_BASE} LABEL maintainer="XXXXRT" -LABEL version="V4-0501" +LABEL version="V4" LABEL description="Docker image for GPT-SoVITS" ARG CUDA_VERSION=12.4 From 88d97726344b32cba7916911760cd7f9164f1211 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 2 May 2025 11:18:03 +0100 Subject: [PATCH 068/183] fix bugs --- .github/workflows/docker-publish.yaml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 4c8c8f6b..c8670fcf 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -231,13 +231,6 @@ jobs: --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: Create Default Tag - run: | - docker buildx imagetools create \ - --tag ${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest \ - ${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest-cu124-lite - - name: Delete old platform-specific tags via Docker Hub API env: DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} @@ -260,4 +253,22 @@ jobs: 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 \ No newline at end of file + done + create-default: + runs-on: ubuntu-latest + 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: Create Default Tag + run: | + docker buildx imagetools create \ + --tag ${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest \ + ${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest-cu124-lite + \ No newline at end of file From fd2cacdc1fc184808d0f6fd6e17c2d985dd81e38 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 2 May 2025 11:21:36 +0100 Subject: [PATCH 069/183] fix bugs --- .github/workflows/docker-publish.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index c8670fcf..819486d6 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -256,6 +256,8 @@ jobs: done create-default: runs-on: ubuntu-latest + needs: + - merge-and-clean steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -265,7 +267,7 @@ jobs: with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} - + - name: Create Default Tag run: | docker buildx imagetools create \ From 905c602edcc2af8f768d71303f81e32ab8369563 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 05:07:36 +0100 Subject: [PATCH 070/183] make image smaller --- .github/workflows/docker-publish.yaml | 20 +++---- Docker/anaconda_install.sh | 8 +++ Docker/install_wrapper.sh | 33 +++++++++++ Docker/setup.sh | 80 --------------------------- Dockerfile | 32 ++++++----- docker-compose.yaml | 4 ++ 6 files changed, 72 insertions(+), 105 deletions(-) create mode 100644 Docker/install_wrapper.sh delete mode 100644 Docker/setup.sh diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 819486d6..39785290 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -26,19 +26,19 @@ jobs: include: - cuda_version: 124 lite: true - cuda_base: runtime + torch_base: lite tag_prefix: cu124-lite - cuda_version: 124 lite: false - cuda_base: devel + torch_base: full tag_prefix: cu124 - cuda_version: 128 lite: true - cuda_base: runtime + torch_base: lite tag_prefix: cu128-lite - cuda_version: 128 lite: false - cuda_base: devel + torch_base: full tag_prefix: cu128 steps: @@ -98,7 +98,7 @@ jobs: platforms: linux/amd64 build-args: | LITE=${{ matrix.lite }} - CUDA_BASE=${{ matrix.cuda_base }} + TORCH_BASE=${{ matrix.torch_base }} CUDA_VERSION=${{ matrix.cuda_version }} WORKFLOW=true tags: | @@ -113,19 +113,19 @@ jobs: include: - cuda_version: 124 lite: true - cuda_base: runtime + torch_base: lite tag_prefix: cu124-lite - cuda_version: 124 lite: false - cuda_base: devel + torch_base: full tag_prefix: cu124 - cuda_version: 128 lite: true - cuda_base: runtime + torch_base: lite tag_prefix: cu128-lite - cuda_version: 128 lite: false - cuda_base: devel + torch_base: full tag_prefix: cu128 steps: @@ -185,7 +185,7 @@ jobs: platforms: linux/arm64 build-args: | LITE=${{ matrix.lite }} - CUDA_BASE=${{ matrix.cuda_base }} + TORCH_BASE=${{ matrix.torch_base }} CUDA_VERSION=${{ matrix.cuda_version }} WORKFLOW=true tags: | diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh index e97974da..96a2a172 100644 --- a/Docker/anaconda_install.sh +++ b/Docker/anaconda_install.sh @@ -53,6 +53,14 @@ source "$HOME/anaconda3/etc/profile.d/conda.sh" "$HOME/anaconda3/bin/conda" install gcc=14 gxx ffmpeg cmake make unzip -q -y +if [ "$CUDA_VERSION" = "12.8" ]; then + "$HOME/anaconda3/bin/pip" install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128 +elif [ "$CUDA_VERSION" = "12.4" ]; then + "$HOME/anaconda3/bin/pip" install torch==2.5.1 torchaudio==2.5.1 --no-cache-dir --index-url https://download.pytorch.org/whl/cu124 +fi + +"$HOME/anaconda3/bin/pip" cache purge + rm $LOG_PATH rm -rf "$HOME/anaconda3/pkgs" diff --git a/Docker/install_wrapper.sh b/Docker/install_wrapper.sh new file mode 100644 index 00000000..bca97107 --- /dev/null +++ b/Docker/install_wrapper.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" + +cd "$SCRIPT_DIR" || exit 1 + +cd .. || exit 1 + +set -e + +source "$HOME/anaconda3/etc/profile.d/conda.sh" + +mkdir GPT_SoVITS + +mkdir GPT_SoVITS/text + +ln -s /workspace/models/pretrained_models /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models + +ln -s /workspace/models/G2PWModel /workspace/GPT-SoVITS/GPT_SoVITS/text/G2PWModel + +bash install.sh --device "CU${CUDA_VERSION}" --source HF + +pip cache purge + +pip show torch + +rm -rf /tmp/* /var/tmp/* + +rm -rf "$HOME/anaconda3/pkgs" + +mkdir "$HOME/anaconda3/pkgs" + +rm -rf /root/.conda /root/.cache diff --git a/Docker/setup.sh b/Docker/setup.sh deleted file mode 100644 index af907015..00000000 --- a/Docker/setup.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" - -cd "$SCRIPT_DIR" || exit 1 - -cd .. || exit 1 - -set -e - -WORKFLOW=${WORKFLOW:-"false"} -LITE=${LITE:-"false"} - -if [ "$WORKFLOW" = "true" ]; then - WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" -else - WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" -fi - -USE_FUNASR=false -USE_FASTERWHISPER=false - -if [ "$LITE" = "true" ]; then - USE_FUNASR=true - USE_FASTERWHISPER=false -else - USE_FUNASR=true - USE_FASTERWHISPER=true -fi - -if [ "$USE_FUNASR" = "true" ]; then - echo "Downloading funasr..." && - $WGET_CMD "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/funasr.zip" && - unzip -q funasr.zip -d tools/asr/models/ && - rm -rf funasr.zip -else - echo "Skipping funasr download" -fi - -if [ "$USE_FASTERWHISPER" = "true" ]; then - echo "Downloading faster-whisper..." && - $WGET_CMD "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/faster-whisper.zip" && - unzip -q faster-whisper.zip -d tools/asr/models/ && - rm -rf faster-whisper.zip -else - echo "Skipping faster-whisper download" -fi - -source "$HOME/anaconda3/etc/profile.d/conda.sh" - -if [ "$CUDA_VERSION" = 128 ]; then - pip install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128 -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 -fi - -if [ "$LITE" = "true" ]; then - bash install.sh --device "CU${CUDA_VERSION}" --source HF -elif [ "$LITE" = "false" ]; then - bash install.sh --device "CU${CUDA_VERSION}" --source HF --download-uvr5 -else - exit 1 -fi - -mkdir -p /workspace/model -mv /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models /workspace/model/ -mv /workspace/GPT-SoVITS/tools/asr/models /workspace/model/ -mv /workspace/GPT-SoVITS/tools/uvr5/uvr5_weights /workspace/model/ - -pip cache purge - -pip show torch - -rm -rf /tmp/* /var/tmp/* - -rm -rf "$HOME/anaconda3/pkgs" - -mkdir "$HOME/anaconda3/pkgs" - -rm -rf /root/.conda /root/.cache diff --git a/Dockerfile b/Dockerfile index aaa92a3a..0a1b8f5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,21 @@ ARG CUDA_VERSION=124 -ARG CUDA_BASE=runtime +ARG TORCH_BASE=full -FROM xxxxrt666/cuda-base:cu${CUDA_VERSION}-${CUDA_BASE} +FROM xxxxrt666/torch-base:cu${CUDA_VERSION}-${TORCH_BASE} LABEL maintainer="XXXXRT" LABEL version="V4" LABEL description="Docker image for GPT-SoVITS" -ARG CUDA_VERSION=12.4 +ARG CUDA_VERSION=124 ENV CUDA_VERSION=${CUDA_VERSION} +SHELL ["/bin/bash", "-c"] + WORKDIR /workspace/GPT-SoVITS -COPY . /workspace/GPT-SoVITS +COPY Docker /workspace/GPT-SoVITS/ ARG LITE=false ENV LITE=${LITE} @@ -24,19 +26,15 @@ ENV WORKFLOW=${WORKFLOW} ARG TARGETPLATFORM ENV TARGETPLATFORM=${TARGETPLATFORM} -ENV HOME="/root" - RUN bash Docker/anaconda_install.sh -ENV PATH="$HOME/anaconda3/bin:$PATH" +COPY extra-req.txt /workspace/GPT-SoVITS/ -SHELL ["/bin/bash", "-c"] +COPY requirements.txt /workspace/GPT-SoVITS/ -ENV PATH="/usr/local/cuda/bin:$PATH" -ENV CUDA_HOME="/usr/local/cuda" -ENV MAKEFLAGS="-j$(nproc)" +COPY install.sh /workspace/GPT-SoVITS/ -RUN bash Docker/setup.sh +RUN bash Docker/install_wrapper.sh EXPOSE 9871 9872 9873 9874 9880 @@ -44,11 +42,15 @@ ENV PYTHONPATH="/workspace/GPT-SoVITS" RUN conda init bash && echo "conda activate base" >> ~/.bashrc +COPY . /workspace/GPT-SoVITS + CMD ["/bin/bash", "-c", "\ rm -rf /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models && \ + rm -rf /workspace/GPT-SoVITS/GPT_SoVITS/text/G2PWModel && \ rm -rf /workspace/GPT-SoVITS/tools/asr/models && \ rm -rf /workspace/GPT-SoVITS/tools/uvr5/uvr5_weights && \ - ln -s /workspace/model/pretrained_models /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models && \ - ln -s /workspace/model/models /workspace/GPT-SoVITS/tools/asr/models && \ - ln -s /workspace/model/uvr5_weights /workspace/GPT-SoVITS/tools/uvr5/uvr5_weights && \ + ln -s /workspace/models/pretrained_models /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models && \ + ln -s /workspace/models/G2PWModel /workspace/GPT-SoVITS/GPT_SoVITS/text/G2PWModel && \ + ln -s /workspace/models/asr_models /workspace/GPT-SoVITS/tools/asr/models && \ + ln -s /workspace/models/uvr5_weights /workspace/GPT-SoVITS/tools/uvr5/uvr5_weights && \ exec bash"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index f519cef3..cea85f7e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -13,6 +13,7 @@ services: volumes: - .:/workspace/GPT-SoVITS - /dev/null:/workspace/GPT-SoVITS/pretrained_models + - /dev/null:/workspace/GPT-SoVITS/text/G2PWModel - /dev/null:/workspace/tools/asr/models - /dev/null:/workspace/tools/uvr5/uvr5_weights environment: @@ -34,6 +35,7 @@ services: volumes: - .:/workspace/GPT-SoVITS - /dev/null:/workspace/GPT-SoVITS/pretrained_models + - /dev/null:/workspace/GPT-SoVITS/text/G2PWModel - /dev/null:/workspace/tools/asr/models - /dev/null:/workspace/tools/uvr5/uvr5_weights environment: @@ -55,6 +57,7 @@ services: volumes: - .:/workspace/GPT-SoVITS - /dev/null:/workspace/GPT-SoVITS/pretrained_models + - /dev/null:/workspace/GPT-SoVITS/text/G2PWModel - /dev/null:/workspace/tools/asr/models - /dev/null:/workspace/tools/uvr5/uvr5_weights environment: @@ -76,6 +79,7 @@ services: volumes: - .:/workspace/GPT-SoVITS - /dev/null:/workspace/GPT-SoVITS/pretrained_models + - /dev/null:/workspace/GPT-SoVITS/text/G2PWModel - /dev/null:/workspace/tools/asr/models - /dev/null:/workspace/tools/uvr5/uvr5_weights environment: From efee8d70ce2062925931b5614a8ce0ea3b98f5ac Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 07:07:21 +0100 Subject: [PATCH 071/183] update pre-commit config --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f3829691..2434e74e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: # Run the linter. - id: ruff types_or: [ python, pyi ] - args: [ --fix, --exit-zero, --quiet ] + args: [ --fix ] # Run the formatter. - id: ruff-format types_or: [ python, pyi ] From 2a71e2fbb01ba76f1749d20295df7ddaf035da64 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 12:21:53 +0100 Subject: [PATCH 072/183] . --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0a1b8f5c..ac106efa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,8 @@ ENV WORKFLOW=${WORKFLOW} ARG TARGETPLATFORM ENV TARGETPLATFORM=${TARGETPLATFORM} +RUN ls -a + RUN bash Docker/anaconda_install.sh COPY extra-req.txt /workspace/GPT-SoVITS/ From 393d971287ef1fcfcf6662e92dd973bea4557331 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 12:27:04 +0100 Subject: [PATCH 073/183] . --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index ac106efa..d17c71f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,8 @@ ENV WORKFLOW=${WORKFLOW} ARG TARGETPLATFORM ENV TARGETPLATFORM=${TARGETPLATFORM} +RUN pwd + RUN ls -a RUN bash Docker/anaconda_install.sh From 7f9c55c675751048eb806885be3efb94ff66d7be Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 12:32:45 +0100 Subject: [PATCH 074/183] fix bugs --- Dockerfile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index d17c71f9..5818acfc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ SHELL ["/bin/bash", "-c"] WORKDIR /workspace/GPT-SoVITS -COPY Docker /workspace/GPT-SoVITS/ +COPY Docker /workspace/GPT-SoVITS/Docker/ ARG LITE=false ENV LITE=${LITE} @@ -26,10 +26,6 @@ ENV WORKFLOW=${WORKFLOW} ARG TARGETPLATFORM ENV TARGETPLATFORM=${TARGETPLATFORM} -RUN pwd - -RUN ls -a - RUN bash Docker/anaconda_install.sh COPY extra-req.txt /workspace/GPT-SoVITS/ From 0a0012ec4d0eeac797c222cfa2d8a140e812d75e Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 12:55:49 +0100 Subject: [PATCH 075/183] use miniconda --- Docker/anaconda_install.sh | 70 ------------------------------------- Docker/miniconda_install.sh | 70 +++++++++++++++++++++++++++++++++++++ Dockerfile | 2 +- 3 files changed, 71 insertions(+), 71 deletions(-) delete mode 100644 Docker/anaconda_install.sh create mode 100644 Docker/miniconda_install.sh diff --git a/Docker/anaconda_install.sh b/Docker/anaconda_install.sh deleted file mode 100644 index 96a2a172..00000000 --- a/Docker/anaconda_install.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -set -e - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" - -cd "$SCRIPT_DIR" || exit 1 - -cd .. || exit 1 - -if [ -d "$HOME/anaconda3" ]; then - exit 0 -fi - -WORKFLOW=${WORKFLOW:-"false"} -TARGETPLATFORM=${TARGETPLATFORM:-"linux/amd64"} - -if [ "$WORKFLOW" = "true" ]; then - WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" -else - WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" -fi - -if [ "$TARGETPLATFORM" = "linux/amd64" ]; then - eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh" -elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then - eval "$WGET_CMD -O anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-aarch64.sh" -else - exit 1 -fi - -LOG_PATH="/tmp/anaconda-install.log" - -bash anaconda.sh -b -p "$HOME/anaconda3" >"$LOG_PATH" 2>&1 - -if [ $? -eq 0 ]; then - echo "== Anaconda Installed ==" -else - echo "Failed to Install Anaconda" - tail -n 50 "$LOG_PATH" - exit 1 -fi - -rm anaconda.sh - -source "$HOME/anaconda3/etc/profile.d/conda.sh" - -"$HOME/anaconda3/bin/conda" config --add channels conda-forge - -"$HOME/anaconda3/bin/conda" update -q --all -y 1>/dev/null - -"$HOME/anaconda3/bin/conda" install python=3.11 -q -y - -"$HOME/anaconda3/bin/conda" install gcc=14 gxx ffmpeg cmake make unzip -q -y - -if [ "$CUDA_VERSION" = "12.8" ]; then - "$HOME/anaconda3/bin/pip" install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128 -elif [ "$CUDA_VERSION" = "12.4" ]; then - "$HOME/anaconda3/bin/pip" install torch==2.5.1 torchaudio==2.5.1 --no-cache-dir --index-url https://download.pytorch.org/whl/cu124 -fi - -"$HOME/anaconda3/bin/pip" cache purge - -rm $LOG_PATH - -rm -rf "$HOME/anaconda3/pkgs" - -mkdir "$HOME/anaconda3/pkgs" - -rm -rf "$HOME/.conda" "$HOME/.cache" diff --git a/Docker/miniconda_install.sh b/Docker/miniconda_install.sh new file mode 100644 index 00000000..d0fa48d6 --- /dev/null +++ b/Docker/miniconda_install.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" + +cd "$SCRIPT_DIR" || exit 1 + +cd .. || exit 1 + +if [ -d "$HOME/miniconda3" ]; then + exit 0 +fi + +WORKFLOW=${WORKFLOW:-"false"} +TARGETPLATFORM=${TARGETPLATFORM:-"linux/amd64"} + +if [ "$WORKFLOW" = "true" ]; then + WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +else + WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" +fi + +if [ "$TARGETPLATFORM" = "linux/amd64" ]; then + eval "$WGET_CMD -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_25.3.1-1-Linux-x86_64.sh" +elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then + eval "$WGET_CMD -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_25.3.1-1-Linux-aarch64.sh" +else + exit 1 +fi + +LOG_PATH="/tmp/miniconda-install.log" + +bash miniconda.sh -b -p "$HOME/miniconda3" >"$LOG_PATH" 2>&1 + +if [ $? -eq 0 ]; then + echo "== Miniconda Installed ==" +else + echo "Failed to Install miniconda" + tail -n 50 "$LOG_PATH" + exit 1 +fi + +rm miniconda.sh + +source "$HOME/miniconda3/etc/profile.d/conda.sh" + +"$HOME/miniconda3/bin/conda" config --add channels conda-forge + +"$HOME/miniconda3/bin/conda" update -q --all -y 1>/dev/null + +"$HOME/miniconda3/bin/conda" install python=3.11 -q -y + +"$HOME/miniconda3/bin/conda" install gcc=14 gxx ffmpeg cmake make unzip -q -y + +if [ "$CUDA_VERSION" = "12.8" ]; then + "$HOME/miniconda3/bin/pip" install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128 +elif [ "$CUDA_VERSION" = "12.4" ]; then + "$HOME/miniconda3/bin/pip" install torch==2.5.1 torchaudio==2.5.1 --no-cache-dir --index-url https://download.pytorch.org/whl/cu124 +fi + +"$HOME/miniconda3/bin/pip" cache purge + +rm $LOG_PATH + +rm -rf "$HOME/miniconda3/pkgs" + +mkdir "$HOME/miniconda3/pkgs" + +rm -rf "$HOME/.conda" "$HOME/.cache" diff --git a/Dockerfile b/Dockerfile index 5818acfc..02d9cabf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ ENV WORKFLOW=${WORKFLOW} ARG TARGETPLATFORM ENV TARGETPLATFORM=${TARGETPLATFORM} -RUN bash Docker/anaconda_install.sh +RUN bash Docker/miniconda_install.sh COPY extra-req.txt /workspace/GPT-SoVITS/ From b283a0d4fbc849620efa4ec311b0225b7a99f537 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 12:59:36 +0100 Subject: [PATCH 076/183] Fix Wrong Path --- Docker/install_wrapper.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Docker/install_wrapper.sh b/Docker/install_wrapper.sh index bca97107..ede8a050 100644 --- a/Docker/install_wrapper.sh +++ b/Docker/install_wrapper.sh @@ -8,7 +8,7 @@ cd .. || exit 1 set -e -source "$HOME/anaconda3/etc/profile.d/conda.sh" +source "$HOME/miniconda3/etc/profile.d/conda.sh" mkdir GPT_SoVITS @@ -26,8 +26,8 @@ pip show torch rm -rf /tmp/* /var/tmp/* -rm -rf "$HOME/anaconda3/pkgs" +rm -rf "$HOME/miniconda3/pkgs" -mkdir "$HOME/anaconda3/pkgs" +mkdir "$HOME/miniconda3/pkgs" rm -rf /root/.conda /root/.cache From 2072e941403eaec7647e32920340520297927a83 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 13:28:11 +0100 Subject: [PATCH 077/183] . --- Docker/install_wrapper.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Docker/install_wrapper.sh b/Docker/install_wrapper.sh index ede8a050..621c040c 100644 --- a/Docker/install_wrapper.sh +++ b/Docker/install_wrapper.sh @@ -16,6 +16,10 @@ mkdir GPT_SoVITS/text ln -s /workspace/models/pretrained_models /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models +ls /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models + +exit 1 + ln -s /workspace/models/G2PWModel /workspace/GPT-SoVITS/GPT_SoVITS/text/G2PWModel bash install.sh --device "CU${CUDA_VERSION}" --source HF From 04ab60ed6671535af847309b9c0a9c864a0e7b91 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 13:34:16 +0100 Subject: [PATCH 078/183] debug --- Docker/install_wrapper.sh | 8 ++++++-- install.sh | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Docker/install_wrapper.sh b/Docker/install_wrapper.sh index 621c040c..63ba4ad7 100644 --- a/Docker/install_wrapper.sh +++ b/Docker/install_wrapper.sh @@ -16,9 +16,13 @@ mkdir GPT_SoVITS/text ln -s /workspace/models/pretrained_models /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models -ls /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models +echo 1 -exit 1 +ls -a /workspace/models/pretrained_models + +echo 2 + +ls -a /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models ln -s /workspace/models/G2PWModel /workspace/GPT-SoVITS/GPT_SoVITS/text/G2PWModel diff --git a/install.sh b/install.sh index 23350d95..649858e8 100644 --- a/install.sh +++ b/install.sh @@ -162,6 +162,14 @@ else WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" fi +echo 3 + +ls -a "GPT_SoVITS/pretrained_models" + +echo 4 + +find "GPT_SoVITS/pretrained_models" -mindepth 1 + if find "GPT_SoVITS/pretrained_models" -mindepth 1 ! -name '.gitignore' | grep -q .; then echo "Pretrained Model Exists" else From 10f06ae0a0525c190bb149c20cf4c549abae7efc Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 13:41:27 +0100 Subject: [PATCH 079/183] debug --- install.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 649858e8..30a524ad 100644 --- a/install.sh +++ b/install.sh @@ -168,9 +168,11 @@ ls -a "GPT_SoVITS/pretrained_models" echo 4 -find "GPT_SoVITS/pretrained_models" -mindepth 1 +find -L "GPT_SoVITS/pretrained_models" -mindepth 1 -if find "GPT_SoVITS/pretrained_models" -mindepth 1 ! -name '.gitignore' | grep -q .; then +exit 1 + +if find -L "GPT_SoVITS/pretrained_models" -mindepth 1 ! -name '.gitignore' | grep -q .; then echo "Pretrained Model Exists" else echo "Download Pretrained Models" @@ -194,7 +196,7 @@ else fi if [ "$DOWNLOAD_UVR5" = "true" ]; then - if find "tools/uvr5/uvr5_weights" -mindepth 1 ! -name '.gitignore' | grep -q .; then + if find -L "tools/uvr5/uvr5_weights" -mindepth 1 ! -name '.gitignore' | grep -q .; then echo "UVR5 Model Exists" else echo "Download UVR5 Model" From 9159293c9134207dfc898940972f0da2976b211a Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 13:46:20 +0100 Subject: [PATCH 080/183] revert --- Docker/install_wrapper.sh | 8 -------- install.sh | 10 ---------- 2 files changed, 18 deletions(-) diff --git a/Docker/install_wrapper.sh b/Docker/install_wrapper.sh index 63ba4ad7..ede8a050 100644 --- a/Docker/install_wrapper.sh +++ b/Docker/install_wrapper.sh @@ -16,14 +16,6 @@ mkdir GPT_SoVITS/text ln -s /workspace/models/pretrained_models /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models -echo 1 - -ls -a /workspace/models/pretrained_models - -echo 2 - -ls -a /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models - ln -s /workspace/models/G2PWModel /workspace/GPT-SoVITS/GPT_SoVITS/text/G2PWModel bash install.sh --device "CU${CUDA_VERSION}" --source HF diff --git a/install.sh b/install.sh index 30a524ad..d5474d57 100644 --- a/install.sh +++ b/install.sh @@ -162,16 +162,6 @@ else WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" fi -echo 3 - -ls -a "GPT_SoVITS/pretrained_models" - -echo 4 - -find -L "GPT_SoVITS/pretrained_models" -mindepth 1 - -exit 1 - if find -L "GPT_SoVITS/pretrained_models" -mindepth 1 ! -name '.gitignore' | grep -q .; then echo "Pretrained Model Exists" else From 489c9aeee0193e7f9b8137366795f9135173ac56 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 3 May 2025 13:57:07 +0100 Subject: [PATCH 081/183] Fix Bugs --- Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index 02d9cabf..429d7f4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,6 +42,12 @@ ENV PYTHONPATH="/workspace/GPT-SoVITS" RUN conda init bash && echo "conda activate base" >> ~/.bashrc +WORKDIR /workspace + +RUN rm -rf /workspace/GPT-SoVITS + +WORKDIR /workspace/GPT-SoVITS + COPY . /workspace/GPT-SoVITS CMD ["/bin/bash", "-c", "\ From 9c42a133d3b6c58571ed6018930e9f3b218465ca Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sun, 4 May 2025 11:06:55 +0100 Subject: [PATCH 082/183] Update Docs, Add Dict Auto Download in install.sh --- Colab-Inference.ipynb | 4 ++-- Docker/install_wrapper.sh | 6 +++--- Docker/miniconda_install.sh | 2 +- README.md | 1 + docker-compose.yaml | 36 ++++++++++++++++++++---------------- docs/cn/README.md | 27 ++++++++++++++------------- docs/ja/README.md | 15 ++++++++------- docs/ko/README.md | 11 ++++++----- docs/tr/README.md | 7 ++++--- install.sh | 25 +++++++++++++++++++++---- 10 files changed, 80 insertions(+), 54 deletions(-) diff --git a/Colab-Inference.ipynb b/Colab-Inference.ipynb index 8a317013..0b6be3d7 100644 --- a/Colab-Inference.ipynb +++ b/Colab-Inference.ipynb @@ -39,9 +39,9 @@ "\n", "cd GPT-SoVITS\n", "\n", - "mkdir GPT_weights\n", + "mkdir -p GPT_weights\n", "\n", - "mkdir SoVITS_weights\n", + "mkdir -p SoVITS_weights\n", "\n", "if conda env list | awk '{print $1}' | grep -Fxq \"GPTSoVITS\"; then\n", " :\n", diff --git a/Docker/install_wrapper.sh b/Docker/install_wrapper.sh index ede8a050..f3860ffe 100644 --- a/Docker/install_wrapper.sh +++ b/Docker/install_wrapper.sh @@ -10,9 +10,9 @@ set -e source "$HOME/miniconda3/etc/profile.d/conda.sh" -mkdir GPT_SoVITS +mkdir -p GPT_SoVITS -mkdir GPT_SoVITS/text +mkdir -p GPT_SoVITS/text ln -s /workspace/models/pretrained_models /workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models @@ -28,6 +28,6 @@ rm -rf /tmp/* /var/tmp/* rm -rf "$HOME/miniconda3/pkgs" -mkdir "$HOME/miniconda3/pkgs" +mkdir -p "$HOME/miniconda3/pkgs" rm -rf /root/.conda /root/.cache diff --git a/Docker/miniconda_install.sh b/Docker/miniconda_install.sh index d0fa48d6..d626b3a1 100644 --- a/Docker/miniconda_install.sh +++ b/Docker/miniconda_install.sh @@ -65,6 +65,6 @@ rm $LOG_PATH rm -rf "$HOME/miniconda3/pkgs" -mkdir "$HOME/miniconda3/pkgs" +mkdir -p "$HOME/miniconda3/pkgs" rm -rf "$HOME/.conda" "$HOME/.cache" diff --git a/README.md b/README.md index 997b9b00..f3d38201 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,7 @@ Due to rapid development in the codebase and a slower Docker image release cycle - Check [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) for the latest available image tags. - Choose an appropriate image tag for your environment. +- `Lite` means the Docker image does not include ASR models and UVR5 models. You can manually download the UVR5 models, while the program will automatically download the ASR models as needed. - Optionally, build the image locally using the provided Dockerfile for the most up-to-date changes. #### Environment Variables diff --git a/docker-compose.yaml b/docker-compose.yaml index cea85f7e..803c3219 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -12,10 +12,10 @@ services: - "9880:9880" volumes: - .:/workspace/GPT-SoVITS - - /dev/null:/workspace/GPT-SoVITS/pretrained_models - - /dev/null:/workspace/GPT-SoVITS/text/G2PWModel - - /dev/null:/workspace/tools/asr/models - - /dev/null:/workspace/tools/uvr5/uvr5_weights + - /dev/null:/workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models + - /dev/null:/workspace/GPT-SoVITS/GPT_SoVITS/text/G2PWModel + - /dev/null:/workspace/GPT-SoVITS/tools/asr/models + - /dev/null:/workspace/GPT-SoVITS/tools/uvr5/uvr5_weights environment: - is_half=true tty: true @@ -34,10 +34,12 @@ services: - "9880:9880" volumes: - .:/workspace/GPT-SoVITS - - /dev/null:/workspace/GPT-SoVITS/pretrained_models - - /dev/null:/workspace/GPT-SoVITS/text/G2PWModel - - /dev/null:/workspace/tools/asr/models - - /dev/null:/workspace/tools/uvr5/uvr5_weights + - /dev/null:/workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models + - /dev/null:/workspace/GPT-SoVITS/GPT_SoVITS/text/G2PWModel + - /dev/null:/workspace/GPT-SoVITS/tools/asr/models + - /dev/null:/workspace/GPT-SoVITS/tools/uvr5/uvr5_weights + - tools/asr/models:/workspace/models/asr_models + - tools/uvr5/uvr5_weights:/workspace/models/uvr5_weights environment: - is_half=true tty: true @@ -56,10 +58,10 @@ services: - "9880:9880" volumes: - .:/workspace/GPT-SoVITS - - /dev/null:/workspace/GPT-SoVITS/pretrained_models - - /dev/null:/workspace/GPT-SoVITS/text/G2PWModel - - /dev/null:/workspace/tools/asr/models - - /dev/null:/workspace/tools/uvr5/uvr5_weights + - /dev/null:/workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models + - /dev/null:/workspace/GPT-SoVITS/GPT_SoVITS/text/G2PWModel + - /dev/null:/workspace/GPT-SoVITS/tools/asr/models + - /dev/null:/workspace/GPT-SoVITS/tools/uvr5/uvr5_weights environment: - is_half=true tty: true @@ -78,10 +80,12 @@ services: - "9880:9880" volumes: - .:/workspace/GPT-SoVITS - - /dev/null:/workspace/GPT-SoVITS/pretrained_models - - /dev/null:/workspace/GPT-SoVITS/text/G2PWModel - - /dev/null:/workspace/tools/asr/models - - /dev/null:/workspace/tools/uvr5/uvr5_weights + - /dev/null:/workspace/GPT-SoVITS/GPT_SoVITS/pretrained_models + - /dev/null:/workspace/GPT-SoVITS/GPT_SoVITS/text/G2PWModel + - /dev/null:/workspace/GPT-SoVITS/tools/asr/models + - /dev/null:/workspace/GPT-SoVITS/tools/uvr5/uvr5_weights + - tools/asr/models:/workspace/models/asr_models + - tools/uvr5/uvr5_weights:/workspace/models/uvr5_weights environment: - is_half=true tty: true diff --git a/docs/cn/README.md b/docs/cn/README.md index df41c797..89513450 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -118,32 +118,33 @@ pip install -r extra-req.txt --no-deps pip install -r requirements.txt ``` -### 运行 GPT-SoVITS(使用 Docker) +### 运行 GPT-SoVITS (使用 Docker) #### Docker 镜像选择 -由于代码库更新频繁,而 Docker 镜像的发布周期相对较慢,请注意: +由于代码库更新频繁, 而 Docker 镜像的发布周期相对较慢, 请注意: -- 前往 [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) 查看最新可用的镜像标签(tags)。 -- 根据你的运行环境选择合适的镜像标签。 -- 可选:为了获得最新的更改,你可以使用提供的 Dockerfile 在本地构建镜像。 +- 前往 [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) 查看最新可用的镜像标签(tags) +- 根据你的运行环境选择合适的镜像标签 +- `Lite` Docker 镜像不包含 ASR 模型和 UVR5 模型. 你可以自行下载 UVR5 模型, ASR 模型则会在需要时由程序自动下载 +- 可选:为了获得最新的更改, 你可以使用提供的 Dockerfile 在本地构建镜像 #### 环境变量 -- `is_half`:控制是否启用半精度(fp16)。如果你的 GPU 支持,设置为 `true` 可以减少显存占用。 +- `is_half`:控制是否启用半精度(fp16). 如果你的 GPU 支持, 设置为 `true` 可以减少显存占用 #### 共享内存配置 -在 Windows(Docker Desktop)中,默认共享内存大小较小,可能导致运行异常。请在 Docker Compose 文件中根据系统内存情况,增大 `shm_size`(例如设置为 `16g`)。 +在 Windows (Docker Desktop) 中, 默认共享内存大小较小, 可能导致运行异常. 请在 Docker Compose 文件中根据系统内存情况, 增大 `shm_size` (例如设置为 `16g`) #### 选择服务 `docker-compose.yaml` 文件定义了两个主要服务类型: -- `GPT-SoVITS-CU124` 与 `GPT-SoVITS-CU128`:完整版,包含所有功能。 -- `GPT-SoVITS-CU124-Lite` 与 `GPT-SoVITS-CU128-Lite`:轻量版,依赖更少,功能略有删减。 +- `GPT-SoVITS-CU124` 与 `GPT-SoVITS-CU128`:完整版, 包含所有功能 +- `GPT-SoVITS-CU124-Lite` 与 `GPT-SoVITS-CU128-Lite`:轻量版, 依赖更少, 功能略有删减 -如需使用 Docker Compose 运行指定服务,请执行: +如需使用 Docker Compose 运行指定服务, 请执行: ```bash docker compose run --service-ports @@ -151,15 +152,15 @@ docker compose run --service-ports [--lite] ``` -#### 访问运行中的容器(Bash Shell) +#### 访问运行中的容器 (Bash Shell) -当容器在后台运行时,你可以通过以下命令进入容器: +当容器在后台运行时, 你可以通过以下命令进入容器: ```bash docker exec -it bash diff --git a/docs/ja/README.md b/docs/ja/README.md index 15955f1f..d89c2a60 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -110,23 +110,24 @@ pip install -r extra-req.txt --no-deps pip install -r requirementx.txt ``` -### GPT-SoVITS の実行(Docker 使用) +### GPT-SoVITS の実行 (Docker 使用) #### Docker イメージの選択 コードベースの更新が頻繁である一方、Docker イメージのリリースは比較的遅いため、以下を確認してください: -- [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) で最新のイメージタグを確認してください。 -- 環境に合った適切なイメージタグを選択してください。 -- オプション:最新の変更を反映させるため、提供されている Dockerfile を使ってローカルでイメージをビルドすることも可能です。 +- [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) で最新のイメージタグを確認してください +- 環境に合った適切なイメージタグを選択してください +- `Lite` とは、Docker イメージに ASR モデルおよび UVR5 モデルが含まれていないことを意味します. UVR5 モデルは手動でダウンロードし、ASR モデルは必要に応じてプログラムが自動的にダウンロードします +- オプション:最新の変更を反映させるため、提供されている Dockerfile を使ってローカルでイメージをビルドすることも可能です #### 環境変数 -- `is_half`:半精度(fp16)を使用するかどうかを制御します。GPU が対応している場合、`true` に設定することでメモリ使用量を削減できます。 +- `is_half`:半精度 (fp16) を使用するかどうかを制御します. GPU が対応している場合、`true` に設定することでメモリ使用量を削減できます #### 共有メモリの設定 -Windows(Docker Desktop)では、デフォルトの共有メモリサイズが小さいため、予期しない動作が発生する可能性があります。Docker Compose ファイル内の `shm_size` を(例:`16g`)に増やすことをおすすめします。 +Windows (Docker Desktop) では、デフォルトの共有メモリサイズが小さいため、予期しない動作が発生する可能性があります. Docker Compose ファイル内の `shm_size` を (例:`16g`) に増やすことをおすすめします #### サービスの選択 @@ -149,7 +150,7 @@ docker compose run --service-ports [--lite] ``` -#### 実行中のコンテナへアクセス(Bash Shell) +#### 実行中のコンテナへアクセス (Bash Shell) コンテナがバックグラウンドで実行されている場合、以下のコマンドでシェルにアクセスできます: diff --git a/docs/ko/README.md b/docs/ko/README.md index ce313c3a..d499a325 100644 --- a/docs/ko/README.md +++ b/docs/ko/README.md @@ -118,17 +118,18 @@ pip install -r requirements.txt 코드베이스가 빠르게 업데이트되는 반면 Docker 이미지 릴리스 주기는 느리기 때문에 다음을 참고하세요: -- [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits)에서 최신 이미지 태그를 확인하세요. -- 환경에 맞는 적절한 이미지 태그를 선택하세요. -- 선택 사항: 최신 변경사항을 반영하려면 제공된 Dockerfile을 사용하여 로컬에서 직접 이미지를 빌드할 수 있습니다. +- [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits)에서 최신 이미지 태그를 확인하세요 +- 환경에 맞는 적절한 이미지 태그를 선택하세요 +- `Lite` 는 Docker 이미지에 ASR 모델과 UVR5 모델이 포함되어 있지 않음을 의미합니다. UVR5 모델은 사용자가 직접 다운로드해야 하며, ASR 모델은 필요 시 프로그램이 자동으로 다운로드합니다 +- 선택 사항: 최신 변경사항을 반영하려면 제공된 Dockerfile을 사용하여 로컬에서 직접 이미지를 빌드할 수 있습니다 #### 환경 변수 -- `is_half`: 반정밀도(fp16) 사용 여부를 제어합니다. GPU가 지원하는 경우 `true`로 설정하면 메모리 사용량을 줄일 수 있습니다. +- `is_half`: 반정밀도(fp16) 사용 여부를 제어합니다. GPU가 지원하는 경우 `true`로 설정하면 메모리 사용량을 줄일 수 있습니다 #### 공유 메모리 설정 -Windows(Docker Desktop)에서는 기본 공유 메모리 크기가 작아 예기치 않은 동작이 발생할 수 있습니다. 시스템 메모리 상황에 따라 Docker Compose 파일에서 `shm_size`를 (예: `16g`)로 증가시키는 것이 좋습니다. +Windows(Docker Desktop)에서는 기본 공유 메모리 크기가 작아 예기치 않은 동작이 발생할 수 있습니다. 시스템 메모리 상황에 따라 Docker Compose 파일에서 `shm_size`를 (예: `16g`)로 증가시키는 것이 좋습니다 #### 서비스 선택 diff --git a/docs/tr/README.md b/docs/tr/README.md index 83b7c160..12c841b3 100644 --- a/docs/tr/README.md +++ b/docs/tr/README.md @@ -118,9 +118,10 @@ pip install -r requirements.txt Kod tabanı hızla geliştiği halde Docker imajları daha yavaş yayınlandığı için lütfen şu adımları izleyin: -- En güncel kullanılabilir imaj etiketlerini görmek için [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) adresini kontrol edin. -- Ortamınıza uygun bir imaj etiketi seçin. -- Opsiyonel: En güncel değişiklikleri almak için, sağlanan Dockerfile ile yerel olarak imajı kendiniz oluşturabilirsiniz. +- En güncel kullanılabilir imaj etiketlerini görmek için [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) adresini kontrol edin +- Ortamınıza uygun bir imaj etiketi seçin +- `Lite`, Docker imajında ASR modelleri ve UVR5 modellerinin bulunmadığı anlamına gelir. UVR5 modellerini manuel olarak indirebilirsiniz; ASR modelleri ise gerektiğinde program tarafından otomatik olarak indirilir +- Opsiyonel: En güncel değişiklikleri almak için, sağlanan Dockerfile ile yerel olarak imajı kendiniz oluşturabilirsiniz #### Ortam Değişkenleri diff --git a/install.sh b/install.sh index d5474d57..d5512103 100644 --- a/install.sh +++ b/install.sh @@ -144,16 +144,22 @@ if [ "$USE_HF" = "true" ]; then PRETRINED_URL="https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/pretrained_models.zip" G2PW_URL="https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/G2PWModel.zip" UVR5_URL="https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/uvr5_weights.zip" + NLTK_URL="https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/nltk_data.zip" + PYOPENJTALK_URL="https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/open_jtalk_dic_utf_8-1.11.tar.gz" elif [ "$USE_HF_MIRROR" = "true" ]; then echo "Download Model From HuggingFace-Mirror" PRETRINED_URL="https://hf-mirror.com/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/pretrained_models.zip" G2PW_URL="https://hf-mirror.com/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/G2PWModel.zip" UVR5_URL="https://hf-mirror.com/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/uvr5_weights.zip" + NLTK_URL="https://hf-mirror.com/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/nltk_data.zip" + PYOPENJTALK_URL="https://hf-mirror.com/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/open_jtalk_dic_utf_8-1.11.tar.gz" elif [ "$USE_MODELSCOPE" = "true" ]; then echo "Download Model From ModelScope" PRETRINED_URL="https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/pretrained_models.zip" G2PW_URL="https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/G2PWModel.zip" UVR5_URL="https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/uvr5_weights.zip" + NLTK_URL="https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/nltk_data.zip" + PYOPENJTALK_URL="https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/open_jtalk_dic_utf_8-1.11.tar.gz" fi if [ "$WORKFLOW" = "true" ]; then @@ -170,7 +176,7 @@ else unzip -q pretrained_models.zip rm -rf pretrained_models.zip - mv pretrained_models/* GPT_SoVITS/pretrained_models + mv -f pretrained_models/* GPT_SoVITS/pretrained_models rm -rf pretrained_models fi @@ -180,7 +186,7 @@ if [ ! -d "GPT_SoVITS/text/G2PWModel" ]; then unzip -q G2PWModel.zip rm -rf G2PWModel.zip - mv G2PWModel GPT_SoVITS/text/G2PWModel + mv -f G2PWModel GPT_SoVITS/text/G2PWModel else echo "G2PWModel Exists" fi @@ -194,7 +200,7 @@ if [ "$DOWNLOAD_UVR5" = "true" ]; then unzip -q uvr5_weights.zip rm -rf uvr5_weights.zip - mv uvr5_weights/* tools/uvr5/uvr5_weights + mv-f uvr5_weights/* tools/uvr5/uvr5_weights rm -rf uvr5_weights fi fi @@ -256,7 +262,18 @@ pip install -r extra-req.txt --no-deps --quiet pip install -r requirements.txt --quiet -python -c "import nltk; nltk.download(['averaged_perceptron_tagger','averaged_perceptron_tagger_eng','cmudict'])" +PY_PREFIX=$(python -c "import sys; print(sys.prefix)") +PYOPENJTALK_PREFIX=$(python -c "import os, pyopenjtalk; print(os.path.dirname(pyopenjtalk.__file__))") + +$WGET_CMD "$NLTK_URL" +unzip -q nltk_data +rm -rf nltk_data.zip +mv -f nltk_data "$PY_PREFIX" + +$WGET_CMD "$PYOPENJTALK_URL" +tar -xvzf open_jtalk_dic_utf_8-1.11.tar.gz +rm -rf open_jtalk_dic_utf_8-1.11.tar.gz +mv -f open_jtalk_dic_utf_8-1.11 "$PYOPENJTALK_PREFIX" if [ "$USE_ROCM" = true ] && [ "$IS_WSL" = true ]; then echo "Update to WSL compatible runtime lib..." From 004017c6110084aa2fa19919797b8d60421f261e Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sun, 4 May 2025 11:11:45 +0100 Subject: [PATCH 083/183] update docker_build --- docker_build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker_build.sh b/docker_build.sh index 0bc9ae1a..ef452ce3 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -68,15 +68,15 @@ done TARGETPLATFORM=$(uname -m | grep -q 'x86' && echo "linux/amd64" || echo "linux/arm64") if [ $LITE = true ]; then - CUDA_BASE="runtime" + TORCH_BASE="lite" else - CUDA_BASE="devel" + TORCH_BASE="full" fi docker build \ --build-arg CUDA_VERSION=$CUDA_VERSION \ --build-arg LITE=$LITE \ --build-arg TARGETPLATFORM="$TARGETPLATFORM" \ - --build-arg CUDA_BASE=$CUDA_BASE \ + --build-arg TORCH_BASE=$TORCH_BASE \ -t "${USER}/gpt-sovits:local" \ . From 975393133614de2cb78fbbd6c7f848edc7a30dc6 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sun, 4 May 2025 11:52:42 +0100 Subject: [PATCH 084/183] Update Docs for Install.sh --- Colab-Inference.ipynb | 2 +- README.md | 4 ++-- colab_webui.ipynb | 2 +- docs/cn/README.md | 4 ++-- docs/ja/README.md | 4 ++-- docs/ko/README.md | 4 ++-- docs/tr/README.md | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Colab-Inference.ipynb b/Colab-Inference.ipynb index 0b6be3d7..baf3baea 100644 --- a/Colab-Inference.ipynb +++ b/Colab-Inference.ipynb @@ -53,7 +53,7 @@ "\n", "pip install ipykernel\n", "\n", - "bash install.sh --source HF" + "bash install.sh --device CU124 --source HF" ] }, { diff --git a/README.md b/README.md index f3d38201..264485d8 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ If you are a Windows user (tested with win>=10), you can [download the integrate ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS @@ -78,7 +78,7 @@ bash install.sh --source [--download-uvr5] ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### Install Manually diff --git a/colab_webui.ipynb b/colab_webui.ipynb index b4107756..69f1561b 100644 --- a/colab_webui.ipynb +++ b/colab_webui.ipynb @@ -59,7 +59,7 @@ "\n", "pip install ipykernel\n", "\n", - "bash install.sh --source HF --download-uvr5" + "bash install.sh --device CU124 --source HF --download-uvr5" ] }, { diff --git a/docs/cn/README.md b/docs/cn/README.md index 89513450..7c90931f 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -65,7 +65,7 @@ ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS @@ -78,7 +78,7 @@ bash install.sh --source [--download-uvr5] ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### 手动安装 diff --git a/docs/ja/README.md b/docs/ja/README.md index d89c2a60..532b06d9 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -59,7 +59,7 @@ Windows ユーザー: (Windows 10 以降でテスト済み)、[統合パッケ ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS @@ -72,7 +72,7 @@ bash install.sh --source [--download-uvr5] ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### 手動インストール diff --git a/docs/ko/README.md b/docs/ko/README.md index d499a325..bec70a19 100644 --- a/docs/ko/README.md +++ b/docs/ko/README.md @@ -59,7 +59,7 @@ Windows 사용자라면 (win>=10에서 테스트됨), [통합 패키지를 다 ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS @@ -72,7 +72,7 @@ bash install.sh --source [--download-uvr5] ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### 수동 설치 diff --git a/docs/tr/README.md b/docs/tr/README.md index 12c841b3..89bf276b 100644 --- a/docs/tr/README.md +++ b/docs/tr/README.md @@ -61,7 +61,7 @@ Eğer bir Windows kullanıcısıysanız (win>=10 ile test edilmiştir), [entegre ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS @@ -74,7 +74,7 @@ bash install.sh --source [--download-uvr5] ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### El ile Yükleme From 3e177aaaaee3727859d982b282286a0fc85a2fe3 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sun, 4 May 2025 12:00:06 +0100 Subject: [PATCH 085/183] update docker docs about architecture --- README.md | 9 +++++---- docs/cn/README.md | 1 + docs/ja/README.md | 1 + docs/ko/README.md | 1 + docs/tr/README.md | 1 + 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 264485d8..5dd6a52b 100644 --- a/README.md +++ b/README.md @@ -124,10 +124,11 @@ pip install -r requirements.txt Due to rapid development in the codebase and a slower Docker image release cycle, please: -- Check [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) for the latest available image tags. -- Choose an appropriate image tag for your environment. -- `Lite` means the Docker image does not include ASR models and UVR5 models. You can manually download the UVR5 models, while the program will automatically download the ASR models as needed. -- Optionally, build the image locally using the provided Dockerfile for the most up-to-date changes. +- Check [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) for the latest available image tags +- Choose an appropriate image tag for your environment +- `Lite` means the Docker image does not include ASR models and UVR5 models. You can manually download the UVR5 models, while the program will automatically download the ASR models as needed +- The appropriate architecture image (amd64/arm64) will be automatically pulled during Docker Compose +- Optionally, build the image locally using the provided Dockerfile for the most up-to-date changes #### Environment Variables diff --git a/docs/cn/README.md b/docs/cn/README.md index 7c90931f..7801c118 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -127,6 +127,7 @@ pip install -r requirements.txt - 前往 [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) 查看最新可用的镜像标签(tags) - 根据你的运行环境选择合适的镜像标签 - `Lite` Docker 镜像不包含 ASR 模型和 UVR5 模型. 你可以自行下载 UVR5 模型, ASR 模型则会在需要时由程序自动下载 +- 在使用 Docker Compose 时, 会自动拉取适配的架构镜像 (amd64 或 arm64) - 可选:为了获得最新的更改, 你可以使用提供的 Dockerfile 在本地构建镜像 #### 环境变量 diff --git a/docs/ja/README.md b/docs/ja/README.md index 532b06d9..acbd45eb 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -119,6 +119,7 @@ pip install -r requirementx.txt - [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) で最新のイメージタグを確認してください - 環境に合った適切なイメージタグを選択してください - `Lite` とは、Docker イメージに ASR モデルおよび UVR5 モデルが含まれていないことを意味します. UVR5 モデルは手動でダウンロードし、ASR モデルは必要に応じてプログラムが自動的にダウンロードします +- Docker Compose 実行時に、対応するアーキテクチャ (amd64 または arm64) のイメージが自動的に取得されます - オプション:最新の変更を反映させるため、提供されている Dockerfile を使ってローカルでイメージをビルドすることも可能です #### 環境変数 diff --git a/docs/ko/README.md b/docs/ko/README.md index bec70a19..a5cf52e4 100644 --- a/docs/ko/README.md +++ b/docs/ko/README.md @@ -121,6 +121,7 @@ pip install -r requirements.txt - [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits)에서 최신 이미지 태그를 확인하세요 - 환경에 맞는 적절한 이미지 태그를 선택하세요 - `Lite` 는 Docker 이미지에 ASR 모델과 UVR5 모델이 포함되어 있지 않음을 의미합니다. UVR5 모델은 사용자가 직접 다운로드해야 하며, ASR 모델은 필요 시 프로그램이 자동으로 다운로드합니다 +- Docker Compose 실행 시, 해당 아키텍처에 맞는 이미지(amd64 또는 arm64)가 자동으로 다운로드됩니다 - 선택 사항: 최신 변경사항을 반영하려면 제공된 Dockerfile을 사용하여 로컬에서 직접 이미지를 빌드할 수 있습니다 #### 환경 변수 diff --git a/docs/tr/README.md b/docs/tr/README.md index 89bf276b..857bbd1d 100644 --- a/docs/tr/README.md +++ b/docs/tr/README.md @@ -121,6 +121,7 @@ Kod tabanı hızla geliştiği halde Docker imajları daha yavaş yayınlandığ - En güncel kullanılabilir imaj etiketlerini görmek için [Docker Hub](https://hub.docker.com/r/xxxxrt666/gpt-sovits) adresini kontrol edin - Ortamınıza uygun bir imaj etiketi seçin - `Lite`, Docker imajında ASR modelleri ve UVR5 modellerinin bulunmadığı anlamına gelir. UVR5 modellerini manuel olarak indirebilirsiniz; ASR modelleri ise gerektiğinde program tarafından otomatik olarak indirilir +- Docker Compose sırasında, uygun mimariye (amd64 veya arm64) ait imaj otomatik olarak indirilir - Opsiyonel: En güncel değişiklikleri almak için, sağlanan Dockerfile ile yerel olarak imajı kendiniz oluşturabilirsiniz #### Ortam Değişkenleri From 04aaa6ae3472916213719031ca82d07e038992ee Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sun, 4 May 2025 12:12:17 +0100 Subject: [PATCH 086/183] Add Xcode-Commandline-Tool Installation --- install.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/install.sh b/install.sh index d5512103..b03b8bfe 100644 --- a/install.sh +++ b/install.sh @@ -131,6 +131,22 @@ if [ "$(uname)" != "Darwin" ]; then echo "Installing G++..." conda install -c conda-forge gxx -q -y +else + if ! xcode-select -p &>/dev/null; then + echo "Installing Xcode Command Line Tools..." + xcode-select --install + fi + echo "Waiting For Xcode Command Line Tools Installation Complete..." + while true; do + sleep 20 + + if xcode-select -p &>/dev/null; then + echo "Xcode Command Line Tools Installed" + break + else + echo "Installing,Please Wait..." + fi + done fi echo "Installing ffmpeg and cmake..." From dfea2563c0892303b5bdaaadbc0ba36868f26cd1 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 6 May 2025 17:03:36 +0100 Subject: [PATCH 087/183] Update Docs 1. Add Missing VC17 2. Modufied the Order of FFmpeg Installation and Requirements Installation 3. Remove Duplicate FFmpeg --- README.md | 34 ++++++++++++++++++---------------- docs/cn/README.md | 34 ++++++++++++++++++---------------- docs/ja/README.md | 36 ++++++++++++++++++++---------------- docs/ko/README.md | 34 ++++++++++++++++++---------------- docs/tr/README.md | 34 +++++++++++++++++++--------------- 5 files changed, 93 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index 5dd6a52b..a6498a92 100644 --- a/README.md +++ b/README.md @@ -63,31 +63,41 @@ If you are a Windows user (tested with win>=10), you can [download the integrate ### Linux ```bash -conda create -n GPTSoVits python=3.9 +conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS **Note: The models trained with GPUs on Macs result in significantly lower quality compared to those trained on other devices, so we are temporarily using CPUs instead.** -1. Install Xcode command-line tools by running `xcode-select --install`. -2. Install the program by running the following commands: +Install the program by running the following commands: ```bash -conda create -n GPTSoVits python=3.9 +conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### Install Manually +#### Install Dependences + +```bash +conda create -n GPTSoVits python=3.10 +conda activate GPTSoVits + +pip install -r extra-req.txt --no-deps +pip install -r requirements.txt +``` + #### Install FFmpeg ##### Conda Users ```bash +conda activate GPTSoVits conda install ffmpeg ``` @@ -96,14 +106,13 @@ conda install ffmpeg ```bash sudo apt install ffmpeg sudo apt install libsox-dev -conda install -c conda-forge 'ffmpeg<7' ``` ##### Windows Users -Download and place [ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) and [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) in the GPT-SoVITS root. +Download and place [ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) and [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) in the GPT-SoVITS root -Install [Visual Studio 2017](https://aka.ms/vs/17/release/vc_redist.x86.exe) (Korean TTS Only) +Install [Visual Studio 2017](https://aka.ms/vs/17/release/vc_redist.x86.exe) ##### MacOS Users @@ -111,13 +120,6 @@ Install [Visual Studio 2017](https://aka.ms/vs/17/release/vc_redist.x86.exe) (Ko brew install ffmpeg ``` -#### Install Dependences - -```bash -pip install -r extra-req.txt --no-deps -pip install -r requirements.txt -``` - ### Running GPT-SoVITS with Docker #### Docker Image Selection diff --git a/docs/cn/README.md b/docs/cn/README.md index 7801c118..20fad53a 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -63,31 +63,41 @@ ### Linux ```bash -conda create -n GPTSoVits python=3.9 +conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS **注: 在 Mac 上使用 GPU 训练的模型效果显著低于其他设备训练的模型, 所以我们暂时使用 CPU 进行训练.** -1. 运行 `xcode-select --install` 安装 Xcode command-line tools. -2. 运行以下的命令来安装本项目: +运行以下的命令来安装本项目: ```bash -conda create -n GPTSoVits python=3.9 +conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### 手动安装 +#### 安装依赖 + +```bash +conda create -n GPTSoVits python=3.10 +conda activate GPTSoVits + +pip install -r extra-req.txt --no-deps +pip install -r requirements.txt +``` + #### 安装 FFmpeg ##### Conda 用户 ```bash +conda activate GPTSoVits conda install ffmpeg ``` @@ -96,14 +106,13 @@ conda install ffmpeg ```bash sudo apt install ffmpeg sudo apt install libsox-dev -conda install -c conda-forge 'ffmpeg<7' ``` ##### Windows 用户 -下载并将 [ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) 和 [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) 放置在 GPT-SoVITS 根目录下. +下载并将 [ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) 和 [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) 放置在 GPT-SoVITS 根目录下 -安装 [Visual Studio 2017](https://aka.ms/vs/17/release/vc_redist.x86.exe) 环境(仅限韩语 TTS) +安装 [Visual Studio 2017](https://aka.ms/vs/17/release/vc_redist.x86.exe) 环境 ##### MacOS 用户 @@ -111,13 +120,6 @@ conda install -c conda-forge 'ffmpeg<7' brew install ffmpeg ``` -#### 安装依赖 - -```bash -pip install -r extra-req.txt --no-deps -pip install -r requirements.txt -``` - ### 运行 GPT-SoVITS (使用 Docker) #### Docker 镜像选择 diff --git a/docs/ja/README.md b/docs/ja/README.md index acbd45eb..74484499 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -57,31 +57,41 @@ Windows ユーザー: (Windows 10 以降でテスト済み)、[統合パッケ ### Linux ```bash -conda create -n GPTSoVits python=3.9 +conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS **注: Mac で GPU を使用して訓練されたモデルは、他のデバイスで訓練されたモデルと比較して著しく品質が低下するため、当面は CPU を使用して訓練することを強く推奨します.** -1. `xcode-select --install` を実行して、Xcode コマンドラインツールをインストールします. -2. 以下のコマンドを実行してこのプロジェクトをインストールします. +以下のコマンドを実行してこのプロジェクトをインストールします: ```bash -conda create -n GPTSoVits python=3.9 +conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### 手動インストール -#### FFmpeg をインストールします. +#### 依存関係をインストールします + +```bash +conda create -n GPTSoVits python=3.10 +conda activate GPTSoVits + +pip install -r extra-req.txt --no-deps +pip install -r requirements.txt +``` + +#### FFmpeg をインストールします ##### Conda ユーザー ```bash +conda activate GPTSoVits conda install ffmpeg ``` @@ -90,12 +100,13 @@ conda install ffmpeg ```bash sudo apt install ffmpeg sudo apt install libsox-dev -conda install -c conda-forge 'ffmpeg<7' ``` ##### Windows ユーザー -[ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) と [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) をダウンロードし、GPT-SoVITS のルートフォルダに置きます. +[ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) と [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) をダウンロードし、GPT-SoVITS のルートフォルダに置きます + +[Visual Studio 2017](https://aka.ms/vs/17/release/vc_redist.x86.exe) 環境をインストールしてください ##### MacOS ユーザー @@ -103,13 +114,6 @@ conda install -c conda-forge 'ffmpeg<7' brew install ffmpeg ``` -#### 依存関係をインストールします - -```bash -pip install -r extra-req.txt --no-deps -pip install -r requirementx.txt -``` - ### GPT-SoVITS の実行 (Docker 使用) #### Docker イメージの選択 diff --git a/docs/ko/README.md b/docs/ko/README.md index a5cf52e4..81e0130f 100644 --- a/docs/ko/README.md +++ b/docs/ko/README.md @@ -57,31 +57,41 @@ Windows 사용자라면 (win>=10에서 테스트됨), [통합 패키지를 다 ### Linux ```bash -conda create -n GPTSoVits python=3.9 +conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS **주의: Mac에서 GPU로 훈련된 모델은 다른 OS에서 훈련된 모델에 비해 품질이 낮습니다. 해당 문제를 해결하기 전까지 MacOS에선 CPU를 사용하여 훈련을 진행합니다.** -1. `xcode-select --install`을 실행하여 Xcode 커맨드라인 도구를 설치하세요. -2. 다음 명령어를 실행하여 이 프로젝트를 설치하세요. +다음 명령어를 실행하여 이 프로젝트를 설치하세요 ```bash -conda create -n GPTSoVits python=3.9 +conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### 수동 설치 +#### 의존성 설치 + +```bash +conda create -n GPTSoVits python=3.10 +conda activate GPTSoVits + +pip install -r extra-req.txt --no-deps +pip install -r requirements.txt +``` + #### FFmpeg 설치 ##### Conda 사용자 ```bash +conda activate GPTSoVits conda install ffmpeg ``` @@ -90,14 +100,13 @@ conda install ffmpeg ```bash sudo apt install ffmpeg sudo apt install libsox-dev -conda install -c conda-forge 'ffmpeg<7' ``` ##### Windows 사용자 -[ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe)와 [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe)를 GPT-SoVITS root 디렉토리에 넣습니다. +[ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe)와 [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe)를 GPT-SoVITS root 디렉토리에 넣습니다 -[Visual Studio 2017](https://aka.ms/vs/17/release/vc_redist.x86.exe) 설치 (Korean TTS 전용) +[Visual Studio 2017](https://aka.ms/vs/17/release/vc_redist.x86.exe) 설치 ##### MacOS 사용자 @@ -105,13 +114,6 @@ conda install -c conda-forge 'ffmpeg<7' brew install ffmpeg ``` -#### 의존성 설치 - -```bash -pip install -r extra-req.txt --no-deps -pip install -r requirements.txt -``` - ### GPT-SoVITS 실행하기 (Docker 사용) #### Docker 이미지 선택 diff --git a/docs/tr/README.md b/docs/tr/README.md index 857bbd1d..03d481c9 100644 --- a/docs/tr/README.md +++ b/docs/tr/README.md @@ -59,31 +59,41 @@ Eğer bir Windows kullanıcısıysanız (win>=10 ile test edilmiştir), [entegre ### Linux ```bash -conda create -n GPTSoVits python=3.9 +conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS **Not: Mac'lerde GPU'larla eğitilen modeller, diğer cihazlarda eğitilenlere göre önemli ölçüde daha düşük kalitede sonuç verir, bu nedenle geçici olarak CPU'lar kullanıyoruz.** -1. `xcode-select --install` komutunu çalıştırarak Xcode komut satırı araçlarını yükleyin. -2. Aşağıdaki komutları çalıştırarak programı yükleyin: +Aşağıdaki komutları çalıştırarak programı yükleyin: ```bash -conda create -n GPTSoVits python=3.9 +conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### El ile Yükleme +#### Bağımlılıkları Yükleme + +```bash +conda create -n GPTSoVits python=3.10 +conda activate GPTSoVits + +pip install -r extra-req.txt --no-deps +pip install -r requirements.txt +``` + #### FFmpeg'i Yükleme ##### Conda Kullanıcıları ```bash +conda activate GPTSoVits conda install ffmpeg ``` @@ -92,12 +102,13 @@ conda install ffmpeg ```bash sudo apt install ffmpeg sudo apt install libsox-dev -conda install -c conda-forge 'ffmpeg<7' ``` ##### Windows Kullanıcıları -[ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) ve [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) dosyalarını indirin ve GPT-SoVITS kök dizinine yerleştirin. +[ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) ve [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) dosyalarını indirin ve GPT-SoVITS kök dizinine yerleştirin + +[Visual Studio 2017](https://aka.ms/vs/17/release/vc_redist.x86.exe) ortamını yükleyin ##### MacOS Kullanıcıları @@ -105,13 +116,6 @@ conda install -c conda-forge 'ffmpeg<7' brew install ffmpeg ``` -#### Bağımlılıkları Yükleme - -```bash -pip install -r extra-req.txt --no-deps -pip install -r requirements.txt -``` - ### GPT-SoVITS Çalıştırma (Docker Kullanarak) #### Docker İmajı Seçimi From 96e94d8666ab7e50a5fcb7921b2947465b65cbaf Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 9 May 2025 07:26:54 +0100 Subject: [PATCH 088/183] Fix Wrong Cuda Version --- .github/workflows/docker-publish.yaml | 16 ++++++++-------- Dockerfile | 4 ++-- docker_build.sh | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 39785290..e2be5423 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -24,19 +24,19 @@ jobs: strategy: matrix: include: - - cuda_version: 124 + - cuda_version: 12.4 lite: true torch_base: lite tag_prefix: cu124-lite - - cuda_version: 124 + - cuda_version: 12.4 lite: false torch_base: full tag_prefix: cu124 - - cuda_version: 128 + - cuda_version: 12.8 lite: true torch_base: lite tag_prefix: cu128-lite - - cuda_version: 128 + - cuda_version: 12.8 lite: false torch_base: full tag_prefix: cu128 @@ -111,19 +111,19 @@ jobs: strategy: matrix: include: - - cuda_version: 124 + - cuda_version: 12.4 lite: true torch_base: lite tag_prefix: cu124-lite - - cuda_version: 124 + - cuda_version: 12.4 lite: false torch_base: full tag_prefix: cu124 - - cuda_version: 128 + - cuda_version: 12.8 lite: true torch_base: lite tag_prefix: cu128-lite - - cuda_version: 128 + - cuda_version: 12.8 lite: false torch_base: full tag_prefix: cu128 diff --git a/Dockerfile b/Dockerfile index 429d7f4c..34a6d49f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG CUDA_VERSION=124 +ARG CUDA_VERSION=12.4 ARG TORCH_BASE=full FROM xxxxrt666/torch-base:cu${CUDA_VERSION}-${TORCH_BASE} @@ -7,7 +7,7 @@ LABEL maintainer="XXXXRT" LABEL version="V4" LABEL description="Docker image for GPT-SoVITS" -ARG CUDA_VERSION=124 +ARG CUDA_VERSION=12.4 ENV CUDA_VERSION=${CUDA_VERSION} diff --git a/docker_build.sh b/docker_build.sh index ef452ce3..4db652a1 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -40,10 +40,10 @@ while [[ $# -gt 0 ]]; do --cuda) case "$2" in 12.4) - CUDA_VERSION=124 + CUDA_VERSION=12.4 ;; 12.8) - CUDA_VERSION=128 + CUDA_VERSION=12.8 ;; *) echo "Error: Invalid CUDA_VERSION: $2" From 5394a2b126785fd8c8655bdccc9f2c32d9eee00c Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 9 May 2025 07:44:25 +0100 Subject: [PATCH 089/183] Update TESTED ENV --- README.md | 18 +++++++++--------- docs/cn/README.md | 18 +++++++++--------- docs/ja/README.md | 18 +++++++++--------- docs/ko/README.md | 18 +++++++++--------- docs/tr/README.md | 18 +++++++++--------- 5 files changed, 45 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index a6498a92..44c8ea19 100644 --- a/README.md +++ b/README.md @@ -44,15 +44,15 @@ For users in China, you can [click here](https://www.codewithgpu.com/i/RVC-Boss/ ### Tested Environments -| Python Version | PyTorch Version | Device | -| -------------- | ---------------- | -------------------- | -| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | -| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | -| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | -| Python 3.9 | PyTorch 2.8.0dev | CUDA12.8 (for sm120) | -| Python 3.9 | PyTorch 2.5.1 | Apple silicon | -| Python 3.11 | PyTorch 2.6.0 | Apple silicon | -| Python 3.9 | PyTorch 2.2.2 | CPU | +| Python Version | PyTorch Version | Device | +| -------------- | ---------------- | ------------- | +| Python 3.10 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.11 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.11 | PyTorch 2.7.0 | CUDA 12.8 | +| Python 3.9 | PyTorch 2.8.0dev | CUDA 12.8 | +| Python 3.9 | PyTorch 2.5.1 | Apple silicon | +| Python 3.11 | PyTorch 2.7.0 | Apple silicon | +| Python 3.9 | PyTorch 2.2.2 | CPU | ### Windows diff --git a/docs/cn/README.md b/docs/cn/README.md index 20fad53a..bc94495d 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -44,15 +44,15 @@ ### 测试通过的环境 -| Python Version | PyTorch Version | Device | -| -------------- | ---------------- | -------------------- | -| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | -| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | -| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | -| Python 3.9 | PyTorch 2.8.0dev | CUDA12.8 (for sm120) | -| Python 3.9 | PyTorch 2.5.1 | Apple silicon | -| Python 3.11 | PyTorch 2.6.0 | Apple silicon | -| Python 3.9 | PyTorch 2.2.2 | CPU | +| Python Version | PyTorch Version | Device | +| -------------- | ---------------- | ------------- | +| Python 3.10 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.11 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.11 | PyTorch 2.7.0 | CUDA 12.8 | +| Python 3.9 | PyTorch 2.8.0dev | CUDA 12.8 | +| Python 3.9 | PyTorch 2.5.1 | Apple silicon | +| Python 3.11 | PyTorch 2.7.0 | Apple silicon | +| Python 3.9 | PyTorch 2.2.2 | CPU | ### Windows diff --git a/docs/ja/README.md b/docs/ja/README.md index 74484499..076fceed 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -40,15 +40,15 @@ https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350- ### テスト済みの環境 -| Python Version | PyTorch Version | Device | -| -------------- | ---------------- | -------------------- | -| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | -| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | -| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | -| Python 3.9 | PyTorch 2.5.1 | Apple silicon | -| Python 3.11 | PyTorch 2.6.0 | Apple silicon | -| Python 3.9 | PyTorch 2.2.2 | CPU | -| Python 3.9 | PyTorch 2.8.0dev | CUDA12.8 (for sm120) | +| Python Version | PyTorch Version | Device | +| -------------- | ---------------- | ------------- | +| Python 3.10 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.11 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.11 | PyTorch 2.7.0 | CUDA 12.8 | +| Python 3.9 | PyTorch 2.8.0dev | CUDA 12.8 | +| Python 3.9 | PyTorch 2.5.1 | Apple silicon | +| Python 3.11 | PyTorch 2.7.0 | Apple silicon | +| Python 3.9 | PyTorch 2.2.2 | CPU | ### Windows diff --git a/docs/ko/README.md b/docs/ko/README.md index 81e0130f..f81a9866 100644 --- a/docs/ko/README.md +++ b/docs/ko/README.md @@ -40,15 +40,15 @@ https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350- ### 테스트 통과 환경 -| Python Version | PyTorch Version | Device | -| -------------- | ---------------- | -------------------- | -| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | -| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | -| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | -| Python 3.9 | PyTorch 2.8.0dev | CUDA12.8 (for sm120) | -| Python 3.9 | PyTorch 2.5.1 | Apple silicon | -| Python 3.11 | PyTorch 2.6.0 | Apple silicon | -| Python 3.9 | PyTorch 2.2.2 | CPU | +| Python Version | PyTorch Version | Device | +| -------------- | ---------------- | ------------- | +| Python 3.10 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.11 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.11 | PyTorch 2.7.0 | CUDA 12.8 | +| Python 3.9 | PyTorch 2.8.0dev | CUDA 12.8 | +| Python 3.9 | PyTorch 2.5.1 | Apple silicon | +| Python 3.11 | PyTorch 2.7.0 | Apple silicon | +| Python 3.9 | PyTorch 2.2.2 | CPU | ### Windows diff --git a/docs/tr/README.md b/docs/tr/README.md index 03d481c9..b6d6f51e 100644 --- a/docs/tr/README.md +++ b/docs/tr/README.md @@ -42,15 +42,15 @@ https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350- ### Test Edilmiş Ortamlar -| Python Version | PyTorch Version | Device | -| -------------- | ---------------- | -------------------- | -| Python 3.9 | PyTorch 2.0.1 | CUDA 11.8 | -| Python 3.10.13 | PyTorch 2.1.2 | CUDA 12.3 | -| Python 3.10.17 | PyTorch 2.5.1 | CUDA 12.4 | -| Python 3.9 | PyTorch 2.8.0dev | CUDA12.8 (for sm120) | -| Python 3.9 | PyTorch 2.5.1 | Apple silicon | -| Python 3.11 | PyTorch 2.6.0 | Apple silicon | -| Python 3.9 | PyTorch 2.2.2 | CPU | +| Python Version | PyTorch Version | Device | +| -------------- | ---------------- | ------------- | +| Python 3.10 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.11 | PyTorch 2.5.1 | CUDA 12.4 | +| Python 3.11 | PyTorch 2.7.0 | CUDA 12.8 | +| Python 3.9 | PyTorch 2.8.0dev | CUDA 12.8 | +| Python 3.9 | PyTorch 2.5.1 | Apple silicon | +| Python 3.11 | PyTorch 2.7.0 | Apple silicon | +| Python 3.9 | PyTorch 2.2.2 | CPU | ### Windows From acc4b5ac6dc03525e006edd3943ed9b6455ba411 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 9 May 2025 07:52:41 +0100 Subject: [PATCH 090/183] Add PYTHONNOUSERSITE(-s) --- webui.py | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/webui.py b/webui.py index 8a9e0856..d8cd6843 100644 --- a/webui.py +++ b/webui.py @@ -384,7 +384,7 @@ def change_label(path_list): if p_label is None: check_for_existance([path_list]) path_list = my_utils.clean_path(path_list) - cmd = '"%s" tools/subfix_webui.py --load_list "%s" --webui_port %s --is_share %s' % ( + cmd = '"%s" -s tools/subfix_webui.py --load_list "%s" --webui_port %s --is_share %s' % ( python_exec, path_list, webui_port_subfix, @@ -413,7 +413,13 @@ process_name_uvr5 = i18n("人声分离WebUI") def change_uvr5(): global p_uvr5 if p_uvr5 is None: - cmd = '"%s" tools/uvr5/webui.py "%s" %s %s %s' % (python_exec, infer_device, is_half, webui_port_uvr5, is_share) + cmd = '"%s" -s tools/uvr5/webui.py "%s" %s %s %s' % ( + python_exec, + infer_device, + is_half, + webui_port_uvr5, + is_share, + ) yield ( process_info(process_name_uvr5, "opened"), {"__type__": "update", "visible": False}, @@ -437,9 +443,9 @@ process_name_tts = i18n("TTS推理WebUI") def change_tts_inference(bert_path, cnhubert_base_path, gpu_number, gpt_path, sovits_path, batched_infer_enabled): global p_tts_inference if batched_infer_enabled: - cmd = '"%s" GPT_SoVITS/inference_webui_fast.py "%s"' % (python_exec, language) + cmd = '"%s" -s GPT_SoVITS/inference_webui_fast.py "%s"' % (python_exec, language) else: - cmd = '"%s" GPT_SoVITS/inference_webui.py "%s"' % (python_exec, language) + cmd = '"%s" -s GPT_SoVITS/inference_webui.py "%s"' % (python_exec, language) # #####v3暂不支持加速推理 # if version=="v3": # cmd = '"%s" GPT_SoVITS/inference_webui.py "%s"'%(python_exec, language) @@ -480,7 +486,7 @@ def open_asr(asr_inp_dir, asr_opt_dir, asr_model, asr_model_size, asr_lang, asr_ asr_inp_dir = my_utils.clean_path(asr_inp_dir) asr_opt_dir = my_utils.clean_path(asr_opt_dir) check_for_existance([asr_inp_dir]) - cmd = f'"{python_exec}" tools/asr/{asr_dict[asr_model]["path"]}' + cmd = f'"{python_exec}" -s tools/asr/{asr_dict[asr_model]["path"]}' cmd += f' -i "{asr_inp_dir}"' cmd += f' -o "{asr_opt_dir}"' cmd += f" -s {asr_model_size}" @@ -541,7 +547,7 @@ def open_denoise(denoise_inp_dir, denoise_opt_dir): denoise_inp_dir = my_utils.clean_path(denoise_inp_dir) denoise_opt_dir = my_utils.clean_path(denoise_opt_dir) check_for_existance([denoise_inp_dir]) - cmd = '"%s" tools/cmd-denoise.py -i "%s" -o "%s" -p %s' % ( + cmd = '"%s" -s tools/cmd-denoise.py -i "%s" -o "%s" -p %s' % ( python_exec, denoise_inp_dir, denoise_opt_dir, @@ -638,9 +644,9 @@ def open1Ba( with open(tmp_config_path, "w") as f: f.write(json.dumps(data)) if version in ["v1", "v2"]: - cmd = '"%s" GPT_SoVITS/s2_train.py --config "%s"' % (python_exec, tmp_config_path) + cmd = '"%s" -s GPT_SoVITS/s2_train.py --config "%s"' % (python_exec, tmp_config_path) else: - cmd = '"%s" GPT_SoVITS/s2_train_v3_lora.py --config "%s"' % (python_exec, tmp_config_path) + cmd = '"%s" -s GPT_SoVITS/s2_train_v3_lora.py --config "%s"' % (python_exec, tmp_config_path) yield ( process_info(process_name_sovits, "opened"), {"__type__": "update", "visible": False}, @@ -731,7 +737,7 @@ def open1Bb( with open(tmp_config_path, "w") as f: f.write(yaml.dump(data, default_flow_style=False)) # cmd = '"%s" GPT_SoVITS/s1_train.py --config_file "%s" --train_semantic_path "%s/6-name2semantic.tsv" --train_phoneme_path "%s/2-name2text.txt" --output_dir "%s/logs_s1"'%(python_exec,tmp_config_path,s1_dir,s1_dir,s1_dir) - cmd = '"%s" GPT_SoVITS/s1_train.py --config_file "%s" ' % (python_exec, tmp_config_path) + cmd = '"%s" -s GPT_SoVITS/s1_train.py --config_file "%s" ' % (python_exec, tmp_config_path) yield ( process_info(process_name_gpt, "opened"), {"__type__": "update", "visible": False}, @@ -808,7 +814,7 @@ def open_slice(inp, opt_root, threshold, min_length, min_interval, hop_size, max return if ps_slice == []: for i_part in range(n_parts): - cmd = '"%s" tools/slice_audio.py "%s" "%s" %s %s %s %s %s %s %s %s %s' % ( + cmd = '"%s" -s tools/slice_audio.py "%s" "%s" %s %s %s %s %s %s %s %s %s' % ( python_exec, inp, opt_root, @@ -902,7 +908,7 @@ def open1a(inp_text, inp_wav_dir, exp_name, gpu_numbers, bert_pretrained_dir): } ) os.environ.update(config) - cmd = '"%s" GPT_SoVITS/prepare_datasets/1-get-text.py' % python_exec + cmd = '"%s" -s GPT_SoVITS/prepare_datasets/1-get-text.py' % python_exec print(cmd) p = Popen(cmd, shell=True) ps1a.append(p) @@ -989,7 +995,7 @@ def open1b(inp_text, inp_wav_dir, exp_name, gpu_numbers, ssl_pretrained_dir): } ) os.environ.update(config) - cmd = '"%s" GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py' % python_exec + cmd = '"%s" -s GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py' % python_exec print(cmd) p = Popen(cmd, shell=True) ps1b.append(p) @@ -1060,7 +1066,7 @@ def open1c(inp_text, exp_name, gpu_numbers, pretrained_s2G_path): } ) os.environ.update(config) - cmd = '"%s" GPT_SoVITS/prepare_datasets/3-get-semantic.py' % python_exec + cmd = '"%s" -s GPT_SoVITS/prepare_datasets/3-get-semantic.py' % python_exec print(cmd) p = Popen(cmd, shell=True) ps1c.append(p) @@ -1158,7 +1164,7 @@ def open1abc( } ) os.environ.update(config) - cmd = '"%s" GPT_SoVITS/prepare_datasets/1-get-text.py' % python_exec + cmd = '"%s" -s GPT_SoVITS/prepare_datasets/1-get-text.py' % python_exec print(cmd) p = Popen(cmd, shell=True) ps1abc.append(p) @@ -1204,7 +1210,7 @@ def open1abc( } ) os.environ.update(config) - cmd = '"%s" GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py' % python_exec + cmd = '"%s" -s GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py' % python_exec print(cmd) p = Popen(cmd, shell=True) ps1abc.append(p) @@ -1244,7 +1250,7 @@ def open1abc( } ) os.environ.update(config) - cmd = '"%s" GPT_SoVITS/prepare_datasets/3-get-semantic.py' % python_exec + cmd = '"%s" -s GPT_SoVITS/prepare_datasets/3-get-semantic.py' % python_exec print(cmd) p = Popen(cmd, shell=True) ps1abc.append(p) @@ -1339,7 +1345,7 @@ def switch_version(version_): if os.path.exists("GPT_SoVITS/text/G2PWModel"): ... else: - cmd = '"%s" GPT_SoVITS/download.py' % python_exec + cmd = '"%s" -s GPT_SoVITS/download.py' % python_exec p = Popen(cmd, shell=True) p.wait() From 1aeca895d26574d3a9949d6244cec179fc19d415 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 9 May 2025 08:20:58 +0100 Subject: [PATCH 091/183] Fix Wrapper --- Docker/install_wrapper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docker/install_wrapper.sh b/Docker/install_wrapper.sh index f3860ffe..6dd93e5a 100644 --- a/Docker/install_wrapper.sh +++ b/Docker/install_wrapper.sh @@ -18,7 +18,7 @@ ln -s /workspace/models/pretrained_models /workspace/GPT-SoVITS/GPT_SoVITS/pretr ln -s /workspace/models/G2PWModel /workspace/GPT-SoVITS/GPT_SoVITS/text/G2PWModel -bash install.sh --device "CU${CUDA_VERSION}" --source HF +bash install.sh --device "CU${CUDA_VERSION//./}" --source HF pip cache purge From fcf16309b8c13c0702891abf17cdb30c7820e8a7 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 9 May 2025 10:02:39 +0100 Subject: [PATCH 092/183] Update install.sh For Robustness --- Docker/miniconda_install.sh | 8 +++---- install.sh | 43 ++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/Docker/miniconda_install.sh b/Docker/miniconda_install.sh index d626b3a1..36ca5c53 100644 --- a/Docker/miniconda_install.sh +++ b/Docker/miniconda_install.sh @@ -16,15 +16,15 @@ WORKFLOW=${WORKFLOW:-"false"} TARGETPLATFORM=${TARGETPLATFORM:-"linux/amd64"} if [ "$WORKFLOW" = "true" ]; then - WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" + WGET_CMD=(wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404) else - WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" + WGET_CMD=(wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404) fi if [ "$TARGETPLATFORM" = "linux/amd64" ]; then - eval "$WGET_CMD -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_25.3.1-1-Linux-x86_64.sh" + "${WGET_CMD[@]}" -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_25.3.1-1-Linux-x86_64.sh elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then - eval "$WGET_CMD -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_25.3.1-1-Linux-aarch64.sh" + "${WGET_CMD[@]}" -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_25.3.1-1-Linux-aarch64.sh else exit 1 fi diff --git a/install.sh b/install.sh index b03b8bfe..3a37538a 100644 --- a/install.sh +++ b/install.sh @@ -126,11 +126,13 @@ fi # 安装构建工具 # Install build tools if [ "$(uname)" != "Darwin" ]; then - echo "Installing GCC..." - conda install -c conda-forge gcc=14 -q -y - - echo "Installing G++..." - conda install -c conda-forge gxx -q -y + gcc_major_version=$(command -v gcc >/dev/null 2>&1 && gcc -dumpversion | cut -d. -f1 || echo 0) + if [ "$gcc_major_version" -lt 11 ]; then + echo "Installing GCC & G++..." + conda install -c conda-forge gcc=11 gxx=11 -q -y + else + echo "GCC >=11" + fi else if ! xcode-select -p &>/dev/null; then echo "Installing Xcode Command Line Tools..." @@ -179,30 +181,27 @@ elif [ "$USE_MODELSCOPE" = "true" ]; then fi if [ "$WORKFLOW" = "true" ]; then - WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" + WGET_CMD=(wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404) else - WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" + WGET_CMD=(wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404) fi if find -L "GPT_SoVITS/pretrained_models" -mindepth 1 ! -name '.gitignore' | grep -q .; then echo "Pretrained Model Exists" else echo "Download Pretrained Models" - $WGET_CMD "$PRETRINED_URL" + "${WGET_CMD[@]}" "$PRETRINED_URL" - unzip -q pretrained_models.zip + unzip -q -o pretrained_models.zip -d GPT_SoVITS rm -rf pretrained_models.zip - mv -f pretrained_models/* GPT_SoVITS/pretrained_models - rm -rf pretrained_models fi if [ ! -d "GPT_SoVITS/text/G2PWModel" ]; then echo "Download G2PWModel" - $WGET_CMD "$G2PW_URL" + "${WGET_CMD[@]}" "$G2PW_URL" - unzip -q G2PWModel.zip + unzip -q -o G2PWModel.zip -d GPT_SoVITS/text rm -rf G2PWModel.zip - mv -f G2PWModel GPT_SoVITS/text/G2PWModel else echo "G2PWModel Exists" fi @@ -212,12 +211,10 @@ if [ "$DOWNLOAD_UVR5" = "true" ]; then echo "UVR5 Model Exists" else echo "Download UVR5 Model" - $WGET_CMD "$UVR5_URL" + "${WGET_CMD[@]}" "$UVR5_URL" - unzip -q uvr5_weights.zip + unzip -q -o uvr5_weights.zip -d tools/uvr5 rm -rf uvr5_weights.zip - mv-f uvr5_weights/* tools/uvr5/uvr5_weights - rm -rf uvr5_weights fi fi @@ -281,15 +278,13 @@ pip install -r requirements.txt --quiet PY_PREFIX=$(python -c "import sys; print(sys.prefix)") PYOPENJTALK_PREFIX=$(python -c "import os, pyopenjtalk; print(os.path.dirname(pyopenjtalk.__file__))") -$WGET_CMD "$NLTK_URL" -unzip -q nltk_data +"${WGET_CMD[@]}" "$NLTK_URL" -O nltk_data.zip +unzip -q -o nltk_data -d "$PY_PREFIX" rm -rf nltk_data.zip -mv -f nltk_data "$PY_PREFIX" -$WGET_CMD "$PYOPENJTALK_URL" -tar -xvzf open_jtalk_dic_utf_8-1.11.tar.gz +"${WGET_CMD[@]}" "$PYOPENJTALK_URL" -O open_jtalk_dic_utf_8-1.11.tar.gz +tar -xvzf open_jtalk_dic_utf_8-1.11.tar.gz -C "$PYOPENJTALK_PREFIX" rm -rf open_jtalk_dic_utf_8-1.11.tar.gz -mv -f open_jtalk_dic_utf_8-1.11 "$PYOPENJTALK_PREFIX" if [ "$USE_ROCM" = true ] && [ "$IS_WSL" = true ]; then echo "Update to WSL compatible runtime lib..." From 5c4f9e8e00fe40f5b9b0a27e90f457d5e6bbc3b2 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 9 May 2025 10:06:19 +0100 Subject: [PATCH 093/183] Ignore .git --- .dockerignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.dockerignore b/.dockerignore index 8c73069b..bf36b884 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,6 +2,7 @@ GPT_SoVITS/pretrained_models/* tools/asr/models/* tools/uvr5/uvr5_weights/* +.git .DS_Store .vscode *.pyc From 8f76e196030b82b236cf1977087646aee99d7c14 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 9 May 2025 10:44:08 +0100 Subject: [PATCH 094/183] Preload CUDNN For Ctranslate2 --- tools/asr/fasterwhisper_asr.py | 3 +++ tools/my_utils.py | 47 ++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/tools/asr/fasterwhisper_asr.py b/tools/asr/fasterwhisper_asr.py index e570f174..27cabbc2 100644 --- a/tools/asr/fasterwhisper_asr.py +++ b/tools/asr/fasterwhisper_asr.py @@ -10,6 +10,7 @@ from faster_whisper import WhisperModel from tqdm import tqdm from tools.asr.config import check_fw_local_models +from tools.my_utils import load_cudnn # fmt: off language_code_list = [ @@ -93,6 +94,8 @@ def execute_asr(input_folder, output_folder, model_size, language, precision): return output_file_path +load_cudnn() + if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument( diff --git a/tools/my_utils.py b/tools/my_utils.py index 44d326e1..21fd55f8 100644 --- a/tools/my_utils.py +++ b/tools/my_utils.py @@ -1,11 +1,17 @@ +import ctypes +import glob import os +import sys import traceback +from pathlib import Path + import ffmpeg -import numpy as np import gradio as gr -from tools.i18n.i18n import I18nAuto +import numpy as np import pandas as pd +from tools.i18n.i18n import I18nAuto + i18n = I18nAuto(language=os.environ.get("language", "Auto")) @@ -127,3 +133,40 @@ def check_details(path_list=None, is_train=False, is_dataset_processing=False): ... else: gr.Warning(i18n("缺少语义数据集")) + + +def load_cudnn(): + import torch + + if not torch.cuda.is_available(): + print("[INFO] CUDA is not available, skipping cuDNN setup.") + return + + if sys.platform == "win32": + torch_lib_dir = Path(torch.__file__).parent / "lib" + if torch_lib_dir.exists(): + os.add_dll_directory(str(torch_lib_dir)) + print(f"[INFO] Added DLL directory: {torch_lib_dir}") + else: + print(f"[WARNING] Torch lib directory not found: {torch_lib_dir}") + + elif sys.platform == "linux": + site_packages = Path(torch.__file__).resolve().parents[1] + cudnn_dir = site_packages / "nvidia" / "cudnn" / "lib" + + if not cudnn_dir.exists(): + print(f"[ERROR] cudnn dir not found: {cudnn_dir}") + return + + pattern = str(cudnn_dir / "libcudnn_cnn*.so*") + matching_files = sorted(glob.glob(pattern)) + if not matching_files: + print(f"[ERROR] No libcudnn_cnn*.so* found in {cudnn_dir}") + return + + for so_path in matching_files: + try: + ctypes.CDLL(so_path, mode=ctypes.RTLD_GLOBAL) + print(f"[INFO] Loaded: {so_path}") + except OSError as e: + print(f"[WARNING] Failed to load {so_path}: {e}") From 16ce677c153384291a83bae221a79633d908f920 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 9 May 2025 10:52:59 +0100 Subject: [PATCH 095/183] Remove Gradio Warnings --- GPT_SoVITS/inference_webui.py | 24 ++++++++---------------- GPT_SoVITS/inference_webui_fast.py | 12 +++--------- tools/subfix_webui.py | 6 +++--- tools/uvr5/webui.py | 18 +++++++----------- webui.py | 2 +- 5 files changed, 22 insertions(+), 40 deletions(-) diff --git a/GPT_SoVITS/inference_webui.py b/GPT_SoVITS/inference_webui.py index 3e779344..46820145 100644 --- a/GPT_SoVITS/inference_webui.py +++ b/GPT_SoVITS/inference_webui.py @@ -7,11 +7,17 @@ 全部按日文识别 """ +import json import logging +import os +import re +import sys import traceback import warnings +import torch import torchaudio +from text.LangSegmenter import LangSegmenter logging.getLogger("markdown_it").setLevel(logging.ERROR) logging.getLogger("urllib3").setLevel(logging.ERROR) @@ -23,20 +29,6 @@ logging.getLogger("torchaudio._extension").setLevel(logging.ERROR) logging.getLogger("multipart.multipart").setLevel(logging.ERROR) warnings.simplefilter(action="ignore", category=FutureWarning) -import json -import os -import re -import sys - -import torch -from text.LangSegmenter import LangSegmenter - -try: - import gradio.analytics as analytics - - analytics.version_check = lambda: None -except: - ... version = model_version = os.environ.get("version", "v2") path_sovits_v3 = "GPT_SoVITS/pretrained_models/s2Gv3.pth" path_sovits_v4 = "GPT_SoVITS/pretrained_models/gsv-v4-pretrained/s2Gv4.pth" @@ -106,7 +98,7 @@ cnhubert.cnhubert_base_path = cnhubert_base_path import random -from GPT_SoVITS.module.models import SynthesizerTrn, SynthesizerTrnV3, Generator +from GPT_SoVITS.module.models import Generator, SynthesizerTrn, SynthesizerTrnV3 def set_seed(seed): @@ -1087,7 +1079,7 @@ def html_left(text, label="p"): """ -with gr.Blocks(title="GPT-SoVITS WebUI") as app: +with gr.Blocks(title="GPT-SoVITS WebUI", analytics_enabled=False) as app: gr.Markdown( value=i18n("本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责.") + "
" diff --git a/GPT_SoVITS/inference_webui_fast.py b/GPT_SoVITS/inference_webui_fast.py index 0b5cbd16..0b9525e8 100644 --- a/GPT_SoVITS/inference_webui_fast.py +++ b/GPT_SoVITS/inference_webui_fast.py @@ -14,6 +14,8 @@ import random import re import sys +import torch + now_dir = os.getcwd() sys.path.append(now_dir) sys.path.append("%s/GPT_SoVITS" % (now_dir)) @@ -25,14 +27,6 @@ logging.getLogger("httpx").setLevel(logging.ERROR) logging.getLogger("asyncio").setLevel(logging.ERROR) logging.getLogger("charset_normalizer").setLevel(logging.ERROR) logging.getLogger("torchaudio._extension").setLevel(logging.ERROR) -import torch - -try: - import gradio.analytics as analytics - - analytics.version_check = lambda: None -except: - ... infer_ttswebui = os.environ.get("infer_ttswebui", 9872) @@ -330,7 +324,7 @@ def change_sovits_weights(sovits_path, prompt_language=None, text_language=None) f.write(json.dumps(data)) -with gr.Blocks(title="GPT-SoVITS WebUI") as app: +with gr.Blocks(title="GPT-SoVITS WebUI", analytics_enabled=False) as app: gr.Markdown( value=i18n("本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责.") + "
" diff --git a/tools/subfix_webui.py b/tools/subfix_webui.py index eae1c980..4244449f 100644 --- a/tools/subfix_webui.py +++ b/tools/subfix_webui.py @@ -1,7 +1,7 @@ import argparse -import os import copy import json +import os import uuid try: @@ -11,8 +11,8 @@ try: except: ... -import librosa import gradio as gr +import librosa import numpy as np import soundfile @@ -303,7 +303,7 @@ if __name__ == "__main__": set_global(args.load_json, args.load_list, args.json_key_text, args.json_key_path, args.g_batch) - with gr.Blocks() as demo: + with gr.Blocks(analytics_enabled=False) as demo: with gr.Row(): btn_change_index = gr.Button("Change Index") btn_submit_change = gr.Button("Submit Text") diff --git a/tools/uvr5/webui.py b/tools/uvr5/webui.py index a3d7fe46..f5f8d3f6 100644 --- a/tools/uvr5/webui.py +++ b/tools/uvr5/webui.py @@ -1,26 +1,22 @@ +import logging import os import traceback + import gradio as gr -import logging + from tools.i18n.i18n import I18nAuto from tools.my_utils import clean_path i18n = I18nAuto() logger = logging.getLogger(__name__) +import sys + import ffmpeg import torch -import sys +from bsroformer import Roformer_Loader from mdxnet import MDXNetDereverb from vr import AudioPre, AudioPreDeEcho -from bsroformer import Roformer_Loader - -try: - import gradio.analytics as analytics - - analytics.version_check = lambda: None -except: - ... weight_uvr5_root = "tools/uvr5/uvr5_weights" uvr5_names = [] @@ -129,7 +125,7 @@ def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg, format yield "\n".join(infos) -with gr.Blocks(title="UVR5 WebUI") as app: +with gr.Blocks(title="UVR5 WebUI", analytics_enabled=False) as app: gr.Markdown( value=i18n("本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责.") + "
" diff --git a/webui.py b/webui.py index d8cd6843..43f33249 100644 --- a/webui.py +++ b/webui.py @@ -1354,7 +1354,7 @@ def sync(text): return {"__type__": "update", "value": text} -with gr.Blocks(title="GPT-SoVITS WebUI") as app: +with gr.Blocks(title="GPT-SoVITS WebUI", analytics_enabled=False) as app: gr.Markdown( value=i18n("本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责.") + "
" From 89f59cfceb5c7595200856973cb39ab2689663c0 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 9 May 2025 10:56:37 +0100 Subject: [PATCH 096/183] Update Colab --- Colab-Inference.ipynb | 7 +++++++ colab_webui.ipynb => Colab-WebUI.ipynb | 0 2 files changed, 7 insertions(+) rename colab_webui.ipynb => Colab-WebUI.ipynb (100%) diff --git a/Colab-Inference.ipynb b/Colab-Inference.ipynb index baf3baea..b565e4e1 100644 --- a/Colab-Inference.ipynb +++ b/Colab-Inference.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\"Open" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/colab_webui.ipynb b/Colab-WebUI.ipynb similarity index 100% rename from colab_webui.ipynb rename to Colab-WebUI.ipynb From f27822af40fabd47f4a9d78b6ade096e1f9996ba Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Fri, 9 May 2025 11:00:38 +0100 Subject: [PATCH 097/183] Fix OpenCC Problems --- Colab-WebUI.ipynb | 2 +- GPT_SoVITS/text/g2pw/onnx_api.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Colab-WebUI.ipynb b/Colab-WebUI.ipynb index 69f1561b..a127bd6d 100644 --- a/Colab-WebUI.ipynb +++ b/Colab-WebUI.ipynb @@ -7,7 +7,7 @@ "id": "view-in-github" }, "source": [ - "\"Open" + "\"Open" ] }, { diff --git a/GPT_SoVITS/text/g2pw/onnx_api.py b/GPT_SoVITS/text/g2pw/onnx_api.py index bf3109e7..de7b9ff3 100644 --- a/GPT_SoVITS/text/g2pw/onnx_api.py +++ b/GPT_SoVITS/text/g2pw/onnx_api.py @@ -1,20 +1,22 @@ # This code is modified from https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/paddlespeech/t2s/frontend/g2pw # This code is modified from https://github.com/GitYCC/g2pW -import warnings - -warnings.filterwarnings("ignore") import json import os +import warnings import zipfile from typing import Any, Dict, List, Tuple +from opencc import OpenCC + +warnings.filterwarnings("ignore") + + import numpy as np import onnxruntime import requests onnxruntime.set_default_logger_severity(3) -from opencc import OpenCC from pypinyin import Style, pinyin from transformers import AutoTokenizer From 5d8d9e3232c6206842b2f6ccf4ed0ae682eaf75d Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sat, 10 May 2025 02:17:58 +0100 Subject: [PATCH 098/183] Update Win DLL Strategy --- tools/my_utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/my_utils.py b/tools/my_utils.py index 21fd55f8..03a0b66a 100644 --- a/tools/my_utils.py +++ b/tools/my_utils.py @@ -147,6 +147,18 @@ def load_cudnn(): if torch_lib_dir.exists(): os.add_dll_directory(str(torch_lib_dir)) print(f"[INFO] Added DLL directory: {torch_lib_dir}") + pattern = str(torch_lib_dir / "cudnn_cnn*.so*") + matching_files = sorted(glob.glob(pattern)) + if not matching_files: + print(f"[ERROR] No cudnn_cnn*.dll found in {torch_lib_dir}") + return + for dll_path in matching_files: + dll_name = os.path.basename(dll_path) + try: + ctypes.CDLL(dll_name) + print(f"[INFO] Loaded: {dll_name}") + except OSError as e: + print(f"[WARNING] Failed to load {dll_name}: {e}") else: print(f"[WARNING] Torch lib directory not found: {torch_lib_dir}") From d5e3dbf09f382bf501ad65304457820ebb2ef805 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 08:01:10 +0100 Subject: [PATCH 099/183] Fix Onnxruntime-gpu NVRTC Error --- GPT_SoVITS/text/g2pw/onnx_api.py | 1 + tools/my_utils.py | 51 +++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/GPT_SoVITS/text/g2pw/onnx_api.py b/GPT_SoVITS/text/g2pw/onnx_api.py index de7b9ff3..a9b596b5 100644 --- a/GPT_SoVITS/text/g2pw/onnx_api.py +++ b/GPT_SoVITS/text/g2pw/onnx_api.py @@ -17,6 +17,7 @@ import onnxruntime import requests onnxruntime.set_default_logger_severity(3) +onnxruntime.preload_dlls() from pypinyin import Style, pinyin from transformers import AutoTokenizer diff --git a/tools/my_utils.py b/tools/my_utils.py index 03a0b66a..c54d432d 100644 --- a/tools/my_utils.py +++ b/tools/my_utils.py @@ -147,7 +147,7 @@ def load_cudnn(): if torch_lib_dir.exists(): os.add_dll_directory(str(torch_lib_dir)) print(f"[INFO] Added DLL directory: {torch_lib_dir}") - pattern = str(torch_lib_dir / "cudnn_cnn*.so*") + pattern = str(torch_lib_dir / "cudnn_cnn*.dll") matching_files = sorted(glob.glob(pattern)) if not matching_files: print(f"[ERROR] No cudnn_cnn*.dll found in {torch_lib_dir}") @@ -182,3 +182,52 @@ def load_cudnn(): print(f"[INFO] Loaded: {so_path}") except OSError as e: print(f"[WARNING] Failed to load {so_path}: {e}") + + +def load_nvrtc(): + import torch + + if not torch.cuda.is_available(): + print("[INFO] CUDA is not available, skipping nvrtc setup.") + return + + if sys.platform == "win32": + torch_lib_dir = Path(torch.__file__).parent / "lib" + if torch_lib_dir.exists(): + os.add_dll_directory(str(torch_lib_dir)) + print(f"[INFO] Added DLL directory: {torch_lib_dir}") + pattern = str(torch_lib_dir / "nvrtc*.dll") + matching_files = sorted(glob.glob(pattern)) + if not matching_files: + print(f"[ERROR] No nvrtc*.dll found in {torch_lib_dir}") + return + for dll_path in matching_files: + dll_name = os.path.basename(dll_path) + try: + ctypes.CDLL(dll_name) + print(f"[INFO] Loaded: {dll_name}") + except OSError as e: + print(f"[WARNING] Failed to load {dll_name}: {e}") + else: + print(f"[WARNING] Torch lib directory not found: {torch_lib_dir}") + + elif sys.platform == "linux": + site_packages = Path(torch.__file__).resolve().parents[1] + nvrtc_dir = site_packages / "nvidia" / "cuda_nvrtc" / "lib" + + if not nvrtc_dir.exists(): + print(f"[ERROR] nvrtc dir not found: {nvrtc_dir}") + return + + pattern = str(nvrtc_dir / "libnvrtc*.so*") + matching_files = sorted(glob.glob(pattern)) + if not matching_files: + print(f"[ERROR] No libnvrtc*.so* found in {nvrtc_dir}") + return + + for so_path in matching_files: + try: + ctypes.CDLL(so_path, mode=ctypes.RTLD_GLOBAL) + print(f"[INFO] Loaded: {so_path}") + except OSError as e: + print(f"[WARNING] Failed to load {so_path}: {e}") From 0d30e2d1879abcf4c783e196f9f002a78af9405e Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 10:03:43 +0100 Subject: [PATCH 100/183] Fix Path Problems --- tools/my_utils.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tools/my_utils.py b/tools/my_utils.py index c54d432d..7f70db26 100644 --- a/tools/my_utils.py +++ b/tools/my_utils.py @@ -147,8 +147,7 @@ def load_cudnn(): if torch_lib_dir.exists(): os.add_dll_directory(str(torch_lib_dir)) print(f"[INFO] Added DLL directory: {torch_lib_dir}") - pattern = str(torch_lib_dir / "cudnn_cnn*.dll") - matching_files = sorted(glob.glob(pattern)) + matching_files = sorted(torch_lib_dir.glob("cudnn_cnn*.dll")) if not matching_files: print(f"[ERROR] No cudnn_cnn*.dll found in {torch_lib_dir}") return @@ -170,15 +169,14 @@ def load_cudnn(): print(f"[ERROR] cudnn dir not found: {cudnn_dir}") return - pattern = str(cudnn_dir / "libcudnn_cnn*.so*") - matching_files = sorted(glob.glob(pattern)) + matching_files = sorted(cudnn_dir.glob("libcudnn_cnn*.so*")) if not matching_files: print(f"[ERROR] No libcudnn_cnn*.so* found in {cudnn_dir}") return for so_path in matching_files: try: - ctypes.CDLL(so_path, mode=ctypes.RTLD_GLOBAL) + ctypes.CDLL(so_path, mode=ctypes.RTLD_GLOBAL) # type: ignore print(f"[INFO] Loaded: {so_path}") except OSError as e: print(f"[WARNING] Failed to load {so_path}: {e}") @@ -196,8 +194,7 @@ def load_nvrtc(): if torch_lib_dir.exists(): os.add_dll_directory(str(torch_lib_dir)) print(f"[INFO] Added DLL directory: {torch_lib_dir}") - pattern = str(torch_lib_dir / "nvrtc*.dll") - matching_files = sorted(glob.glob(pattern)) + matching_files = sorted(torch_lib_dir.glob("nvrtc*.dll")) if not matching_files: print(f"[ERROR] No nvrtc*.dll found in {torch_lib_dir}") return @@ -219,15 +216,14 @@ def load_nvrtc(): print(f"[ERROR] nvrtc dir not found: {nvrtc_dir}") return - pattern = str(nvrtc_dir / "libnvrtc*.so*") - matching_files = sorted(glob.glob(pattern)) + matching_files = sorted(nvrtc_dir.glob("libnvrtc*.so*")) if not matching_files: print(f"[ERROR] No libnvrtc*.so* found in {nvrtc_dir}") return for so_path in matching_files: try: - ctypes.CDLL(so_path, mode=ctypes.RTLD_GLOBAL) + ctypes.CDLL(so_path, mode=ctypes.RTLD_GLOBAL) # type: ignore print(f"[INFO] Loaded: {so_path}") except OSError as e: print(f"[WARNING] Failed to load {so_path}: {e}") From b3ca7754d6a7c7360271b0af0c1c9dc07423d66c Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 17:39:46 +0100 Subject: [PATCH 101/183] Add Windows Packages Workflow --- .github/build_windows_packages.ps1 | 90 +++++++++++++++++++ .github/workflows/build_windows_packages.yaml | 23 +++++ 2 files changed, 113 insertions(+) create mode 100644 .github/build_windows_packages.ps1 create mode 100644 .github/workflows/build_windows_packages.yaml diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 new file mode 100644 index 00000000..87eca0b9 --- /dev/null +++ b/.github/build_windows_packages.ps1 @@ -0,0 +1,90 @@ +$ErrorActionPreference = "Stop" + +$today = Get-Date -Format "MMdd" +$cuda = $env:TORCH_CUDA +if (-not $cuda) { + Write-Error "Missing TORCH_CUDA env (e.g., cu124 or cu128)" + exit 1 +} +$pkgName = "GPT-SoVITS-$today-$cuda" +$tmpDir = "tmp" +$srcDir = $PWD + +Write-Host "[INFO] Cleaning .git..." +Remove-Item "$srcDir\.git" -Recurse -Force -ErrorAction SilentlyContinue + +Write-Host "[INFO] Creating tmp dir..." +New-Item -ItemType Directory -Force -Path $tmpDir | Out-Null + +$baseHF = "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main" +$PRETRAINED_URL = "$baseHF/pretrained_models.zip" +$G2PW_URL = "$baseHF/G2PWModel.zip" +$UVR5_URL = "$baseHF/uvr5_weights.zip" + +function DownloadAndUnzip($url, $targetRelPath) { + $filename = Split-Path $url -Leaf + $tmpZip = "$tmpDir\$filename" + Invoke-WebRequest $url -OutFile $tmpZip + Expand-Archive -Path $tmpZip -DestinationPath $tmpDir -Force + Move-Item "$tmpDir\$($filename -replace '\.zip$', '')" "$srcDir\$targetRelPath" -Force + Remove-Item $tmpZip +} + +Write-Host "[INFO] Download pretrained_models..." +DownloadAndUnzip $PRETRAINED_URL "GPT_SoVITS\pretrained_models" + +Write-Host "[INFO] Download G2PWModel..." +DownloadAndUnzip $G2PW_URL "GPT_SoVITS\text\G2PWModel" + +Write-Host "[INFO] Download UVR5 model..." +DownloadAndUnzip $UVR5_URL "tools\uvr5\uvr5_weights" + +Write-Host "[INFO] Download ffmpeg..." +$ffUrl = "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip" +$ffZip = "$tmpDir\ffmpeg.zip" +Invoke-WebRequest -Uri $ffUrl -OutFile $ffZip +Expand-Archive $ffZip -DestinationPath $tmpDir -Force +$ffDir = Get-ChildItem -Directory "$tmpDir" | Where-Object { $_.Name -like "ffmpeg*" } | Select-Object -First 1 +Move-Item "$($ffDir.FullName)\bin\ffmpeg.exe" "$srcDir" +Move-Item "$($ffDir.FullName)\bin\ffprobe.exe" "$srcDir" +Remove-Item $ffZip +Remove-Item $ffDir.FullName -Recurse -Force + +Write-Host "[INFO] Downloading Python..." +$pyUrl = "https://github.com/astral-sh/python-build-standalone/releases/download/20250409/cpython-3.11.12+20250409-x86_64-pc-windows-msvc-pgo-full.tar.zst" +$zst = "$tmpDir\python.tar.zst" +Invoke-WebRequest $pyUrl -OutFile $zst +& "C:\Program Files\7-Zip\7z.exe" e $zst -o$tmpDir -aoa | Out-Null +$tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 +& "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o$tmpDir\extracted -aoa | Out-Null +Move-Item "$tmpDir\extracted\install" "$srcDir\runtime" + +Write-Host "[INFO] Installing PyTorch..." +$torchCmd = switch ($cuda) { + "cu124" { "pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124" } + "cu128" { "pip install torch==2.7.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/cu128" } + default { Write-Error "Unsupported CUDA version: $cuda"; exit 1 } +} +& ".\runtime\python.exe" -m ensurepip +& ".\runtime\python.exe" -c "$torchCmd" + +Write-Host "[INFO] Installing dependencies..." +& ".\runtime\python.exe" -m pip install -r extra-req.txt --no-deps +& ".\runtime\python.exe" -m pip install -r requirements.txt +& ".\runtime\python.exe" -c "import nltk; nltk.download(['averaged_perceptron_tagger','averaged_perceptron_tagger_eng','cmudict'])" + +Write-Host "[INFO] Preparing final directory..." +$finalDir = "..\$pkgName" +Move-Item $srcDir $finalDir -Force +Compress-Archive -Path "$finalDir\*" -DestinationPath "$pkgName.zip" -Force + +$msUser = $env:MODELSCOPE_USERNAME +$msToken = $env:MODELSCOPE_TOKEN +if (-not $msUser -or -not $msToken) { + Write-Error "Missing MODELSCOPE_USERNAME or MODELSCOPE_TOKEN" + exit 1 +} +modelscope login --token $msToken +modelscope upload "$msUser/GPT-SoVITS-Packages" "$pkgName.zip" "data/$pkgName.zip" --repo-type model + +Write-Host "[SUCCESS] Uploaded: $pkgName.zip" \ No newline at end of file diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml new file mode 100644 index 00000000..c2bd115d --- /dev/null +++ b/.github/workflows/build_windows_packages.yaml @@ -0,0 +1,23 @@ +name: Build and Upload Windows Package + +on: + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + strategy: + matrix: + torch_cuda: [cu124, cu128] + env: + TORCH_CUDA: ${{ matrix.torch_cuda }} + MODELSCOPE_USERNAME: ${{ secrets.MODELSCOPE_USERNAME }} + MODELSCOPE_TOKEN: ${{ secrets.MODELSCOPE_TOKEN }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run Build and Upload Script + shell: pwsh + run: ./build-and-upload.ps1 \ No newline at end of file From c27d18dd2313d19f1da0854ce3f4e5ef03ba0ce1 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 17:40:37 +0100 Subject: [PATCH 102/183] WIP --- .github/workflows/build_windows_packages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index c2bd115d..0fa7515d 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -20,4 +20,4 @@ jobs: - name: Run Build and Upload Script shell: pwsh - run: ./build-and-upload.ps1 \ No newline at end of file + run: ./github/build-and-upload.ps1 \ No newline at end of file From a49d0e2d3c41ffe9980bae45db647bb93cc96417 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 17:51:06 +0100 Subject: [PATCH 103/183] WIP --- .github/build_windows_packages.ps1 | 7 +++++++ .github/workflows/build_windows_packages.yaml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 87eca0b9..eaa6eca1 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -39,6 +39,13 @@ DownloadAndUnzip $G2PW_URL "GPT_SoVITS\text\G2PWModel" Write-Host "[INFO] Download UVR5 model..." DownloadAndUnzip $UVR5_URL "tools\uvr5\uvr5_weights" +Write-Host "[INFO] Downloading funasr..." +$funasrUrl = "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/funasr.zip" +$funasrZip = "$tmpDir\funasr.zip" +Invoke-WebRequest -Uri $funasrUrl -OutFile $funasrZip +Expand-Archive -Path $funasrZip -DestinationPath "$srcDir\tools\asr\models" -Force +Remove-Item $funasrZip + Write-Host "[INFO] Download ffmpeg..." $ffUrl = "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip" $ffZip = "$tmpDir\ffmpeg.zip" diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index 0fa7515d..f0d6d2a7 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -20,4 +20,4 @@ jobs: - name: Run Build and Upload Script shell: pwsh - run: ./github/build-and-upload.ps1 \ No newline at end of file + run: ./github/build_windows_packages \ No newline at end of file From afa3fac51127858df20c2a155a005333f17765b9 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 17:52:31 +0100 Subject: [PATCH 104/183] WIP --- .github/workflows/build_windows_packages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index f0d6d2a7..9a0824a9 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -20,4 +20,4 @@ jobs: - name: Run Build and Upload Script shell: pwsh - run: ./github/build_windows_packages \ No newline at end of file + run: ./github/build_windows_packages.ps1 \ No newline at end of file From 3b079939623b5c17d1f630060f63a87f80a9ebee Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 17:53:56 +0100 Subject: [PATCH 105/183] WIP --- .github/workflows/build_windows_packages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index 9a0824a9..5b034b23 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -20,4 +20,4 @@ jobs: - name: Run Build and Upload Script shell: pwsh - run: ./github/build_windows_packages.ps1 \ No newline at end of file + run: .github/build_windows_packages.ps1 \ No newline at end of file From d21a853e74ca9db2e871fb646a82e6ff4414d038 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 18:04:18 +0100 Subject: [PATCH 106/183] WIP --- .github/build_windows_packages.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index eaa6eca1..d8abf347 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -61,10 +61,12 @@ Write-Host "[INFO] Downloading Python..." $pyUrl = "https://github.com/astral-sh/python-build-standalone/releases/download/20250409/cpython-3.11.12+20250409-x86_64-pc-windows-msvc-pgo-full.tar.zst" $zst = "$tmpDir\python.tar.zst" Invoke-WebRequest $pyUrl -OutFile $zst +Get-ChildItem +Get-ChildItem $tmpDir & "C:\Program Files\7-Zip\7z.exe" e $zst -o$tmpDir -aoa | Out-Null $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 & "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o$tmpDir\extracted -aoa | Out-Null -Move-Item "$tmpDir\extracted\install" "$srcDir\runtime" +Move-Item "$tmpDir\extracted\python\install" "$srcDir\runtime" Write-Host "[INFO] Installing PyTorch..." $torchCmd = switch ($cuda) { From 9f092b70f0fd2332b943faefa4d0d56d1ad928c1 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 18:09:32 +0100 Subject: [PATCH 107/183] WIP --- .github/build_windows_packages.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index d8abf347..0e7af41c 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -64,7 +64,9 @@ Invoke-WebRequest $pyUrl -OutFile $zst Get-ChildItem Get-ChildItem $tmpDir & "C:\Program Files\7-Zip\7z.exe" e $zst -o$tmpDir -aoa | Out-Null +Get-ChildItem $tmpDir $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 +Get-ChildItem $tmpDir & "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o$tmpDir\extracted -aoa | Out-Null Move-Item "$tmpDir\extracted\python\install" "$srcDir\runtime" From bf4ca1602e08658f37bb122f5795e1aaeeb3feb7 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 18:12:23 +0100 Subject: [PATCH 108/183] . --- .github/build_windows_packages.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 0e7af41c..57a40742 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -65,6 +65,7 @@ Get-ChildItem Get-ChildItem $tmpDir & "C:\Program Files\7-Zip\7z.exe" e $zst -o$tmpDir -aoa | Out-Null Get-ChildItem $tmpDir +Write-Host "11111" $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 Get-ChildItem $tmpDir & "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o$tmpDir\extracted -aoa | Out-Null From 74c7e723c2cd86834c243718ee769edd34172f65 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 18:15:24 +0100 Subject: [PATCH 109/183] WIP --- .github/build_windows_packages.ps1 | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 57a40742..8bc20d6b 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -16,6 +16,23 @@ Remove-Item "$srcDir\.git" -Recurse -Force -ErrorAction SilentlyContinue Write-Host "[INFO] Creating tmp dir..." New-Item -ItemType Directory -Force -Path $tmpDir | Out-Null +Write-Host "[INFO] Downloading Python..." +$pyUrl = "https://github.com/astral-sh/python-build-standalone/releases/download/20250409/cpython-3.11.12+20250409-x86_64-pc-windows-msvc-pgo-full.tar.zst" +$zst = "$tmpDir\python.tar.zst" +Invoke-WebRequest $pyUrl -OutFile $zst +Get-ChildItem +Get-ChildItem $tmpDir +Write-Host "0000" +& "C:\Program Files\7-Zip\7z.exe" e $zst -o$tmpDir -aoa | Out-Null +Get-ChildItem $tmpDir +Write-Host "11111" +$tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 +Get-ChildItem $tmpDir +Write-Host "222222" +& "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o$tmpDir\extracted -aoa | Out-Null +Get-ChildItem $tmpDir +Move-Item "$tmpDir\extracted\python\install" "$srcDir\runtime" + $baseHF = "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main" $PRETRAINED_URL = "$baseHF/pretrained_models.zip" $G2PW_URL = "$baseHF/G2PWModel.zip" @@ -57,20 +74,6 @@ Move-Item "$($ffDir.FullName)\bin\ffprobe.exe" "$srcDir" Remove-Item $ffZip Remove-Item $ffDir.FullName -Recurse -Force -Write-Host "[INFO] Downloading Python..." -$pyUrl = "https://github.com/astral-sh/python-build-standalone/releases/download/20250409/cpython-3.11.12+20250409-x86_64-pc-windows-msvc-pgo-full.tar.zst" -$zst = "$tmpDir\python.tar.zst" -Invoke-WebRequest $pyUrl -OutFile $zst -Get-ChildItem -Get-ChildItem $tmpDir -& "C:\Program Files\7-Zip\7z.exe" e $zst -o$tmpDir -aoa | Out-Null -Get-ChildItem $tmpDir -Write-Host "11111" -$tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 -Get-ChildItem $tmpDir -& "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o$tmpDir\extracted -aoa | Out-Null -Move-Item "$tmpDir\extracted\python\install" "$srcDir\runtime" - Write-Host "[INFO] Installing PyTorch..." $torchCmd = switch ($cuda) { "cu124" { "pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124" } From 896169769aae24f922c5f70a8ce7356a2a50a2b6 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 18:18:55 +0100 Subject: [PATCH 110/183] WIP --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 8bc20d6b..9e3f8a4b 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -23,7 +23,7 @@ Invoke-WebRequest $pyUrl -OutFile $zst Get-ChildItem Get-ChildItem $tmpDir Write-Host "0000" -& "C:\Program Files\7-Zip\7z.exe" e $zst -o$tmpDir -aoa | Out-Null +& "C:\Program Files\7-Zip\7z.exe" e $zst -o$tmpDir -aoa Get-ChildItem $tmpDir Write-Host "11111" $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 From 659bd1b79040b1a393788c7b3bd1151a2307a8fb Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 18:22:31 +0100 Subject: [PATCH 111/183] WIP --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 9e3f8a4b..c34457d7 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -23,7 +23,7 @@ Invoke-WebRequest $pyUrl -OutFile $zst Get-ChildItem Get-ChildItem $tmpDir Write-Host "0000" -& "C:\Program Files\7-Zip\7z.exe" e $zst -o$tmpDir -aoa +Start-Process -FilePath "C:\Program Files\7-Zip\7z.exe" -ArgumentList "e `"$zst`" -aoa" -WorkingDirectory $tmpDir -Wait Get-ChildItem $tmpDir Write-Host "11111" $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 From 72bfa6291aa198305c7a80bcd4227dd91cfc9f2d Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 18:23:51 +0100 Subject: [PATCH 112/183] WIP --- .github/build_windows_packages.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index c34457d7..304e65e1 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -23,7 +23,9 @@ Invoke-WebRequest $pyUrl -OutFile $zst Get-ChildItem Get-ChildItem $tmpDir Write-Host "0000" -Start-Process -FilePath "C:\Program Files\7-Zip\7z.exe" -ArgumentList "e `"$zst`" -aoa" -WorkingDirectory $tmpDir -Wait +Push-Location $tmpDir +& "C:\Program Files\7-Zip\7z.exe" e $zst -aoa +Pop-Location Get-ChildItem $tmpDir Write-Host "11111" $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 From 81f224dee7fd96f374407f6025a4a9bd007a5b40 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 18:29:47 +0100 Subject: [PATCH 113/183] WIP --- .github/build_windows_packages.ps1 | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 304e65e1..6d99fbd1 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -17,21 +17,17 @@ Write-Host "[INFO] Creating tmp dir..." New-Item -ItemType Directory -Force -Path $tmpDir | Out-Null Write-Host "[INFO] Downloading Python..." -$pyUrl = "https://github.com/astral-sh/python-build-standalone/releases/download/20250409/cpython-3.11.12+20250409-x86_64-pc-windows-msvc-pgo-full.tar.zst" $zst = "$tmpDir\python.tar.zst" -Invoke-WebRequest $pyUrl -OutFile $zst -Get-ChildItem +Invoke-WebRequest "https://github.com/astral-sh/python-build-standalone/releases/download/20250409/cpython-3.11.12+20250409-x86_64-pc-windows-msvc-pgo-full.tar.zst" -OutFile $zst + +Write-Host "1111" Get-ChildItem $tmpDir -Write-Host "0000" -Push-Location $tmpDir -& "C:\Program Files\7-Zip\7z.exe" e $zst -aoa -Pop-Location +& "C:\Program Files\7-Zip\7z.exe" e $zst -o"$tmpDir" -aoa +Write-Host "2222" Get-ChildItem $tmpDir -Write-Host "11111" $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 -Get-ChildItem $tmpDir -Write-Host "222222" -& "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o$tmpDir\extracted -aoa | Out-Null +& "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o"$tmpDir\extracted" -aoa +Write-Host "3333" Get-ChildItem $tmpDir Move-Item "$tmpDir\extracted\python\install" "$srcDir\runtime" From be6732b769b01e47ddbe8858fb0596513be00688 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 18:41:45 +0100 Subject: [PATCH 114/183] WIP --- .github/build_windows_packages.ps1 | 48 +++++++++++++++++++----------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 6d99fbd1..fd99137a 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -10,6 +10,13 @@ $pkgName = "GPT-SoVITS-$today-$cuda" $tmpDir = "tmp" $srcDir = $PWD +$baseHF = "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main" +$PRETRAINED_URL = "$baseHF/pretrained_models.zip" +$G2PW_URL = "$baseHF/G2PWModel.zip" +$UVR5_URL = "$baseHF/uvr5_weights.zip" +$NLTK_URL = "$baseHF/nltk_data.zip" +$JTALK_URL = "$baseHF/open_jtalk_dic_utf_8-1.11.tar.gz" + Write-Host "[INFO] Cleaning .git..." Remove-Item "$srcDir\.git" -Recurse -Force -ErrorAction SilentlyContinue @@ -19,23 +26,11 @@ New-Item -ItemType Directory -Force -Path $tmpDir | Out-Null Write-Host "[INFO] Downloading Python..." $zst = "$tmpDir\python.tar.zst" Invoke-WebRequest "https://github.com/astral-sh/python-build-standalone/releases/download/20250409/cpython-3.11.12+20250409-x86_64-pc-windows-msvc-pgo-full.tar.zst" -OutFile $zst - -Write-Host "1111" -Get-ChildItem $tmpDir & "C:\Program Files\7-Zip\7z.exe" e $zst -o"$tmpDir" -aoa -Write-Host "2222" -Get-ChildItem $tmpDir $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 & "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o"$tmpDir\extracted" -aoa -Write-Host "3333" -Get-ChildItem $tmpDir Move-Item "$tmpDir\extracted\python\install" "$srcDir\runtime" -$baseHF = "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main" -$PRETRAINED_URL = "$baseHF/pretrained_models.zip" -$G2PW_URL = "$baseHF/G2PWModel.zip" -$UVR5_URL = "$baseHF/uvr5_weights.zip" - function DownloadAndUnzip($url, $targetRelPath) { $filename = Split-Path $url -Leaf $tmpZip = "$tmpDir\$filename" @@ -82,14 +77,31 @@ $torchCmd = switch ($cuda) { & ".\runtime\python.exe" -c "$torchCmd" Write-Host "[INFO] Installing dependencies..." -& ".\runtime\python.exe" -m pip install -r extra-req.txt --no-deps -& ".\runtime\python.exe" -m pip install -r requirements.txt -& ".\runtime\python.exe" -c "import nltk; nltk.download(['averaged_perceptron_tagger','averaged_perceptron_tagger_eng','cmudict'])" +& ".\runtime\python.exe" -m pip install -r extra-req.txt --no-deps --no-warn-script-location +& ".\runtime\python.exe" -m pip install -r requirements.txt --no-warn-script-location + +Write-Host "[INFO] Downloading NLTK and pyopenjtalk dictionary..." +$PYTHON = ".\runtime\python.exe" +$prefix = & $PYTHON -c "import sys; print(sys.prefix)" +$jtalkPath = & $PYTHON -c "import os, pyopenjtalk; print(os.path.dirname(pyopenjtalk.__file__))" +$nltkZip = "$tmpDir\nltk_data.zip" +$jtalkTar = "$tmpDir\open_jtalk_dic_utf_8-1.11.tar.gz" + +Invoke-WebRequest -Uri $NLTK_URL -OutFile $nltkZip +Expand-Archive -Path $nltkZip -DestinationPath $prefix -Force +Remove-Item $nltkZip + +Invoke-WebRequest -Uri $JTALK_URL -OutFile $jtalkTar +& "C:\Program Files\7-Zip\7z.exe" x $jtalkTar -o$tmpDir\jtalk -aoa +$innerTar = Get-ChildItem "$tmpDir\jtalk" -Filter "*.tar" | Select-Object -First 1 +& "C:\Program Files\7-Zip\7z.exe" x $innerTar.FullName -o"$jtalkPath" -aoa + +Remove-Item $jtalkTar +Remove-Item "$tmpDir\jtalk" -Recurse -Force Write-Host "[INFO] Preparing final directory..." -$finalDir = "..\$pkgName" -Move-Item $srcDir $finalDir -Force -Compress-Archive -Path "$finalDir\*" -DestinationPath "$pkgName.zip" -Force +Copy-Item "$srcDir\*" -Destination $pkgName -Recurse -Force +Compress-Archive -Path "$pkgName\*" -DestinationPath "$pkgName.zip" -Force $msUser = $env:MODELSCOPE_USERNAME $msToken = $env:MODELSCOPE_TOKEN From 0429c5487727d06e42496f22bc5069b83217b3db Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 18:48:31 +0100 Subject: [PATCH 115/183] WIP --- .github/build_windows_packages.ps1 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index fd99137a..d366c7b7 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -68,13 +68,19 @@ Remove-Item $ffZip Remove-Item $ffDir.FullName -Recurse -Force Write-Host "[INFO] Installing PyTorch..." -$torchCmd = switch ($cuda) { - "cu124" { "pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124" } - "cu128" { "pip install torch==2.7.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/cu128" } - default { Write-Error "Unsupported CUDA version: $cuda"; exit 1 } -} & ".\runtime\python.exe" -m ensurepip -& ".\runtime\python.exe" -c "$torchCmd" +switch ($cuda) { + "cu124" { + & ".\runtime\python.exe" -m pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 + } + "cu128" { + & ".\runtime\python.exe" -m pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128 + } + default { + Write-Error "Unsupported CUDA version: $cuda" + exit 1 + } +} Write-Host "[INFO] Installing dependencies..." & ".\runtime\python.exe" -m pip install -r extra-req.txt --no-deps --no-warn-script-location From e1cfd460f985ff202f536196a84193c9e14ccd1b Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Mon, 12 May 2025 19:00:27 +0100 Subject: [PATCH 116/183] WIP --- .github/build_windows_packages.ps1 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index d366c7b7..9801d30a 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -21,7 +21,7 @@ Write-Host "[INFO] Cleaning .git..." Remove-Item "$srcDir\.git" -Recurse -Force -ErrorAction SilentlyContinue Write-Host "[INFO] Creating tmp dir..." -New-Item -ItemType Directory -Force -Path $tmpDir | Out-Null +New-Item -ItemType Directory -Force -Path $tmpDir Write-Host "[INFO] Downloading Python..." $zst = "$tmpDir\python.tar.zst" @@ -98,12 +98,11 @@ Expand-Archive -Path $nltkZip -DestinationPath $prefix -Force Remove-Item $nltkZip Invoke-WebRequest -Uri $JTALK_URL -OutFile $jtalkTar -& "C:\Program Files\7-Zip\7z.exe" x $jtalkTar -o$tmpDir\jtalk -aoa -$innerTar = Get-ChildItem "$tmpDir\jtalk" -Filter "*.tar" | Select-Object -First 1 +& "C:\Program Files\7-Zip\7z.exe" e $jtalkTar -o"$tmpDir" -aoa +$innerTar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 & "C:\Program Files\7-Zip\7z.exe" x $innerTar.FullName -o"$jtalkPath" -aoa - Remove-Item $jtalkTar -Remove-Item "$tmpDir\jtalk" -Recurse -Force +Remove-Item $innerTar.FullName Write-Host "[INFO] Preparing final directory..." Copy-Item "$srcDir\*" -Destination $pkgName -Recurse -Force From 590691aa10e475e674e665c6feec23cfce848004 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 13 May 2025 21:48:49 +0100 Subject: [PATCH 117/183] WIP --- .github/build_windows_packages.ps1 | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 9801d30a..a3244e2e 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -17,15 +17,22 @@ $UVR5_URL = "$baseHF/uvr5_weights.zip" $NLTK_URL = "$baseHF/nltk_data.zip" $JTALK_URL = "$baseHF/open_jtalk_dic_utf_8-1.11.tar.gz" +$PYTHON_VERSION = 3.11.12 +$RELEASE_VERSION = 20250409 + Write-Host "[INFO] Cleaning .git..." Remove-Item "$srcDir\.git" -Recurse -Force -ErrorAction SilentlyContinue Write-Host "[INFO] Creating tmp dir..." New-Item -ItemType Directory -Force -Path $tmpDir -Write-Host "[INFO] Downloading Python..." +Write-Host "[INFO] System Python version:" +python --version +python -m site + +Write-Host "[INFO] Downloading Python $PYTHON_VERSION..." $zst = "$tmpDir\python.tar.zst" -Invoke-WebRequest "https://github.com/astral-sh/python-build-standalone/releases/download/20250409/cpython-3.11.12+20250409-x86_64-pc-windows-msvc-pgo-full.tar.zst" -OutFile $zst +Invoke-WebRequest "https://github.com/astral-sh/python-build-standalone/releases/download/$RELEASE_VERSION/cpython-$PYTHON_VERSION+$RELEASE_VERSION-x86_64-pc-windows-msvc-pgo-full.tar.zst" -OutFile $zst & "C:\Program Files\7-Zip\7z.exe" e $zst -o"$tmpDir" -aoa $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 & "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o"$tmpDir\extracted" -aoa @@ -104,16 +111,21 @@ $innerTar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 Remove-Item $jtalkTar Remove-Item $innerTar.FullName -Write-Host "[INFO] Preparing final directory..." +Write-Host "[INFO] Preparing final directory... $pkgName" +Get-ChildItem ../ +Remove-Item $pkgName -Force -Recurse -ErrorAction SilentlyContinue Copy-Item "$srcDir\*" -Destination $pkgName -Recurse -Force Compress-Archive -Path "$pkgName\*" -DestinationPath "$pkgName.zip" -Force +Write-Host "[INFO] Uploading to ModelScope..." $msUser = $env:MODELSCOPE_USERNAME $msToken = $env:MODELSCOPE_TOKEN if (-not $msUser -or -not $msToken) { Write-Error "Missing MODELSCOPE_USERNAME or MODELSCOPE_TOKEN" exit 1 } +python -m pip install --upgrade pip +python -m pip install modelscope modelscope login --token $msToken modelscope upload "$msUser/GPT-SoVITS-Packages" "$pkgName.zip" "data/$pkgName.zip" --repo-type model From fb4e182b87029c2281282c04d7845b379063654a Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 13 May 2025 21:53:01 +0100 Subject: [PATCH 118/183] WIP --- .github/build_windows_packages.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index a3244e2e..8b92a41e 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -17,8 +17,8 @@ $UVR5_URL = "$baseHF/uvr5_weights.zip" $NLTK_URL = "$baseHF/nltk_data.zip" $JTALK_URL = "$baseHF/open_jtalk_dic_utf_8-1.11.tar.gz" -$PYTHON_VERSION = 3.11.12 -$RELEASE_VERSION = 20250409 +$PYTHON_VERSION = "3.11.12" +$RELEASE_VERSION = "20250409" Write-Host "[INFO] Cleaning .git..." Remove-Item "$srcDir\.git" -Recurse -Force -ErrorAction SilentlyContinue From aa88ece558db7b51a29d5406bfe7200b8d470378 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 13 May 2025 22:07:33 +0100 Subject: [PATCH 119/183] WIP --- .github/build_windows_packages.ps1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 8b92a41e..11d167d4 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -113,9 +113,13 @@ Remove-Item $innerTar.FullName Write-Host "[INFO] Preparing final directory... $pkgName" Get-ChildItem ../ -Remove-Item $pkgName -Force -Recurse -ErrorAction SilentlyContinue -Copy-Item "$srcDir\*" -Destination $pkgName -Recurse -Force -Compress-Archive -Path "$pkgName\*" -DestinationPath "$pkgName.zip" -Force +Get-ChildItem . +Remove-Item "$tmpDir" -Force -Recurse -ErrorAction SilentlyContinue +New-Item -ItemType Directory -Force -Path ../$pkgName +Copy-Item "$srcDir\*" -Destination ../$pkgName -Recurse -Force +Set-Location ../ +Get-ChildItem . +Compress-Archive -Path "$pkgName" -DestinationPath "$pkgName.zip" -Force Write-Host "[INFO] Uploading to ModelScope..." $msUser = $env:MODELSCOPE_USERNAME @@ -125,7 +129,7 @@ if (-not $msUser -or -not $msToken) { exit 1 } python -m pip install --upgrade pip -python -m pip install modelscope +python -m pip install modelscope --no-warn-script-location. modelscope login --token $msToken modelscope upload "$msUser/GPT-SoVITS-Packages" "$pkgName.zip" "data/$pkgName.zip" --repo-type model From e40a9c2a2ded600f2545dfee6604c688ff30306b Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 13 May 2025 22:26:36 +0100 Subject: [PATCH 120/183] WIP --- .github/build_windows_packages.ps1 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 11d167d4..5fb1c4a6 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -76,12 +76,13 @@ Remove-Item $ffDir.FullName -Recurse -Force Write-Host "[INFO] Installing PyTorch..." & ".\runtime\python.exe" -m ensurepip +& ".\runtime\python.exe" -m pip install --upgrade pip switch ($cuda) { "cu124" { - & ".\runtime\python.exe" -m pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 + & ".\runtime\python.exe" -m pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 --no-warn-script-location } "cu128" { - & ".\runtime\python.exe" -m pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128 + & ".\runtime\python.exe" -m pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128 --no-warn-script-location } default { Write-Error "Unsupported CUDA version: $cuda" @@ -113,13 +114,15 @@ Remove-Item $innerTar.FullName Write-Host "[INFO] Preparing final directory... $pkgName" Get-ChildItem ../ +Write-Host "000" Get-ChildItem . Remove-Item "$tmpDir" -Force -Recurse -ErrorAction SilentlyContinue New-Item -ItemType Directory -Force -Path ../$pkgName Copy-Item "$srcDir\*" -Destination ../$pkgName -Recurse -Force Set-Location ../ +Write-Host "111" Get-ChildItem . -Compress-Archive -Path "$pkgName" -DestinationPath "$pkgName.zip" -Force +& "C:\Program Files\7-Zip\7z.exe" a -tzip "$zipPath" "$pkgName\*" -mx=5 -bsp1 Write-Host "[INFO] Uploading to ModelScope..." $msUser = $env:MODELSCOPE_USERNAME @@ -129,7 +132,7 @@ if (-not $msUser -or -not $msToken) { exit 1 } python -m pip install --upgrade pip -python -m pip install modelscope --no-warn-script-location. +python -m pip install modelscope --no-warn-script-location modelscope login --token $msToken modelscope upload "$msUser/GPT-SoVITS-Packages" "$pkgName.zip" "data/$pkgName.zip" --repo-type model From 1855bfd008acd64b6eaeee9d5619d85b59a41c7a Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 13 May 2025 22:41:41 +0100 Subject: [PATCH 121/183] WIP --- .github/build_windows_packages.ps1 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 5fb1c4a6..3d960667 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -76,7 +76,7 @@ Remove-Item $ffDir.FullName -Recurse -Force Write-Host "[INFO] Installing PyTorch..." & ".\runtime\python.exe" -m ensurepip -& ".\runtime\python.exe" -m pip install --upgrade pip +& ".\runtime\python.exe" -m pip install --upgrade pip --no-warn-script-location switch ($cuda) { "cu124" { & ".\runtime\python.exe" -m pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 --no-warn-script-location @@ -112,17 +112,13 @@ $innerTar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 Remove-Item $jtalkTar Remove-Item $innerTar.FullName -Write-Host "[INFO] Preparing final directory... $pkgName" -Get-ChildItem ../ -Write-Host "000" -Get-ChildItem . +Write-Host "[INFO] Preparing final directory $pkgName ..." Remove-Item "$tmpDir" -Force -Recurse -ErrorAction SilentlyContinue -New-Item -ItemType Directory -Force -Path ../$pkgName -Copy-Item "$srcDir\*" -Destination ../$pkgName -Recurse -Force +$curr = Get-Location Set-Location ../ -Write-Host "111" Get-ChildItem . -& "C:\Program Files\7-Zip\7z.exe" a -tzip "$zipPath" "$pkgName\*" -mx=5 -bsp1 +Rename-Item -Path $curr -NewName $pkgName +& "C:\Program Files\7-Zip\7z.exe" a -tzip "$zipPath" "$pkgName" -mx=5 -bsp1 Write-Host "[INFO] Uploading to ModelScope..." $msUser = $env:MODELSCOPE_USERNAME @@ -133,7 +129,6 @@ if (-not $msUser -or -not $msToken) { } python -m pip install --upgrade pip python -m pip install modelscope --no-warn-script-location -modelscope login --token $msToken -modelscope upload "$msUser/GPT-SoVITS-Packages" "$pkgName.zip" "data/$pkgName.zip" --repo-type model +modelscope upload "$msUser/GPT-SoVITS-Packages" "$pkgName.zip" "$pkgName.zip" --repo-type model --token $msToken Write-Host "[SUCCESS] Uploaded: $pkgName.zip" \ No newline at end of file From 2a1ae4c3d0df739bd2a1b02e3df1f8af8ae8bb13 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 13 May 2025 23:00:50 +0100 Subject: [PATCH 122/183] WIP --- .github/build_windows_packages.ps1 | 5 +++-- .github/workflows/build_windows_packages.yaml | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 3d960667..02af31fa 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -112,8 +112,9 @@ $innerTar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 Remove-Item $jtalkTar Remove-Item $innerTar.FullName -Write-Host "[INFO] Preparing final directory $pkgName ..." -Remove-Item "$tmpDir" -Force -Recurse -ErrorAction SilentlyContinue +Write-Host "[INFO] Preparing final directory $pkgName ..."、 +$items = @(Get-ChildItem -Filter "*.ipynb", Get-ChildItem -Filter "*.sh", "$tmpDir", ".github", "Docker", "docs", ".gitignore", ".dockerignore", "README.md") +Remove-Item $items -Force -Recurse -ErrorAction SilentlyContinue $curr = Get-Location Set-Location ../ Get-ChildItem . diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index 5b034b23..822e645c 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -20,4 +20,6 @@ jobs: - name: Run Build and Upload Script shell: pwsh - run: .github/build_windows_packages.ps1 \ No newline at end of file + run: | + Move-Item .github/build_windows_packages.ps1 ../build_windows_packages.ps1 + ../build_windows_packages.ps1 \ No newline at end of file From a682d3ece92eb8816480dd39a38b28fe54b04f28 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Tue, 13 May 2025 23:11:57 +0100 Subject: [PATCH 123/183] WIP --- .github/build_windows_packages.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 02af31fa..1a7ba3b5 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -112,8 +112,10 @@ $innerTar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 Remove-Item $jtalkTar Remove-Item $innerTar.FullName -Write-Host "[INFO] Preparing final directory $pkgName ..."、 -$items = @(Get-ChildItem -Filter "*.ipynb", Get-ChildItem -Filter "*.sh", "$tmpDir", ".github", "Docker", "docs", ".gitignore", ".dockerignore", "README.md") +Write-Host "[INFO] Preparing final directory $pkgName ..." +$items = @(Get-ChildItem -Filter "*.sh") + + @(Get-ChildItem -Filter "*.ipynb") + + @("$tmpDir", ".github", "Docker", "docs", ".gitignore", ".dockerignore", "README.md") Remove-Item $items -Force -Recurse -ErrorAction SilentlyContinue $curr = Get-Location Set-Location ../ From 7787b5760e65f61c28a8b99f38e14887f12c87e4 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 01:15:47 +0100 Subject: [PATCH 124/183] WIP --- .github/build_windows_packages.ps1 | 3 +++ .github/workflows/build_windows_packages.yaml | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 1a7ba3b5..b63d4d52 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -1,5 +1,8 @@ $ErrorActionPreference = "Stop" +$workDir = $env:WORK_DIR +Set-Location $workDir + $today = Get-Date -Format "MMdd" $cuda = $env:TORCH_CUDA if (-not $cuda) { diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index 822e645c..adf8476b 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -21,5 +21,8 @@ jobs: - name: Run Build and Upload Script shell: pwsh run: | + $curr = Get-Location + echo "WORK_DIR=$curr" >> $env:GITHUB_ENV Move-Item .github/build_windows_packages.ps1 ../build_windows_packages.ps1 - ../build_windows_packages.ps1 \ No newline at end of file + Set-Location ../ + build_windows_packages.ps1 \ No newline at end of file From 71ddf1b56c54fd93f92aa1e0cc6d00607a3c8c53 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 01:55:07 +0100 Subject: [PATCH 125/183] WIP --- .github/build_windows_packages.ps1 | 33 +++++++++++++++---- .github/workflows/build_windows_packages.yaml | 8 +++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index b63d4d52..4258673d 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -6,13 +6,19 @@ Set-Location $workDir $today = Get-Date -Format "MMdd" $cuda = $env:TORCH_CUDA if (-not $cuda) { - Write-Error "Missing TORCH_CUDA env (e.g., cu124 or cu128)" + Write-Error "Missing TORCH_CUDA env (cu124 or cu128)" exit 1 } -$pkgName = "GPT-SoVITS-$today-$cuda" +$pkgName = "GPT-SoVITS-$today" $tmpDir = "tmp" $srcDir = $PWD +if ($suffix -and $suffix.Trim() -ne "") { + $pkgName = "$pkgName$suffix" +} + +$pkgName = "$pkgName-$cuda" + $baseHF = "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main" $PRETRAINED_URL = "$baseHF/pretrained_models.zip" $G2PW_URL = "$baseHF/G2PWModel.zip" @@ -21,7 +27,7 @@ $NLTK_URL = "$baseHF/nltk_data.zip" $JTALK_URL = "$baseHF/open_jtalk_dic_utf_8-1.11.tar.gz" $PYTHON_VERSION = "3.11.12" -$RELEASE_VERSION = "20250409" +$PY_RELEASE_VERSION = "20250409" Write-Host "[INFO] Cleaning .git..." Remove-Item "$srcDir\.git" -Recurse -Force -ErrorAction SilentlyContinue @@ -35,7 +41,7 @@ python -m site Write-Host "[INFO] Downloading Python $PYTHON_VERSION..." $zst = "$tmpDir\python.tar.zst" -Invoke-WebRequest "https://github.com/astral-sh/python-build-standalone/releases/download/$RELEASE_VERSION/cpython-$PYTHON_VERSION+$RELEASE_VERSION-x86_64-pc-windows-msvc-pgo-full.tar.zst" -OutFile $zst +Invoke-WebRequest "https://github.com/astral-sh/python-build-standalone/releases/download/$PY_RELEASE_VERSION/cpython-$PYTHON_VERSION+$PY_RELEASE_VERSION-x86_64-pc-windows-msvc-pgo-full.tar.zst" -OutFile $zst & "C:\Program Files\7-Zip\7z.exe" e $zst -o"$tmpDir" -aoa $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 & "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o"$tmpDir\extracted" -aoa @@ -126,6 +132,9 @@ Get-ChildItem . Rename-Item -Path $curr -NewName $pkgName & "C:\Program Files\7-Zip\7z.exe" a -tzip "$zipPath" "$pkgName" -mx=5 -bsp1 +python -m pip install --upgrade pip +python -m pip install "modelscope" "huggingface_hub[hf_transfer]" --no-warn-script-location + Write-Host "[INFO] Uploading to ModelScope..." $msUser = $env:MODELSCOPE_USERNAME $msToken = $env:MODELSCOPE_TOKEN @@ -133,8 +142,18 @@ if (-not $msUser -or -not $msToken) { Write-Error "Missing MODELSCOPE_USERNAME or MODELSCOPE_TOKEN" exit 1 } -python -m pip install --upgrade pip -python -m pip install modelscope --no-warn-script-location modelscope upload "$msUser/GPT-SoVITS-Packages" "$pkgName.zip" "$pkgName.zip" --repo-type model --token $msToken -Write-Host "[SUCCESS] Uploaded: $pkgName.zip" \ No newline at end of file +Write-Host "[SUCCESS] Uploaded: $pkgName.zip to ModelScope" + +Write-Host "[INFO] Uploading to HuggingFace..." +$hfUser = $env:HUGGINGFACE_USERNAME +$hfToken = $env:HUGGINGFACE_TOKEN +if (-not $hfUser -or -not $hfToken) { + Write-Error "Missing HUGGINGFACE_USERNAME or HUGGINGFACE_TOKEN" + exit 1 +} +$env:HF_HUB_ENABLE_HF_TRANSFER = "1" +huggingface-cli upload "$hfUser/GPT-SoVITS-Packages" "$pkgName.zip" "$pkgName.zip" --repo-type model --token $hfToken + +Write-Host "[SUCCESS] Uploaded: $pkgName.zip to HuggingFace" \ No newline at end of file diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index adf8476b..c87eebaa 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -2,6 +2,11 @@ name: Build and Upload Windows Package on: workflow_dispatch: + inputs: + suffix: + description: "Package name suffix (optional)" + required: false + default: "" jobs: build: @@ -13,6 +18,9 @@ jobs: TORCH_CUDA: ${{ matrix.torch_cuda }} MODELSCOPE_USERNAME: ${{ secrets.MODELSCOPE_USERNAME }} MODELSCOPE_TOKEN: ${{ secrets.MODELSCOPE_TOKEN }} + HUGGINGFACE_USERNAME: ${{ secrets.HUGGINGFACE_USERNAME }} + HUGGINGFACE_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }} + PKG_SUFFIX: ${{ github.event.inputs.suffix }} steps: - name: Checkout From 2f17eea541b17329548fdc8d43796d1cf9e81a7b Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 01:58:36 +0100 Subject: [PATCH 126/183] WIP --- .github/workflows/build_windows_packages.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index c87eebaa..7c12b39d 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -33,4 +33,5 @@ jobs: echo "WORK_DIR=$curr" >> $env:GITHUB_ENV Move-Item .github/build_windows_packages.ps1 ../build_windows_packages.ps1 Set-Location ../ - build_windows_packages.ps1 \ No newline at end of file + Get-ChildItem . + ./build_windows_packages.ps1 \ No newline at end of file From 6bc8f86befe6d88165d4711c7926a2b587d55027 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 02:05:19 +0100 Subject: [PATCH 127/183] WIP --- .github/build_windows_packages.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 4258673d..de7ded50 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -2,6 +2,7 @@ $ErrorActionPreference = "Stop" $workDir = $env:WORK_DIR Set-Location $workDir +Get-ChildItem . $today = Get-Date -Format "MMdd" $cuda = $env:TORCH_CUDA @@ -52,6 +53,9 @@ function DownloadAndUnzip($url, $targetRelPath) { $tmpZip = "$tmpDir\$filename" Invoke-WebRequest $url -OutFile $tmpZip Expand-Archive -Path $tmpZip -DestinationPath $tmpDir -Force + Get-ChildItem . + Write-Host "$tmpDir\$($filename -replace '\.zip$', '')" + Write-Host "$srcDir\$targetRelPath" Move-Item "$tmpDir\$($filename -replace '\.zip$', '')" "$srcDir\$targetRelPath" -Force Remove-Item $tmpZip } From 582bd3adb6061822da8a109a0f05b2cb14fc03c9 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 02:11:36 +0100 Subject: [PATCH 128/183] WIP --- .github/build_windows_packages.ps1 | 11 +++++++++-- .github/workflows/build_windows_packages.yaml | 6 ++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index de7ded50..7bd36f8f 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -4,16 +4,23 @@ $workDir = $env:WORK_DIR Set-Location $workDir Get-ChildItem . -$today = Get-Date -Format "MMdd" + $cuda = $env:TORCH_CUDA if (-not $cuda) { Write-Error "Missing TORCH_CUDA env (cu124 or cu128)" exit 1 } -$pkgName = "GPT-SoVITS-$today" + +$date = $env:DATE_SUFFIX +if ($date -and $date.Trim() -ne "") { + $date = Get-Date -Format "MMdd" +} +$pkgName = "GPT-SoVITS-$date" $tmpDir = "tmp" $srcDir = $PWD +Write-Host $srcDir +$suffix = $env:PKG_SUFFIX if ($suffix -and $suffix.Trim() -ne "") { $pkgName = "$pkgName$suffix" } diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index 7c12b39d..ff04d46f 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -3,6 +3,10 @@ name: Build and Upload Windows Package on: workflow_dispatch: inputs: + date: + description: "Date suffix (optional)" + required: false + default: "" suffix: description: "Package name suffix (optional)" required: false @@ -20,6 +24,7 @@ jobs: MODELSCOPE_TOKEN: ${{ secrets.MODELSCOPE_TOKEN }} HUGGINGFACE_USERNAME: ${{ secrets.HUGGINGFACE_USERNAME }} HUGGINGFACE_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }} + DATE_SUFFIX: ${{ github.event.inputs.suffix }} PKG_SUFFIX: ${{ github.event.inputs.suffix }} steps: @@ -30,6 +35,7 @@ jobs: shell: pwsh run: | $curr = Get-Location + echo $curr echo "WORK_DIR=$curr" >> $env:GITHUB_ENV Move-Item .github/build_windows_packages.ps1 ../build_windows_packages.ps1 Set-Location ../ From 8b865bf872132aa96a70381b8b220577ebc58967 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 02:16:15 +0100 Subject: [PATCH 129/183] WIP --- .github/build_windows_packages.ps1 | 2 +- .github/workflows/build_windows_packages.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 7bd36f8f..44b89b70 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -18,7 +18,7 @@ if ($date -and $date.Trim() -ne "") { $pkgName = "GPT-SoVITS-$date" $tmpDir = "tmp" $srcDir = $PWD -Write-Host $srcDir +Write-Host "111$srcDir" $suffix = $env:PKG_SUFFIX if ($suffix -and $suffix.Trim() -ne "") { diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index ff04d46f..54b8d845 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -35,7 +35,7 @@ jobs: shell: pwsh run: | $curr = Get-Location - echo $curr + Write-Host "222$curr" echo "WORK_DIR=$curr" >> $env:GITHUB_ENV Move-Item .github/build_windows_packages.ps1 ../build_windows_packages.ps1 Set-Location ../ From 6e39b8994d9641a0d402635502fd03c07eec919f Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 02:19:12 +0100 Subject: [PATCH 130/183] WIP --- .github/build_windows_packages.ps1 | 3 +-- .github/workflows/build_windows_packages.yaml | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 44b89b70..33b6e289 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -17,8 +17,7 @@ if ($date -and $date.Trim() -ne "") { } $pkgName = "GPT-SoVITS-$date" $tmpDir = "tmp" -$srcDir = $PWD -Write-Host "111$srcDir" +$srcDir = $workDir $suffix = $env:PKG_SUFFIX if ($suffix -and $suffix.Trim() -ne "") { diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index 54b8d845..567ca52a 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -35,7 +35,6 @@ jobs: shell: pwsh run: | $curr = Get-Location - Write-Host "222$curr" echo "WORK_DIR=$curr" >> $env:GITHUB_ENV Move-Item .github/build_windows_packages.ps1 ../build_windows_packages.ps1 Set-Location ../ From 669fd7d56e8f937c106b50183454a48cf57af734 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 02:21:29 +0100 Subject: [PATCH 131/183] WIP --- .github/build_windows_packages.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 33b6e289..f133d1bc 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -18,6 +18,7 @@ if ($date -and $date.Trim() -ne "") { $pkgName = "GPT-SoVITS-$date" $tmpDir = "tmp" $srcDir = $workDir +Write-Host "111$workDir" $suffix = $env:PKG_SUFFIX if ($suffix -and $suffix.Trim() -ne "") { From 3ac3fffa75e24372cbcc76799b2b80cdb94fe5f2 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 02:25:23 +0100 Subject: [PATCH 132/183] WIP --- .github/build_windows_packages.ps1 | 3 --- .github/workflows/build_windows_packages.yaml | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index f133d1bc..ad87dcf3 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -18,7 +18,6 @@ if ($date -and $date.Trim() -ne "") { $pkgName = "GPT-SoVITS-$date" $tmpDir = "tmp" $srcDir = $workDir -Write-Host "111$workDir" $suffix = $env:PKG_SUFFIX if ($suffix -and $suffix.Trim() -ne "") { @@ -61,8 +60,6 @@ function DownloadAndUnzip($url, $targetRelPath) { Invoke-WebRequest $url -OutFile $tmpZip Expand-Archive -Path $tmpZip -DestinationPath $tmpDir -Force Get-ChildItem . - Write-Host "$tmpDir\$($filename -replace '\.zip$', '')" - Write-Host "$srcDir\$targetRelPath" Move-Item "$tmpDir\$($filename -replace '\.zip$', '')" "$srcDir\$targetRelPath" -Force Remove-Item $tmpZip } diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index 567ca52a..f348facc 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -35,8 +35,7 @@ jobs: shell: pwsh run: | $curr = Get-Location - echo "WORK_DIR=$curr" >> $env:GITHUB_ENV Move-Item .github/build_windows_packages.ps1 ../build_windows_packages.ps1 Set-Location ../ Get-ChildItem . - ./build_windows_packages.ps1 \ No newline at end of file + pwsh -Command "& { $env:workDir='$curr'; ./build_windows_packages.ps1 }" \ No newline at end of file From 9f85dace34ec75c6c0153ebaabae46396f2b20d9 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 02:28:47 +0100 Subject: [PATCH 133/183] WIP --- .github/build_windows_packages.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index ad87dcf3..64cdca7a 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -1,6 +1,7 @@ $ErrorActionPreference = "Stop" $workDir = $env:WORK_DIR +Write-Host "111$workDir" Set-Location $workDir Get-ChildItem . From 97fcd86003b93a3290163764ec8c738a589324a8 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 02:31:12 +0100 Subject: [PATCH 134/183] WIP --- .github/build_windows_packages.ps1 | 1 - .github/workflows/build_windows_packages.yaml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 64cdca7a..ad87dcf3 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -1,7 +1,6 @@ $ErrorActionPreference = "Stop" $workDir = $env:WORK_DIR -Write-Host "111$workDir" Set-Location $workDir Get-ChildItem . diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index f348facc..a7910e11 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -38,4 +38,4 @@ jobs: Move-Item .github/build_windows_packages.ps1 ../build_windows_packages.ps1 Set-Location ../ Get-ChildItem . - pwsh -Command "& { $env:workDir='$curr'; ./build_windows_packages.ps1 }" \ No newline at end of file + pwsh -Command "./build_windows_packages.ps1" -env:workDir="$curr" \ No newline at end of file From 356d3d33ccb4bedf48fe4664d35861eaeeffa182 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 02:41:27 +0100 Subject: [PATCH 135/183] WIP --- .github/workflows/build_windows_packages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index a7910e11..498080b7 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -38,4 +38,4 @@ jobs: Move-Item .github/build_windows_packages.ps1 ../build_windows_packages.ps1 Set-Location ../ Get-ChildItem . - pwsh -Command "./build_windows_packages.ps1" -env:workDir="$curr" \ No newline at end of file + pwsh -Command "& { \$env:workDir='$curr'; ./build_windows_packages.ps1 }" \ No newline at end of file From 3549d357c19ad62afdec753eab2af7200e38329c Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 02:47:36 +0100 Subject: [PATCH 136/183] WIP --- .github/build_windows_packages.ps1 | 9 ++++++--- .github/workflows/build_windows_packages.yaml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index ad87dcf3..f16d6887 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -1,9 +1,12 @@ $ErrorActionPreference = "Stop" -$workDir = $env:WORK_DIR -Set-Location $workDir -Get-ChildItem . +param ( + [string]$workDir +) +Set-Location -Path $workDir +Write-Host "Current location: $(Get-Location)" +Get-ChildItem . $cuda = $env:TORCH_CUDA if (-not $cuda) { diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index 498080b7..7e99b0be 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -38,4 +38,4 @@ jobs: Move-Item .github/build_windows_packages.ps1 ../build_windows_packages.ps1 Set-Location ../ Get-ChildItem . - pwsh -Command "& { \$env:workDir='$curr'; ./build_windows_packages.ps1 }" \ No newline at end of file + ./build_windows_packages.ps1 -workDir $curr.Path \ No newline at end of file From aa665c40f908c3085d8939d910756f1ffb7b5091 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 02:51:14 +0100 Subject: [PATCH 137/183] WIP --- .github/build_windows_packages.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index f16d6887..f3470817 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -1,9 +1,9 @@ -$ErrorActionPreference = "Stop" - param ( [string]$workDir ) +$ErrorActionPreference = "Stop" + Set-Location -Path $workDir Write-Host "Current location: $(Get-Location)" Get-ChildItem . From 141195edcabf7dd13fbeba7d3c031fa863b32782 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 03:07:17 +0100 Subject: [PATCH 138/183] WIP --- .github/build_windows_packages.ps1 | 8 +------- .github/workflows/build_windows_packages.yaml | 5 +---- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index f3470817..71094532 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -1,12 +1,6 @@ -param ( - [string]$workDir -) - $ErrorActionPreference = "Stop" -Set-Location -Path $workDir Write-Host "Current location: $(Get-Location)" -Get-ChildItem . $cuda = $env:TORCH_CUDA if (-not $cuda) { @@ -140,7 +134,7 @@ Remove-Item $items -Force -Recurse -ErrorAction SilentlyContinue $curr = Get-Location Set-Location ../ Get-ChildItem . -Rename-Item -Path $curr -NewName $pkgName +Copy-Item -Path $curr -Destination $pkgName -Recurse & "C:\Program Files\7-Zip\7z.exe" a -tzip "$zipPath" "$pkgName" -mx=5 -bsp1 python -m pip install --upgrade pip diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index 7e99b0be..da106fb7 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -34,8 +34,5 @@ jobs: - name: Run Build and Upload Script shell: pwsh run: | - $curr = Get-Location Move-Item .github/build_windows_packages.ps1 ../build_windows_packages.ps1 - Set-Location ../ - Get-ChildItem . - ./build_windows_packages.ps1 -workDir $curr.Path \ No newline at end of file + ../build_windows_packages.ps1 \ No newline at end of file From 35e4cd1ad8d4612d0a756aaac2592dc2a688b943 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 03:12:38 +0100 Subject: [PATCH 139/183] WIP --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 71094532..8c34c19a 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -14,7 +14,7 @@ if ($date -and $date.Trim() -ne "") { } $pkgName = "GPT-SoVITS-$date" $tmpDir = "tmp" -$srcDir = $workDir +$srcDir = $PWD $suffix = $env:PKG_SUFFIX if ($suffix -and $suffix.Trim() -ne "") { From c5b4026b86323576b1d693cdb35630ffece84f25 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 03:15:14 +0100 Subject: [PATCH 140/183] WIP --- .github/build_windows_packages.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 8c34c19a..68c5d10c 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -136,6 +136,7 @@ Set-Location ../ Get-ChildItem . Copy-Item -Path $curr -Destination $pkgName -Recurse & "C:\Program Files\7-Zip\7z.exe" a -tzip "$zipPath" "$pkgName" -mx=5 -bsp1 +Get-ChildItem . python -m pip install --upgrade pip python -m pip install "modelscope" "huggingface_hub[hf_transfer]" --no-warn-script-location From 0bc50761f0b6de3f49202c8e78470205de3de691 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 03:28:04 +0100 Subject: [PATCH 141/183] WIP --- .github/build_windows_packages.ps1 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 68c5d10c..ee1dc229 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -135,7 +135,8 @@ $curr = Get-Location Set-Location ../ Get-ChildItem . Copy-Item -Path $curr -Destination $pkgName -Recurse -& "C:\Program Files\7-Zip\7z.exe" a -tzip "$zipPath" "$pkgName" -mx=5 -bsp1 +$7zPath = "$pkgName.7z" +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -mx=5 -bsp1 Get-ChildItem . python -m pip install --upgrade pip @@ -148,9 +149,9 @@ if (-not $msUser -or -not $msToken) { Write-Error "Missing MODELSCOPE_USERNAME or MODELSCOPE_TOKEN" exit 1 } -modelscope upload "$msUser/GPT-SoVITS-Packages" "$pkgName.zip" "$pkgName.zip" --repo-type model --token $msToken +modelscope upload "$msUser/GPT-SoVITS-Packages" "$7zPath" "$7zPath" --repo-type model --token $msToken -Write-Host "[SUCCESS] Uploaded: $pkgName.zip to ModelScope" +Write-Host "[SUCCESS] Uploaded: $7zPath to ModelScope" Write-Host "[INFO] Uploading to HuggingFace..." $hfUser = $env:HUGGINGFACE_USERNAME @@ -160,6 +161,6 @@ if (-not $hfUser -or -not $hfToken) { exit 1 } $env:HF_HUB_ENABLE_HF_TRANSFER = "1" -huggingface-cli upload "$hfUser/GPT-SoVITS-Packages" "$pkgName.zip" "$pkgName.zip" --repo-type model --token $hfToken +huggingface-cli upload "$hfUser/GPT-SoVITS-Packages" "$7zPath" "$7zPath" --repo-type model --token $hfToken -Write-Host "[SUCCESS] Uploaded: $pkgName.zip to HuggingFace" \ No newline at end of file +Write-Host "[SUCCESS] Uploaded: $7zPath to HuggingFace" \ No newline at end of file From 27534d9bc29398753bbd3b4f8b763d4fe8b7ea7f Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 03:59:49 +0100 Subject: [PATCH 142/183] WIP --- .github/build_windows_packages.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index ee1dc229..b5300834 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -9,8 +9,10 @@ if (-not $cuda) { } $date = $env:DATE_SUFFIX +Write-Host "111 $date" if ($date -and $date.Trim() -ne "") { $date = Get-Date -Format "MMdd" + Write-Host "222 $date" } $pkgName = "GPT-SoVITS-$date" $tmpDir = "tmp" From 9c3fccd4e033a7c114228538d84ed412de2bde1d Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 04:03:05 +0100 Subject: [PATCH 143/183] WIP --- .github/build_windows_packages.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index b5300834..bf9e2f06 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -15,6 +15,7 @@ if ($date -and $date.Trim() -ne "") { Write-Host "222 $date" } $pkgName = "GPT-SoVITS-$date" +Write-Host $pkgName $tmpDir = "tmp" $srcDir = $PWD @@ -24,6 +25,7 @@ if ($suffix -and $suffix.Trim() -ne "") { } $pkgName = "$pkgName-$cuda" +Write-Host $pkgName $baseHF = "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main" $PRETRAINED_URL = "$baseHF/pretrained_models.zip" From 023eef1c9d89c1693690439d86db93e154d814aa Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 04:12:05 +0100 Subject: [PATCH 144/183] WIP --- .github/build_windows_packages.ps1 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index bf9e2f06..e6102f07 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -9,18 +9,17 @@ if (-not $cuda) { } $date = $env:DATE_SUFFIX -Write-Host "111 $date" -if ($date -and $date.Trim() -ne "") { +if ([string]::IsNullOrWhiteSpace($date)) { $date = Get-Date -Format "MMdd" - Write-Host "222 $date" } + $pkgName = "GPT-SoVITS-$date" Write-Host $pkgName $tmpDir = "tmp" $srcDir = $PWD $suffix = $env:PKG_SUFFIX -if ($suffix -and $suffix.Trim() -ne "") { +if (-not [string]::IsNullOrWhiteSpace($suffix)) { $pkgName = "$pkgName$suffix" } From 47f4e52bafc989f232cda1792927120aeda1923c Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 04:15:07 +0100 Subject: [PATCH 145/183] WIP --- .github/build_windows_packages.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index e6102f07..3aa8bb90 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -14,7 +14,6 @@ if ([string]::IsNullOrWhiteSpace($date)) { } $pkgName = "GPT-SoVITS-$date" -Write-Host $pkgName $tmpDir = "tmp" $srcDir = $PWD @@ -24,7 +23,6 @@ if (-not [string]::IsNullOrWhiteSpace($suffix)) { } $pkgName = "$pkgName-$cuda" -Write-Host $pkgName $baseHF = "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main" $PRETRAINED_URL = "$baseHF/pretrained_models.zip" From 4b3b90280e94be8d7a1b76f50c127006cef4e27f Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 06:31:56 +0100 Subject: [PATCH 146/183] Fix Path --- .github/build_windows_packages.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 3aa8bb90..d51fac33 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -63,13 +63,13 @@ function DownloadAndUnzip($url, $targetRelPath) { } Write-Host "[INFO] Download pretrained_models..." -DownloadAndUnzip $PRETRAINED_URL "GPT_SoVITS\pretrained_models" +DownloadAndUnzip $PRETRAINED_URL "GPT_SoVITS" Write-Host "[INFO] Download G2PWModel..." -DownloadAndUnzip $G2PW_URL "GPT_SoVITS\text\G2PWModel" +DownloadAndUnzip $G2PW_URL "GPT_SoVITS\text" Write-Host "[INFO] Download UVR5 model..." -DownloadAndUnzip $UVR5_URL "tools\uvr5\uvr5_weights" +DownloadAndUnzip $UVR5_URL "tools\uvr5" Write-Host "[INFO] Downloading funasr..." $funasrUrl = "https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/resolve/main/funasr.zip" From cbf9a9bdbdb063360e6b3198f9dd87e6fc9005cf Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 06:41:03 +0100 Subject: [PATCH 147/183] Fix Path --- .github/build_windows_packages.ps1 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index d51fac33..3f173ec9 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -57,8 +57,15 @@ function DownloadAndUnzip($url, $targetRelPath) { $tmpZip = "$tmpDir\$filename" Invoke-WebRequest $url -OutFile $tmpZip Expand-Archive -Path $tmpZip -DestinationPath $tmpDir -Force - Get-ChildItem . - Move-Item "$tmpDir\$($filename -replace '\.zip$', '')" "$srcDir\$targetRelPath" -Force + $subdirName = $filename -replace '\.zip$', '' + $sourcePath = Join-Path $tmpDir $subdirName + $destRoot = Join-Path $srcDir $targetRelPath + $destPath = Join-Path $destRoot $subdirName + if (Test-Path $destPath) { + Remove-Item $destPath -Recurse -Force + } + + Move-Item $sourcePath $destRoot Remove-Item $tmpZip } From b310dadf8c82d896735b5f209dbace7cd16cd88a Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 08:50:01 +0100 Subject: [PATCH 148/183] Enable Logging --- GPT_SoVITS/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GPT_SoVITS/utils.py b/GPT_SoVITS/utils.py index 1cc2d97f..f6f388ac 100644 --- a/GPT_SoVITS/utils.py +++ b/GPT_SoVITS/utils.py @@ -16,7 +16,7 @@ logging.getLogger("matplotlib").setLevel(logging.ERROR) MATPLOTLIB_FLAG = False -logging.basicConfig(stream=sys.stdout, level=logging.ERROR) +logging.basicConfig(stream=sys.stdout, level=logging.INFO) logger = logging @@ -309,13 +309,13 @@ def check_git_hash(model_dir): def get_logger(model_dir, filename="train.log"): global logger logger = logging.getLogger(os.path.basename(model_dir)) - logger.setLevel(logging.ERROR) + logger.setLevel(logging.INFO) formatter = logging.Formatter("%(asctime)s\t%(name)s\t%(levelname)s\t%(message)s") if not os.path.exists(model_dir): os.makedirs(model_dir) h = logging.FileHandler(os.path.join(model_dir, filename)) - h.setLevel(logging.ERROR) + h.setLevel(logging.INFO) h.setFormatter(formatter) logger.addHandler(h) return logger From 7b941897477aec02b144f87ef92c6d1751c6131c Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 09:26:59 +0100 Subject: [PATCH 149/183] Set 7-Zip compression level to maximum (-mx=9) --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 3f173ec9..28931a1c 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -144,7 +144,7 @@ Set-Location ../ Get-ChildItem . Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -mx=5 -bsp1 +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -mx=9 -bsp1 Get-ChildItem . python -m pip install --upgrade pip From e3e147d4f9a2b9d4d3cc434259f12cac138618c3 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 09:36:23 +0100 Subject: [PATCH 150/183] Use Multithread in ONNX Session --- GPT_SoVITS/text/g2pw/onnx_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPT_SoVITS/text/g2pw/onnx_api.py b/GPT_SoVITS/text/g2pw/onnx_api.py index a9b596b5..05681700 100644 --- a/GPT_SoVITS/text/g2pw/onnx_api.py +++ b/GPT_SoVITS/text/g2pw/onnx_api.py @@ -90,7 +90,7 @@ class G2PWOnnxConverter: sess_options = onnxruntime.SessionOptions() sess_options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_ENABLE_ALL sess_options.execution_mode = onnxruntime.ExecutionMode.ORT_SEQUENTIAL - sess_options.intra_op_num_threads = 2 + sess_options.intra_op_num_threads = 2 if torch.cuda.is_available() else 0 try: self.session_g2pW = onnxruntime.InferenceSession( os.path.join(uncompress_path, "g2pW.onnx"), From e8241861fb78349b2e22a624a51d774b0e39c23f Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 09:51:32 +0100 Subject: [PATCH 151/183] Fix Tag Bugs --- .github/workflows/build_windows_packages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_windows_packages.yaml b/.github/workflows/build_windows_packages.yaml index da106fb7..32861463 100644 --- a/.github/workflows/build_windows_packages.yaml +++ b/.github/workflows/build_windows_packages.yaml @@ -24,7 +24,7 @@ jobs: MODELSCOPE_TOKEN: ${{ secrets.MODELSCOPE_TOKEN }} HUGGINGFACE_USERNAME: ${{ secrets.HUGGINGFACE_USERNAME }} HUGGINGFACE_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }} - DATE_SUFFIX: ${{ github.event.inputs.suffix }} + DATE_SUFFIX: ${{ github.event.inputs.date }} PKG_SUFFIX: ${{ github.event.inputs.suffix }} steps: From ec822a48f1b4303fab4e12bbf75f59900a05b55e Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 10:24:59 +0100 Subject: [PATCH 152/183] Add Time --- .github/build_windows_packages.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 28931a1c..0cfaa421 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -144,7 +144,10 @@ Set-Location ../ Get-ChildItem . Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -mx=9 -bsp1 +$time = Measure-Command { + & "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -mx=9 -bsp1 +} +Write-Host "7z compression finished in $($time.TotalSeconds) seconds" Get-ChildItem . python -m pip install --upgrade pip From 24f0dfab93b234b9730bfcf1a513614cfd01e0aa Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 10:50:40 +0100 Subject: [PATCH 153/183] Add Time --- .github/build_windows_packages.ps1 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 0cfaa421..17e03561 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -114,7 +114,10 @@ switch ($cuda) { Write-Host "[INFO] Installing dependencies..." & ".\runtime\python.exe" -m pip install -r extra-req.txt --no-deps --no-warn-script-location -& ".\runtime\python.exe" -m pip install -r requirements.txt --no-warn-script-location +$time = Measure-Command { + & ".\runtime\python.exe" -m pip install -r requirements.txt --no-warn-script-location +} +Write-Host "Elapsed time: $($time.TotalSeconds) seconds" Write-Host "[INFO] Downloading NLTK and pyopenjtalk dictionary..." $PYTHON = ".\runtime\python.exe" @@ -144,10 +147,11 @@ Set-Location ../ Get-ChildItem . Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" -$time = Measure-Command { - & "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -mx=9 -bsp1 -} -Write-Host "7z compression finished in $($time.TotalSeconds) seconds" +$start = Get-Date +Write-Host "Compress Starting at $start" +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -mx=9 -bsp1 +$end = Get-Date +Write-Host "Elapsed time: $($end - $start)" Get-ChildItem . python -m pip install --upgrade pip From f338e4c48c6f79a952de0e5aaabf9ee8c37f8331 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 10:56:55 +0100 Subject: [PATCH 154/183] Add Time --- .github/build_windows_packages.ps1 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 17e03561..dacef90d 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -114,10 +114,7 @@ switch ($cuda) { Write-Host "[INFO] Installing dependencies..." & ".\runtime\python.exe" -m pip install -r extra-req.txt --no-deps --no-warn-script-location -$time = Measure-Command { - & ".\runtime\python.exe" -m pip install -r requirements.txt --no-warn-script-location -} -Write-Host "Elapsed time: $($time.TotalSeconds) seconds" +& ".\runtime\python.exe" -m pip install -r requirements.txt --no-warn-script-location Write-Host "[INFO] Downloading NLTK and pyopenjtalk dictionary..." $PYTHON = ".\runtime\python.exe" From 28f3acca081a2da44bdea12a914af10cbb633f77 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 14 May 2025 11:44:38 +0100 Subject: [PATCH 155/183] Compress More --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index dacef90d..d7b68bbc 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -146,7 +146,7 @@ Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" $start = Get-Date Write-Host "Compress Starting at $start" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -mx=9 -bsp1 +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=256m -ms=on -mmt=on -bsp1 $end = Get-Date Write-Host "Elapsed time: $($end - $start)" Get-ChildItem . From d4e729fed2c1ba54e9e87a1e5d6132a413cacc61 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 15 May 2025 12:59:06 +0100 Subject: [PATCH 156/183] Copy DLL to Solve VC Runtime DLL Missing Issues --- .github/build_windows_packages.ps1 | 20 +++++++++++++++++++- GPT_SoVITS/text/g2pw/onnx_api.py | 16 +++++++--------- go-webui.bat | 4 ++++ go-webui.ps1 | 5 ++++- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index d7b68bbc..68937386 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -52,6 +52,24 @@ $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 & "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o"$tmpDir\extracted" -aoa Move-Item "$tmpDir\extracted\python\install" "$srcDir\runtime" +$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" +$vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath +$redistRoot = Join-Path $vsPath "VC\Redist\MSVC" +Get-ChildItem $redistRoot +$targetVer = Get-ChildItem -Path $redistRoot -Directory | + Where-Object { $_.Name -match "^14\." } | + Sort-Object Name -Descending | + Select-Object -First 1 +$x64Path = Join-Path $targetVer.FullName "x64" +Write-Host 111 +Get-ChildItem $x64Path +Get-ChildItem -Path $x64Path -Directory -Filter "Microsoft.*" | ForEach-Object { + Get-ChildItem -Path $_.FullName -Filter "*.dll" | ForEach-Object { + Write-Host "Copy $($_.FullName)" + Copy-Item -Path $_.FullName -Destination "$srcDir\runtime" -Force + } +} + function DownloadAndUnzip($url, $targetRelPath) { $filename = Split-Path $url -Leaf $tmpZip = "$tmpDir\$filename" @@ -175,4 +193,4 @@ if (-not $hfUser -or -not $hfToken) { $env:HF_HUB_ENABLE_HF_TRANSFER = "1" huggingface-cli upload "$hfUser/GPT-SoVITS-Packages" "$7zPath" "$7zPath" --repo-type model --token $hfToken -Write-Host "[SUCCESS] Uploaded: $7zPath to HuggingFace" \ No newline at end of file +Write-Host "[SUCCESS] Uploaded: $7zPath to HuggingFace" diff --git a/GPT_SoVITS/text/g2pw/onnx_api.py b/GPT_SoVITS/text/g2pw/onnx_api.py index 05681700..92827395 100644 --- a/GPT_SoVITS/text/g2pw/onnx_api.py +++ b/GPT_SoVITS/text/g2pw/onnx_api.py @@ -7,24 +7,22 @@ import warnings import zipfile from typing import Any, Dict, List, Tuple -from opencc import OpenCC - -warnings.filterwarnings("ignore") - - import numpy as np import onnxruntime import requests - -onnxruntime.set_default_logger_severity(3) -onnxruntime.preload_dlls() +import torch +from opencc import OpenCC from pypinyin import Style, pinyin -from transformers import AutoTokenizer +from transformers.models.auto.tokenization_auto import AutoTokenizer from ..zh_normalization.char_convert import tranditional_to_simplified from .dataset import get_char_phoneme_labels, get_phoneme_labels, prepare_onnx_input from .utils import load_config +onnxruntime.set_default_logger_severity(3) +onnxruntime.preload_dlls() +warnings.filterwarnings("ignore") + model_version = "1.1" diff --git a/go-webui.bat b/go-webui.bat index a2dfff6c..c1c81089 100644 --- a/go-webui.bat +++ b/go-webui.bat @@ -1,2 +1,6 @@ +set "SCRIPT_DIR=%~dp0" +set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%" +cd /d "%SCRIPT_DIR%" +set "PATH=%SCRIPT_DIR%\runtime;%PATH%" runtime\python.exe -I webui.py zh_CN pause diff --git a/go-webui.ps1 b/go-webui.ps1 index f9427263..09103425 100644 --- a/go-webui.ps1 +++ b/go-webui.ps1 @@ -1,4 +1,7 @@ $ErrorActionPreference = "SilentlyContinue" chcp 65001 -& "$PSScriptRoot\runtime\python.exe" -I "$PSScriptRoot\webui.py" zh_CN +Set-Location $PSScriptRoot +$runtimePath = Join-Path $PSScriptRoot "runtime" +$env:PATH = "$runtimePath;$env:PATH" +& "$runtimePath\python.exe" -I "$PSScriptRoot\webui.py" zh_CN pause From e30242977b4346f3e658cfd8317bf47d9be269fe Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 15 May 2025 13:19:00 +0100 Subject: [PATCH 157/183] Expose FFmpeg Errors, Copy Only Part of Visual C++ Runtime --- .github/build_windows_packages.ps1 | 14 ++++++-------- tools/my_utils.py | 10 ++++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 68937386..a23b7766 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -52,20 +52,19 @@ $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1 & "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o"$tmpDir\extracted" -aoa Move-Item "$tmpDir\extracted\python\install" "$srcDir\runtime" +Write-Host "[INFO] Copying Redistributing Visual C++ Runtime..." $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" $vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath $redistRoot = Join-Path $vsPath "VC\Redist\MSVC" -Get-ChildItem $redistRoot $targetVer = Get-ChildItem -Path $redistRoot -Directory | Where-Object { $_.Name -match "^14\." } | Sort-Object Name -Descending | Select-Object -First 1 $x64Path = Join-Path $targetVer.FullName "x64" -Write-Host 111 -Get-ChildItem $x64Path -Get-ChildItem -Path $x64Path -Directory -Filter "Microsoft.*" | ForEach-Object { +Get-ChildItem -Path $x64Path -Directory | Where-Object { + $_.Name -match '^Microsoft\..*\.(CRT|OpenMP)$' +} | ForEach-Object { Get-ChildItem -Path $_.FullName -Filter "*.dll" | ForEach-Object { - Write-Host "Copy $($_.FullName)" Copy-Item -Path $_.FullName -Destination "$srcDir\runtime" -Force } } @@ -82,7 +81,6 @@ function DownloadAndUnzip($url, $targetRelPath) { if (Test-Path $destPath) { Remove-Item $destPath -Recurse -Force } - Move-Item $sourcePath $destRoot Remove-Item $tmpZip } @@ -109,8 +107,8 @@ $ffZip = "$tmpDir\ffmpeg.zip" Invoke-WebRequest -Uri $ffUrl -OutFile $ffZip Expand-Archive $ffZip -DestinationPath $tmpDir -Force $ffDir = Get-ChildItem -Directory "$tmpDir" | Where-Object { $_.Name -like "ffmpeg*" } | Select-Object -First 1 -Move-Item "$($ffDir.FullName)\bin\ffmpeg.exe" "$srcDir" -Move-Item "$($ffDir.FullName)\bin\ffprobe.exe" "$srcDir" +Move-Item "$($ffDir.FullName)\bin\ffmpeg.exe" "$srcDir\runtime" +Move-Item "$($ffDir.FullName)\bin\ffprobe.exe" "$srcDir\runtime" Remove-Item $ffZip Remove-Item $ffDir.FullName -Recurse -Force diff --git a/tools/my_utils.py b/tools/my_utils.py index 7f70db26..59a7cd3c 100644 --- a/tools/my_utils.py +++ b/tools/my_utils.py @@ -1,8 +1,6 @@ import ctypes -import glob import os import sys -import traceback from pathlib import Path import ffmpeg @@ -21,7 +19,7 @@ def load_audio(file, sr): # This launches a subprocess to decode audio while down-mixing and resampling as necessary. # Requires the ffmpeg CLI and `ffmpeg-python` package to be installed. file = clean_path(file) # 防止小白拷路径头尾带了空格和"和回车 - if os.path.exists(file) == False: + if os.path.exists(file) is False: raise RuntimeError("You input a wrong audio path that does not exists, please fix it!") out, _ = ( ffmpeg.input(file, threads=0) @@ -29,7 +27,11 @@ def load_audio(file, sr): .run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True, capture_stderr=True) ) except Exception: - traceback.print_exc() + out, _ = ( + ffmpeg.input(file, threads=0) + .output("-", format="f32le", acodec="pcm_f32le", ac=1, ar=sr) + .run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True) + ) # Expose the Error raise RuntimeError(i18n("音频加载失败")) return np.frombuffer(out, np.float32).flatten() From 18fd894848b286902d5d56ef9f2c371cbbb1ea51 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 21 May 2025 20:32:08 +0300 Subject: [PATCH 158/183] Update build_windows_packages.ps1 --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index a23b7766..59e3e9af 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -162,7 +162,7 @@ Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" $start = Get-Date Write-Host "Compress Starting at $start" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=256m -ms=on -mmt=on -bsp1 +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1024m -ms=512m -mfb=273 -lp=0 -mmt=on -bsp1 $end = Get-Date Write-Host "Elapsed time: $($end - $start)" Get-ChildItem . From 793ada74cd9c86e15011a6dc6cd731e7679228e5 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 21 May 2025 20:50:48 +0300 Subject: [PATCH 159/183] Update build_windows_packages.ps1 --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 59e3e9af..819aa829 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -162,7 +162,7 @@ Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" $start = Get-Date Write-Host "Compress Starting at $start" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1024m -ms=512m -mfb=273 -lp=0 -mmt=on -bsp1 +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1024m -ms=512m -mfb=273 -m=lp=4 -mc=10000 -mmt=on -bsp1 $end = Get-Date Write-Host "Elapsed time: $($end - $start)" Get-ChildItem . From 8b68aad1b33a32691e61a234e4ead4e862b82461 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 21 May 2025 21:10:01 +0300 Subject: [PATCH 160/183] Update build_windows_packages.ps1 --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 819aa829..5062e192 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -162,7 +162,7 @@ Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" $start = Get-Date Write-Host "Compress Starting at $start" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1024m -ms=512m -mfb=273 -m=lp=4 -mc=10000 -mmt=on -bsp1 +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1024m -ms=512m -mfb=273 -mlp=4 -mc=10000 -mmt=on -bsp1 $end = Get-Date Write-Host "Elapsed time: $($end - $start)" Get-ChildItem . From 91576f157ee48f5a7eb0925921c51a3bae257886 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 21 May 2025 21:42:34 +0300 Subject: [PATCH 161/183] Update build_windows_packages.ps1 --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 5062e192..c1c7f7d1 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -162,7 +162,7 @@ Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" $start = Get-Date Write-Host "Compress Starting at $start" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1024m -ms=512m -mfb=273 -mlp=4 -mc=10000 -mmt=on -bsp1 +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1024m -ms=512m -mfb=273 -mmt=on -bsp1 $end = Get-Date Write-Host "Elapsed time: $($end - $start)" Get-ChildItem . From 963d12c7b994f6e03a9256f59e43e508e1b6f350 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Wed, 21 May 2025 23:31:22 +0300 Subject: [PATCH 162/183] WIP --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index c1c7f7d1..196e5894 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -162,7 +162,7 @@ Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" $start = Get-Date Write-Host "Compress Starting at $start" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1024m -ms=512m -mfb=273 -mmt=on -bsp1 +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1g -ms=1g -mmc=10000 -mfb=273 -mlc=0 -mlp=4 -mpb=4 -mc=8g -mmt=on -bsp1 $end = Get-Date Write-Host "Elapsed time: $($end - $start)" Get-ChildItem . From 9bd0b08009e6cdbc55b7daf9bfce41c9c6683b1b Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 02:03:36 +0300 Subject: [PATCH 163/183] WIP --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 196e5894..2fa2d97d 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -162,7 +162,7 @@ Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" $start = Get-Date Write-Host "Compress Starting at $start" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1g -ms=1g -mmc=10000 -mfb=273 -mlc=0 -mlp=4 -mpb=4 -mc=8g -mmt=on -bsp1 +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=2g -ms=2g -mmc=10000 -mfb=273 -mlc=0 -mlp=4 -mpb=4 -mc=8g -mmt=on -bsp1 $end = Get-Date Write-Host "Elapsed time: $($end - $start)" Get-ChildItem . From aa3c19b0b69ff75a969bd48daad2899ad4c59730 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 04:51:05 +0300 Subject: [PATCH 164/183] WIP --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 2fa2d97d..92410f46 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -162,7 +162,7 @@ Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" $start = Get-Date Write-Host "Compress Starting at $start" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=2g -ms=2g -mmc=10000 -mfb=273 -mlc=0 -mlp=4 -mpb=4 -mc=8g -mmt=on -bsp1 +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1536m -ms=1536m -mmc=10000 -mfb=273 -mlc=0 -mlp=4 -mpb=4 -mc=8g -mmt=on -bsp1 $end = Get-Date Write-Host "Elapsed time: $($end - $start)" Get-ChildItem . From c1e82e9b94cd9c3dff7e061720221ac3c90fd1b4 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 11:57:35 +0300 Subject: [PATCH 165/183] Update build_windows_packages.ps1 --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 92410f46..196e5894 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -162,7 +162,7 @@ Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" $start = Get-Date Write-Host "Compress Starting at $start" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1536m -ms=1536m -mmc=10000 -mfb=273 -mlc=0 -mlp=4 -mpb=4 -mc=8g -mmt=on -bsp1 +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1g -ms=1g -mmc=10000 -mfb=273 -mlc=0 -mlp=4 -mpb=4 -mc=8g -mmt=on -bsp1 $end = Get-Date Write-Host "Elapsed time: $($end - $start)" Get-ChildItem . From cfefe6febf55261c4cdd217814b315399a09af58 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 16:28:07 +0300 Subject: [PATCH 166/183] Update install.sh --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 3a37538a..c70533d2 100644 --- a/install.sh +++ b/install.sh @@ -252,14 +252,14 @@ if [ "$USE_CUDA" = true ] && [ "$WORKFLOW" = false ]; then if [ "$CUDA" = 128 ]; then pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128 elif [ "$CUDA" = 124 ]; then - pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 + pip install torch==2.6 torchaudio --index-url https://download.pytorch.org/whl/cu124 fi elif [ "$USE_ROCM" = true ] && [ "$WORKFLOW" = false ]; then echo "Installing PyTorch with ROCm support..." - pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/rocm6.2 + pip install torch==2.6 torchaudio --index-url https://download.pytorch.org/whl/rocm6.2 elif [ "$USE_CPU" = true ] && [ "$WORKFLOW" = false ]; then 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.6 torchaudio --index-url https://download.pytorch.org/whl/cpu elif [ "$WORKFLOW" = false ]; then echo "Unknown Err" exit 1 From 9de546162b586c3d5ce3c9e3bbe93273e5651e34 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 16:28:36 +0300 Subject: [PATCH 167/183] Update build_windows_packages.ps1 --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 196e5894..5d6cd265 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -117,7 +117,7 @@ Write-Host "[INFO] Installing PyTorch..." & ".\runtime\python.exe" -m pip install --upgrade pip --no-warn-script-location switch ($cuda) { "cu124" { - & ".\runtime\python.exe" -m pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 --no-warn-script-location + & ".\runtime\python.exe" -m pip install torch==2.6 torchaudio --index-url https://download.pytorch.org/whl/cu124 --no-warn-script-location } "cu128" { & ".\runtime\python.exe" -m pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128 --no-warn-script-location From 2a70ee3c85f52ec2af29f40b6b4ccd67ee702fc5 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 17:21:43 +0300 Subject: [PATCH 168/183] Update docker-publish.yaml --- .github/workflows/docker-publish.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index e2be5423..a00a0a77 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -24,14 +24,14 @@ jobs: strategy: matrix: include: - - cuda_version: 12.4 + - cuda_version: 12.6 lite: true torch_base: lite - tag_prefix: cu124-lite - - cuda_version: 12.4 + tag_prefix: cu126-lite + - cuda_version: 12.6 lite: false torch_base: full - tag_prefix: cu124 + tag_prefix: cu126 - cuda_version: 12.8 lite: true torch_base: lite @@ -111,14 +111,14 @@ jobs: strategy: matrix: include: - - cuda_version: 12.4 + - cuda_version: 12.6 lite: true torch_base: lite - tag_prefix: cu124-lite - - cuda_version: 12.4 + tag_prefix: cu126-lite + - cuda_version: 12.6 lite: false torch_base: full - tag_prefix: cu124 + tag_prefix: cu126 - cuda_version: 12.8 lite: true torch_base: lite @@ -202,8 +202,8 @@ jobs: strategy: matrix: include: - - tag_prefix: cu124-lite - - tag_prefix: cu124 + - tag_prefix: cu126-lite + - tag_prefix: cu126 - tag_prefix: cu128-lite - tag_prefix: cu128 @@ -272,5 +272,5 @@ jobs: run: | docker buildx imagetools create \ --tag ${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest \ - ${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest-cu124-lite + ${{ secrets.DOCKER_HUB_USERNAME }}/gpt-sovits:latest-cu126-lite \ No newline at end of file From 43de4e17d1ca2d56afe3c9fa08599c20361b2901 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 17:22:47 +0300 Subject: [PATCH 169/183] Update install.sh --- install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index c70533d2..b3979883 100644 --- a/install.sh +++ b/install.sh @@ -28,7 +28,7 @@ print_help() { echo "Usage: bash install.sh [OPTIONS]" echo "" echo "Options:" - echo " --device CU124|CU128|ROCM|MPS|CPU Specify the Device (REQUIRED)" + echo " --device CU126|CU128|ROCM|MPS|CPU Specify the Device (REQUIRED)" echo " --source HF|HF-Mirror|ModelScope Specify the model source (REQUIRED)" echo " --download-uvr5 Enable downloading the UVR5 model" echo " -h, --help Show this help message and exit" @@ -68,8 +68,8 @@ while [[ $# -gt 0 ]]; do ;; --device) case "$2" in - CU124) - CUDA=124 + CU126) + CUDA=126 USE_CUDA=true ;; CU128) @@ -87,7 +87,7 @@ while [[ $# -gt 0 ]]; do ;; *) echo "Error: Invalid Device: $2" - echo "Choose From: [CU124, CU128, ROCM, MPS, CPU]" + echo "Choose From: [CU126, CU128, ROCM, MPS, CPU]" exit 1 ;; esac @@ -251,8 +251,8 @@ if [ "$USE_CUDA" = true ] && [ "$WORKFLOW" = false ]; then echo "Installing PyTorch with CUDA support..." if [ "$CUDA" = 128 ]; then pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128 - elif [ "$CUDA" = 124 ]; then - pip install torch==2.6 torchaudio --index-url https://download.pytorch.org/whl/cu124 + elif [ "$CUDA" = 126 ]; then + pip install torch==2.6 torchaudio --index-url https://download.pytorch.org/whl/cu126 fi elif [ "$USE_ROCM" = true ] && [ "$WORKFLOW" = false ]; then echo "Installing PyTorch with ROCm support..." From 8ddd3667d0bfc0e3d1838f273248ed8263adbd14 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 17:23:11 +0300 Subject: [PATCH 170/183] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 34a6d49f..71bf6fa1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG CUDA_VERSION=12.4 +ARG CUDA_VERSION=12.6 ARG TORCH_BASE=full FROM xxxxrt666/torch-base:cu${CUDA_VERSION}-${TORCH_BASE} @@ -7,7 +7,7 @@ LABEL maintainer="XXXXRT" LABEL version="V4" LABEL description="Docker image for GPT-SoVITS" -ARG CUDA_VERSION=12.4 +ARG CUDA_VERSION=12.6 ENV CUDA_VERSION=${CUDA_VERSION} From 825c6899403e10bd4afbf0201f27aa074a4b6b31 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 17:27:43 +0300 Subject: [PATCH 171/183] Update docker_build.sh --- docker_build.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker_build.sh b/docker_build.sh index 4db652a1..354599d2 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -14,18 +14,18 @@ fi trap 'echo "Error Occured at \"$BASH_COMMAND\" with exit code $?"; exit 1' ERR LITE=false -CUDA_VERSION=12.4 +CUDA_VERSION=12.6 print_help() { echo "Usage: bash docker_build.sh [OPTIONS]" echo "" echo "Options:" - echo " --cuda 12.4|12.8 Specify the CUDA VERSION (REQUIRED)" + echo " --cuda 12.6|12.8 Specify the CUDA VERSION (REQUIRED)" echo " --lite Build a Lite Image" echo " -h, --help Show this help message and exit" echo "" echo "Examples:" - echo " bash docker_build.sh --cuda 12.4 --funasr --faster-whisper" + echo " bash docker_build.sh --cuda 12.6 --funasr --faster-whisper" } # Show help if no arguments provided @@ -39,15 +39,15 @@ while [[ $# -gt 0 ]]; do case "$1" in --cuda) case "$2" in - 12.4) - CUDA_VERSION=12.4 + 12.6) + CUDA_VERSION=12.6 ;; 12.8) CUDA_VERSION=12.8 ;; *) echo "Error: Invalid CUDA_VERSION: $2" - echo "Choose From: [12.4, 12.8]" + echo "Choose From: [12.6, 12.8]" exit 1 ;; esac From 768040a9d4f2182fdfa97280a9cb88e857707759 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 17:33:30 +0300 Subject: [PATCH 172/183] Update miniconda_install.sh --- Docker/miniconda_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Docker/miniconda_install.sh b/Docker/miniconda_install.sh index 36ca5c53..001a2a46 100644 --- a/Docker/miniconda_install.sh +++ b/Docker/miniconda_install.sh @@ -55,8 +55,8 @@ source "$HOME/miniconda3/etc/profile.d/conda.sh" if [ "$CUDA_VERSION" = "12.8" ]; then "$HOME/miniconda3/bin/pip" install torch torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu128 -elif [ "$CUDA_VERSION" = "12.4" ]; then - "$HOME/miniconda3/bin/pip" install torch==2.5.1 torchaudio==2.5.1 --no-cache-dir --index-url https://download.pytorch.org/whl/cu124 +elif [ "$CUDA_VERSION" = "12.6" ]; then + "$HOME/miniconda3/bin/pip" install torch==2.6 torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/cu126 fi "$HOME/miniconda3/bin/pip" cache purge From 723af96f4219c105edf3dd49b45a37716566562c Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 17:34:42 +0300 Subject: [PATCH 173/183] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 44c8ea19..b32d2fd9 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ If you are a Windows user (tested with win>=10), you can [download the integrate ```bash conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS @@ -144,13 +144,13 @@ On Windows (Docker Desktop), the default shared memory size is small and may cau The `docker-compose.yaml` defines two services: -- `GPT-SoVITS-CU124` & `GPT-SoVITS-CU128`: Full version with all features. -- `GPT-SoVITS-CU124-Lite` & `GPT-SoVITS-CU128-Lite`: Lightweight version with reduced dependencies and functionality. +- `GPT-SoVITS-CU126` & `GPT-SoVITS-CU128`: Full version with all features. +- `GPT-SoVITS-CU126-Lite` & `GPT-SoVITS-CU128-Lite`: Lightweight version with reduced dependencies and functionality. To run a specific service with Docker Compose, use: ```bash -docker compose run --service-ports +docker compose run --service-ports ``` #### Building the Docker Image Locally @@ -158,7 +158,7 @@ docker compose run --service-ports [--lite] +bash docker_build.sh --cuda <12.6|12.8> [--lite] ``` #### Accessing the Running Container (Bash Shell) @@ -166,7 +166,7 @@ bash docker_build.sh --cuda <12.4|12.8> [--lite] Once the container is running in the background, you can access it using: ```bash -docker exec -it bash +docker exec -it bash ``` ## Pretrained Models From 02c064012e3f7327d43ce847bbd1c5d286de13e6 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 17:35:38 +0300 Subject: [PATCH 174/183] Update README.md --- docs/cn/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/cn/README.md b/docs/cn/README.md index bc94495d..832e75f4 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -65,7 +65,7 @@ ```bash conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS @@ -144,13 +144,13 @@ brew install ffmpeg `docker-compose.yaml` 文件定义了两个主要服务类型: -- `GPT-SoVITS-CU124` 与 `GPT-SoVITS-CU128`:完整版, 包含所有功能 -- `GPT-SoVITS-CU124-Lite` 与 `GPT-SoVITS-CU128-Lite`:轻量版, 依赖更少, 功能略有删减 +- `GPT-SoVITS-CU126` 与 `GPT-SoVITS-CU128`:完整版, 包含所有功能 +- `GPT-SoVITS-CU126-Lite` 与 `GPT-SoVITS-CU128-Lite`:轻量版, 依赖更少, 功能略有删减 如需使用 Docker Compose 运行指定服务, 请执行: ```bash -docker compose run --service-ports +docker compose run --service-ports ``` #### 本地构建 Docker 镜像 @@ -158,7 +158,7 @@ docker compose run --service-ports [--lite] +bash docker_build.sh --cuda <12.6|12.8> [--lite] ``` #### 访问运行中的容器 (Bash Shell) @@ -166,7 +166,7 @@ bash docker_build.sh --cuda <12.4|12.8> [--lite] 当容器在后台运行时, 你可以通过以下命令进入容器: ```bash -docker exec -it bash +docker exec -it bash ``` ## 预训练模型 From 3ca9f4612c78baae97ece49544b8de56d0b7fd19 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 17:36:41 +0300 Subject: [PATCH 175/183] Update README.md --- docs/ko/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/ko/README.md b/docs/ko/README.md index f81a9866..e6419a11 100644 --- a/docs/ko/README.md +++ b/docs/ko/README.md @@ -59,7 +59,7 @@ Windows 사용자라면 (win>=10에서 테스트됨), [통합 패키지를 다 ```bash conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS @@ -138,13 +138,13 @@ Windows(Docker Desktop)에서는 기본 공유 메모리 크기가 작아 예기 `docker-compose.yaml` 파일에는 두 가지 서비스 유형이 정의되어 있습니다: -- `GPT-SoVITS-CU124` 및 `GPT-SoVITS-CU128`: 전체 기능을 포함한 풀 버전 -- `GPT-SoVITS-CU124-Lite` 및 `GPT-SoVITS-CU128-Lite`: 의존성이 줄어든 경량 버전 +- `GPT-SoVITS-CU126` 및 `GPT-SoVITS-CU128`: 전체 기능을 포함한 풀 버전 +- `GPT-SoVITS-CU126-Lite` 및 `GPT-SoVITS-CU128-Lite`: 의존성이 줄어든 경량 버전 특정 서비스를 Docker Compose로 실행하려면 다음 명령을 사용하세요: ```bash -docker compose run --service-ports +docker compose run --service-ports ``` #### Docker 이미지 직접 빌드하기 @@ -152,7 +152,7 @@ docker compose run --service-ports [--lite] +bash docker_build.sh --cuda <12.6|12.8> [--lite] ``` #### 실행 중인 컨테이너 접속하기 (Bash Shell) @@ -160,7 +160,7 @@ bash docker_build.sh --cuda <12.4|12.8> [--lite] 컨테이너가 백그라운드에서 실행 중일 때 다음 명령어로 셸에 접속할 수 있습니다: ```bash -docker exec -it bash +docker exec -it bash ``` ## 사전 학습된 모델 From 467e1f6aa794c1b39a72a572316be47345bcbeac Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 17:37:58 +0300 Subject: [PATCH 176/183] Update README.md --- docs/tr/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/tr/README.md b/docs/tr/README.md index b6d6f51e..0a8ee4a8 100644 --- a/docs/tr/README.md +++ b/docs/tr/README.md @@ -61,7 +61,7 @@ Eğer bir Windows kullanıcısıysanız (win>=10 ile test edilmiştir), [entegre ```bash conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS @@ -140,13 +140,13 @@ Windows (Docker Desktop) ortamında, varsayılan paylaşılan bellek boyutu dü `docker-compose.yaml` dosyasında iki tür servis tanımlanmıştır: -- `GPT-SoVITS-CU124` ve `GPT-SoVITS-CU128`: Tüm özellikleri içeren tam sürüm. -- `GPT-SoVITS-CU124-Lite` ve `GPT-SoVITS-CU128-Lite`: Daha az bağımlılığa ve sınırlı işlevselliğe sahip hafif sürüm. +- `GPT-SoVITS-CU126` ve `GPT-SoVITS-CU128`: Tüm özellikleri içeren tam sürüm. +- `GPT-SoVITS-CU126-Lite` ve `GPT-SoVITS-CU128-Lite`: Daha az bağımlılığa ve sınırlı işlevselliğe sahip hafif sürüm. Belirli bir servisi Docker Compose ile çalıştırmak için şu komutu kullanın: ```bash -docker compose run --service-ports +docker compose run --service-ports ``` #### Docker İmajını Yerel Olarak Oluşturma @@ -154,7 +154,7 @@ docker compose run --service-ports [--lite] +bash docker_build.sh --cuda <12.6|12.8> [--lite] ``` #### Çalışan Konteynere Erişim (Bash Shell) @@ -162,7 +162,7 @@ bash docker_build.sh --cuda <12.4|12.8> [--lite] Konteyner arka planda çalışırken, aşağıdaki komutla içine girebilirsiniz: ```bash -docker exec -it bash +docker exec -it bash ``` ## Önceden Eğitilmiş Modeller From 27873b73dfb1378b252e2b0a031983e34774c305 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 17:39:59 +0300 Subject: [PATCH 177/183] Update README.md --- docs/ja/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/ja/README.md b/docs/ja/README.md index 076fceed..62fd91fa 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -59,7 +59,7 @@ Windows ユーザー: (Windows 10 以降でテスト済み)、[統合パッケ ```bash conda create -n GPTSoVits python=3.10 conda activate GPTSoVits -bash install.sh --device --source [--download-uvr5] +bash install.sh --device --source [--download-uvr5] ``` ### macOS @@ -138,13 +138,13 @@ Windows (Docker Desktop) では、デフォルトの共有メモリサイズが `docker-compose.yaml` ファイルには次の 2 種類のサービスが定義されています: -- `GPT-SoVITS-CU124` および `GPT-SoVITS-CU128`:すべての機能を含むフルバージョン -- `GPT-SoVITS-CU124-Lite` および `GPT-SoVITS-CU128-Lite`:依存関係を削減した軽量バージョン +- `GPT-SoVITS-CU126` および `GPT-SoVITS-CU128`:すべての機能を含むフルバージョン +- `GPT-SoVITS-CU126-Lite` および `GPT-SoVITS-CU128-Lite`:依存関係を削減した軽量バージョン 特定のサービスを Docker Compose で実行するには、以下のコマンドを使用します: ```bash -docker compose run --service-ports +docker compose run --service-ports ``` #### Docker イメージのローカルビルド @@ -152,7 +152,7 @@ docker compose run --service-ports [--lite] +bash docker_build.sh --cuda <12.46|12.8> [--lite] ``` #### 実行中のコンテナへアクセス (Bash Shell) @@ -160,7 +160,7 @@ bash docker_build.sh --cuda <12.4|12.8> [--lite] コンテナがバックグラウンドで実行されている場合、以下のコマンドでシェルにアクセスできます: ```bash -docker exec -it bash +docker exec -it bash ``` ## 事前訓練済みモデル From c89b5a0a7fd951ced4c8572ef314ae050cde80ec Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 19:02:17 +0300 Subject: [PATCH 178/183] Update README.md --- docs/ja/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ja/README.md b/docs/ja/README.md index 62fd91fa..8cedb0d9 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -152,7 +152,7 @@ docker compose run --service-ports [--lite] +bash docker_build.sh --cuda <12.6|12.8> [--lite] ``` #### 実行中のコンテナへアクセス (Bash Shell) From 5c139f2c4a85e64de6d9435507775fc06038a015 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 19:07:30 +0300 Subject: [PATCH 179/183] Update Colab-WebUI.ipynb --- Colab-WebUI.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Colab-WebUI.ipynb b/Colab-WebUI.ipynb index a127bd6d..b1403f33 100644 --- a/Colab-WebUI.ipynb +++ b/Colab-WebUI.ipynb @@ -59,7 +59,7 @@ "\n", "pip install ipykernel\n", "\n", - "bash install.sh --device CU124 --source HF --download-uvr5" + "bash install.sh --device CU126 --source HF --download-uvr5" ] }, { From 97b2c2e89635046e695480e6cc1e89e9fbc32acd Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 19:08:03 +0300 Subject: [PATCH 180/183] Update Colab-Inference.ipynb --- Colab-Inference.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Colab-Inference.ipynb b/Colab-Inference.ipynb index b565e4e1..b962c9b3 100644 --- a/Colab-Inference.ipynb +++ b/Colab-Inference.ipynb @@ -60,7 +60,7 @@ "\n", "pip install ipykernel\n", "\n", - "bash install.sh --device CU124 --source HF" + "bash install.sh --device CU126 --source HF" ] }, { From f3a06443d7b9c35cb2f50a09cdd7432bf3a16c57 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 19:08:47 +0300 Subject: [PATCH 181/183] Update docker-compose.yaml --- docker-compose.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 803c3219..9703d0c7 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,9 +1,9 @@ version: "3.8" services: - GPT-SoVITS-CU124: - image: xxxxrt666/gpt-sovits:latest-cu124 - container_name: GPT-SoVITS-CU124 + GPT-SoVITS-CU126: + image: xxxxrt666/gpt-sovits:latest-cu126 + container_name: GPT-SoVITS-CU126 ports: - "9871:9871" - "9872:9872" @@ -23,9 +23,9 @@ services: shm_size: "16g" restart: unless-stopped runtime: nvidia - GPT-SoVITS-CU124-Lite: - image: xxxxrt666/gpt-sovits:latest-cu124-lite - container_name: GPT-SoVITS-CU124-Lite + GPT-SoVITS-CU126-Lite: + image: xxxxrt666/gpt-sovits:latest-cu126-lite + container_name: GPT-SoVITS-CU126-Lite ports: - "9871:9871" - "9872:9872" From dfcb33c9aa966d602347026ca6b7537f73436999 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 21:13:57 +0300 Subject: [PATCH 182/183] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20build=5Fwindows=5F?= =?UTF-8?q?packages.ps1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/build_windows_packages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build_windows_packages.ps1 b/.github/build_windows_packages.ps1 index 5d6cd265..2e4acb2a 100644 --- a/.github/build_windows_packages.ps1 +++ b/.github/build_windows_packages.ps1 @@ -162,7 +162,7 @@ Copy-Item -Path $curr -Destination $pkgName -Recurse $7zPath = "$pkgName.7z" $start = Get-Date Write-Host "Compress Starting at $start" -& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1g -ms=1g -mmc=10000 -mfb=273 -mlc=0 -mlp=4 -mpb=4 -mc=8g -mmt=on -bsp1 +& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=1g -ms=1g -mmc=500 -mfb=273 -mlc=0 -mlp=4 -mpb=4 -mc=8g -mmt=on -bsp1 $end = Get-Date Write-Host "Elapsed time: $($end - $start)" Get-ChildItem . From 42f7e9b2b8833f5c0d5fdebc6286294c4bc98263 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 22 May 2025 22:58:28 +0300 Subject: [PATCH 183/183] Update install.sh --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index b3979883..eba18683 100644 --- a/install.sh +++ b/install.sh @@ -149,6 +149,7 @@ else echo "Installing,Please Wait..." fi done + conda install -c conda-forge -q -y fi echo "Installing ffmpeg and cmake..."