diff --git a/README.md b/README.md index 22b0b070..f8c359e1 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,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 +bash install.sh --source [--download-uvr5] ``` ### macOS @@ -72,14 +72,12 @@ bash install.sh **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 FFmpeg by running `brew install ffmpeg`. -3. Install the program by running the following commands: +2. Install the program by running the following commands: ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -pip install -r extra-req.txt --no-deps -pip install -r requirements.txt +bash install.sh --source [--download-uvr5] ``` ### Install Manually @@ -146,7 +144,7 @@ docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-Docker ## Pretrained Models -**If `install.sh` runs successfully, you may skip No.1 & No.2** +**If `install.sh` runs successfully, you may skip No.1,2,3** **Users in China can [download all these models here](https://www.yuque.com/baicaigongchang1145haoyuangong/ib3g1e/dkxgpiy9zb96hob4#nVNhX).** diff --git a/colab_webui.ipynb b/colab_webui.ipynb index f6470915..fd7374ba 100644 --- a/colab_webui.ipynb +++ b/colab_webui.ipynb @@ -20,6 +20,13 @@ "# 环境配置, 只需运行一次" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 1." + ] + }, { "cell_type": "code", "execution_count": null, @@ -57,7 +64,14 @@ "\n", "conda activate GPT-SoVITS\n", "\n", - "bash install.sh" + "bash install.sh --source HF --download-uvr5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 2." ] }, { @@ -71,30 +85,6 @@ "%cd -q /content/GPT-SoVITS" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# UVR5 Model Download (Run Once Only)\n", - "# UVR5 模型下载, 只需运行一次" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "0NgxXg5sjv7z" - }, - "outputs": [], - "source": [ - "%cd -q /content/GPT-SoVITS\n", - "!wget https://www.modelscope.cn/models/XXXXRT/UVR5Weights4GSV/resolve/master/uvr5_weights.zip\n", - "!unzip uvr5_weights.zip\n", - "!rm -rf uvr5_weights.zip\n", - "!mv uvr5_weights/* tools/uvr5/uvr5_weights\n", - "!rm -rf uvr5_weights" - ] - }, { "cell_type": "markdown", "metadata": {}, diff --git a/docs/cn/README.md b/docs/cn/README.md index d02082c7..e5393de2 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -64,7 +64,7 @@ https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350- ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh +bash install.sh --source [--download-uvr5] ``` ### macOS @@ -72,14 +72,12 @@ bash install.sh **注: 在 Mac 上使用 GPU 训练的模型效果显著低于其他设备训练的模型, 所以我们暂时使用 CPU 进行训练.** 1. 运行 `xcode-select --install` 安装 Xcode command-line tools. -2. 运行 `brew install ffmpeg` 安装 FFmpeg. -3. 完成上述步骤后, 运行以下的命令来安装本项目: +2. 运行以下的命令来安装本项目: ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -pip install -r extra-req.txt --no-deps -pip install -r requirements.txt +bash install.sh --source [--download-uvr5] ``` ### 手动安装 @@ -148,7 +146,7 @@ docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-Docker ## 预训练模型 -**若成功运行`install.sh`可跳过 No.1 & No.2** +**若成功运行`install.sh`可跳过 No.1,2,3** **中国地区的用户可以[在此处下载这些模型](https://www.yuque.com/baicaigongchang1145haoyuangong/ib3g1e/dkxgpiy9zb96hob4#nVNhX).** diff --git a/docs/ja/README.md b/docs/ja/README.md index a46eeca0..bcc5fe75 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -58,7 +58,7 @@ Windows ユーザー: (Windows 10 以降でテスト済み)、[統合パッケ ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh +bash install.sh --source [--download-uvr5] ``` ### macOS @@ -66,14 +66,12 @@ bash install.sh **注: Mac で GPU を使用して訓練されたモデルは、他のデバイスで訓練されたモデルと比較して著しく品質が低下するため、当面は CPU を使用して訓練することを強く推奨します.** 1. `xcode-select --install` を実行して、Xcode コマンドラインツールをインストールします. -2. `brew install ffmpeg` を実行して FFmpeg をインストールします. -3. 上記の手順を完了した後、以下のコマンドを実行してこのプロジェクトをインストールします. +2. 以下のコマンドを実行してこのプロジェクトをインストールします. ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -pip install -r extra-req.txt --no-deps -pip install -r requirements.txt +bash install.sh --source [--download-uvr5] ``` ### 手動インストール @@ -140,7 +138,7 @@ docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-Docker ## 事前訓練済みモデル -**`install.sh`が正常に実行された場合、No.1 & No.2 はスキップしてかまいません.** +**`install.sh`が正常に実行された場合、No.1,2,3 はスキップしてかまいません.** 1. [GPT-SoVITS Models](https://huggingface.co/lj1995/GPT-SoVITS) から事前訓練済みモデルをダウンロードし、`GPT_SoVITS/pretrained_models` ディレクトリに配置してください. diff --git a/docs/ko/README.md b/docs/ko/README.md index 263b934d..c95b2359 100644 --- a/docs/ko/README.md +++ b/docs/ko/README.md @@ -58,7 +58,7 @@ Windows 사용자라면 (win>=10에서 테스트됨), [통합 패키지를 다 ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -bash install.sh +bash install.sh --source [--download-uvr5] ``` ### macOS @@ -66,14 +66,12 @@ bash install.sh **주의: Mac에서 GPU로 훈련된 모델은 다른 OS에서 훈련된 모델에 비해 품질이 낮습니다. 해당 문제를 해결하기 전까지 MacOS에선 CPU를 사용하여 훈련을 진행합니다.** 1. `xcode-select --install`을 실행하여 Xcode 커맨드라인 도구를 설치하세요. -2. `brew install ffmpeg` 명령어를 실행하여 FFmpeg를 설치합니다. -3. 위의 단계를 완료한 후, 다음 명령어를 실행하여 이 프로젝트를 설치하세요. +2. 다음 명령어를 실행하여 이 프로젝트를 설치하세요. ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -pip install -r extra-req.txt --no-deps -pip install -r requirements.txt +bash install.sh --source [--download-uvr5] ``` ### 수동 설치 @@ -145,7 +143,7 @@ docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-Docker ## 사전 학습된 모델 -**`install.sh`가 성공적으로 실행되면 No.1 & No.2 은 건너뛰어도 됩니다.** +**`install.sh`가 성공적으로 실행되면 No.1,2,3 은 건너뛰어도 됩니다.** 1. [GPT-SoVITS Models](https://huggingface.co/lj1995/GPT-SoVITS) 에서 사전 학습된 모델을 다운로드하고, `GPT_SoVITS/pretrained_models` 디렉토리에 배치하세요. diff --git a/docs/tr/README.md b/docs/tr/README.md index 5ae3f6cc..2214af47 100644 --- a/docs/tr/README.md +++ b/docs/tr/README.md @@ -60,7 +60,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 +bash install.sh --source [--download-uvr5] ``` ### macOS @@ -68,14 +68,12 @@ bash install.sh **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. FFmpeg'i yüklemek için `brew install ffmpeg` komutunu çalıştırın. -3. Aşağıdaki komutları çalıştırarak programı yükleyin: +2. Aşağıdaki komutları çalıştırarak programı yükleyin: ```bash conda create -n GPTSoVits python=3.9 conda activate GPTSoVits -pip install -r extra-req.txt --no-deps -pip install -r requirements.txt +bash install.sh --source [--download-uvr5] ``` ### El ile Yükleme @@ -140,7 +138,7 @@ docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-Docker ## Önceden Eğitilmiş Modeller -**Eğer `install.sh` başarıyla çalıştırılırsa, No.1 & No.2 adımını atlayabilirsiniz.** +**Eğer `install.sh` başarıyla çalıştırılırsa, No.1,2,3 adımını atlayabilirsiniz.** 1. [GPT-SoVITS Models](https://huggingface.co/lj1995/GPT-SoVITS) üzerinden önceden eğitilmiş modelleri indirip `GPT_SoVITS/pretrained_models` dizinine yerleştirin. diff --git a/install.sh b/install.sh index 3147c3ec..8684d766 100644 --- a/install.sh +++ b/install.sh @@ -9,6 +9,92 @@ set -e trap 'echo "Error Occured at \"$BASH_COMMAND\" with exit code $?"; exit 1' ERR +is_HF=false +is_HF_MIRROR=false +is_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 "" + echo "Examples:" + echo " bash install.sh --source HF --download-uvr5" + echo " bash install.sh --source ModelScope" +} + +# Show help if no arguments provided +if [[ $# -eq 0 ]]; then + print_help + exit 0 +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 + ;; + --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 + +if ! $is_HF && ! $is_HF_MIRROR && ! $is_MODELSCOPE; then + echo "Error: Download Source is REQUIRED" + echo "" + print_help + exit 1 +fi + +if $is_HF; 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" + LANG_DETECT_URL="https://huggingface.co/XXXXRT/GPT-SoVITS-Pretrained/blob/main/lid.176.bin.zip" +elif $is_HF_MIRROR; then + 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" + LANG_DETECT_URL="https://hf-mirror.com/XXXXRT/GPT-SoVITS-Pretrained/blob/main/lid.176.bin.zip" +elif $is_MODELSCOPE; then + PRETRINED_URL="https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/pretrained_models.zip" + G2PW_URL="https://www.modelscope.cn/models/XXXXRT/GSV-G2PW/resolve/master/G2PWModel.zip" + UVR5_URL="https://www.modelscope.cn/models/XXXXRT/UVR5Weights4GSV/resolve/master/uvr5_weights.zip" + LANG_DETECT_URL="https://www.modelscope.cn/models/XXXXRT/GSV-Lang-Detect/resolve/master/lid.176.bin.zip" +fi + # 安装构建工具 # Install build tools echo "Installing GCC..." @@ -31,7 +117,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 "https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/pretrained_models.zip" + wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$PRETRINED_URL" unzip pretrained_models.zip rm -rf pretrained_models.zip @@ -42,25 +128,39 @@ fi # Download G2PW Models if [ ! -d "GPT_SoVITS/text/G2PWModel" ]; then echo "Download G2PWModel" - wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "https://www.modelscope.cn/models/kamiorinn/g2pw/resolve/master/G2PWModel_1.1.zip" + wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$G2PW_URL" - unzip G2PWModel_1.1.zip - rm -rf G2PWModel_1.1.zip - mv G2PWModel_1.1 GPT_SoVITS/text/G2PWModel + unzip G2PWModel.zip + rm -rf G2PWModel.zip + mv G2PWModel GPT_SoVITS/text/G2PWModel else echo "G2PWModel Exists" fi if [ ! -d "GPT_SoVITS/pretrained_models/fast_langdetect" ]; then echo "Download Fast Langdetect Model" - wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin" + wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$LANG_DETECT_URL" + unzip lid.176.bin.zip + rm -rf lid.176.bin.zip mkdir "GPT_SoVITS/pretrained_models/fast_langdetect" mv "lid.176.bin" "GPT_SoVITS/pretrained_models/fast_langdetect" else echo "Fast Langdetect Model Exists" fi +if [ "$DOWNLOAD_UVR5" = "true" ] && find "tools/uvr5/uvr5_weights" -mindepth 1 ! -name '.gitignore' | grep -q .; then + echo "Download UVR5 Model" + wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404 "$UVR5_URL" + + unzip uvr5_weights.zip + rm -rf uvr5_weights.zip + mv uvr5_weights/* tools/uvr5/uvr5_weights + rm -rf uvr5_weights +else + echo "UVR5 Model Exists" +fi + # 设置编译环境 # Set up build environment export CMAKE_MAKE_PROGRAM="$CONDA_PREFIX/bin/cmake"