Improve bat, replace MinGit with PortableGit

This commit is contained in:
litagin02
2024-03-16 15:25:19 +09:00
parent 8a8cd1dcaf
commit 5eef8843cc
5 changed files with 215 additions and 88 deletions

3
.gitignore vendored
View File

@@ -6,9 +6,6 @@ dist/
.ipynb_checkpoints/ .ipynb_checkpoints/
.ruff_cache/ .ruff_cache/
/Data/
/model_assets/
/*.yml /*.yml
!/default_config.yml !/default_config.yml
/bert/*/*.bin /bert/*/*.bin

View File

@@ -78,6 +78,7 @@ def download_jvnv_models():
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--skip_jvnv", action="store_true") parser.add_argument("--skip_jvnv", action="store_true")
parser.add_argument("--only_infer", action="store_true")
parser.add_argument( parser.add_argument(
"--dataset_root", "--dataset_root",
type=str, type=str,
@@ -94,14 +95,12 @@ def main():
download_bert_models() download_bert_models()
download_slm_model()
download_pretrained_models()
download_jp_extra_pretrained_models()
if not args.skip_jvnv: if not args.skip_jvnv:
download_jvnv_models() download_jvnv_models()
if not args.only_infer:
download_slm_model()
download_pretrained_models()
download_jp_extra_pretrained_models()
if args.dataset_root is None and args.assets_root is None: if args.dataset_root is None and args.assets_root is None:
return return

View File

@@ -2,11 +2,14 @@ chcp 65001 > NUL
@echo off @echo off
setlocal setlocal
@REM PowerShellのコマンド
set PS_CMD=PowerShell -NoProfile -NoLogo -ExecutionPolicy Bypass set PS_CMD=PowerShell -NoProfile -NoLogo -ExecutionPolicy Bypass
set DL_URL=https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/MinGit-2.44.0-64-bit.zip @REM PortableGitのURLと保存先
set DL_DST=MinGit-2.44.0-64-bit.zip set DL_URL=https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/PortableGit-2.44.0-64-bit.7z.exe
set DL_DST=%~dp0lib\PortableGit-2.44.0-64-bit.7z.exe
@REM Style-Bert-VITS2のリポジトリURL
set REPO_URL=https://github.com/litagin02/Style-Bert-VITS2 set REPO_URL=https://github.com/litagin02/Style-Bert-VITS2
@REM カレントディレクトリをbatファイルのディレクトリに変更 @REM カレントディレクトリをbatファイルのディレクトリに変更
@@ -16,63 +19,100 @@ pushd %~dp0
if not exist lib\ ( mkdir lib ) if not exist lib\ ( mkdir lib )
echo -------------------------------------------------- echo --------------------------------------------------
echo Downloading MinGit... echo PS_CMD: %PS_CMD%
echo DL_URL: %DL_URL%
echo DL_DST: %DL_DST%
echo REPO_URL: %REPO_URL%
echo -------------------------------------------------- echo --------------------------------------------------
curl -L %DL_URL% -o "%DL_DST%" echo.
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
@REM lib\MinGitフォルダに解凍
echo --------------------------------------------------
echo Extracting MinGit...
echo --------------------------------------------------
%PS_CMD% "Expand-Archive -LiteralPath %DL_DST% -DestinationPath .\lib\MinGit -Force"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
del %DL_DST%
@REM Gitコマンドのパスを設定
set PATH=%~dp0lib\MinGit\cmd;%PATH%
echo -------------------------------------------------- echo --------------------------------------------------
echo Checking Git Installation... echo Checking Git Installation...
echo -------------------------------------------------- echo --------------------------------------------------
echo Executing: git --version
pause
git --version git --version
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if %errorlevel% neq 0 (
echo --------------------------------------------------
echo Git is not installed, so download and use PortableGit.
echo Downloading PortableGit...
echo --------------------------------------------------
echo Executing: curl -L %DL_URL% -o "%DL_DST%"
pause
curl -L %DL_URL% -o "%DL_DST%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
echo --------------------------------------------------
echo Extracting PortableGit...
echo --------------------------------------------------
echo Executing: "%DL_DST%" -y
pause
"%DL_DST%" -y
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
echo --------------------------------------------------
echo Removing %DL_DST%...
echo --------------------------------------------------
echo Executing: del "%DL_DST%"
pause
del "%DL_DST%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
@REM Gitコマンドのパスを設定
echo --------------------------------------------------
echo Setting up PATH...
echo --------------------------------------------------
echo Executing: set "PATH=%~dp0lib\PortableGit\bin;%PATH%"
pause
set "PATH=%~dp0lib\PortableGit\bin;%PATH%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
echo --------------------------------------------------
echo Checking Git Installation...
echo --------------------------------------------------
echo Executing: git --version
pause
git --version
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
)
echo -------------------------------------------------- echo --------------------------------------------------
echo Cloning repository... echo Cloning repository...
echo -------------------------------------------------- echo --------------------------------------------------
echo Executing: git clone %REPO_URL%
pause
git clone %REPO_URL% git clone %REPO_URL%
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
@REM Pythonのセットアップ、仮想環境が有効化されて戻って来る
echo -------------------------------------------------- echo --------------------------------------------------
echo Setting up Python environment... echo Setting up Python environment...
echo -------------------------------------------------- echo --------------------------------------------------
echo Executing: call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv"
call Style-Bert-VITS2\scripts\Setup-Python.bat ..\..\lib\python ..\venv pause
call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv"
if %errorlevel% neq 0 ( popd & exit /b %errorlevel% ) if %errorlevel% neq 0 ( popd & exit /b %errorlevel% )
@REM Style-Bert-VITS2フォルダに移動
pushd Style-Bert-VITS2
echo -------------------------------------------------- echo --------------------------------------------------
echo Installing dependencies... echo Installing dependencies...
echo -------------------------------------------------- echo --------------------------------------------------
pip install -r Style-Bert-VITS2\requirements.txt echo Executing: pip install -r requirements.txt
pause
pip install -r requirements.txt
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
echo ---------------------------------------- echo ----------------------------------------
echo Environment setup is complete. Start downloading the model. echo Environment setup is complete. Start downloading the model.
echo ---------------------------------------- echo ----------------------------------------
echo Executing: python initialize.py
@REM Style-Bert-VITS2フォルダに移動 python initialize.py --only_infer
pushd Style-Bert-VITS2
@REM 初期化(必要なモデルのダウンロード)
python initialize.py
echo ---------------------------------------- echo ----------------------------------------
echo Model download is complete. Start Style-Bert-VITS2 Editor. echo Model download is complete. Start Style-Bert-VITS2 Editor.
echo ---------------------------------------- echo ----------------------------------------
echo Executing: python server_editor.py --inbrowser
@REM エディターの起動
python server_editor.py --inbrowser python server_editor.py --inbrowser
pause pause
@@ -80,4 +120,4 @@ popd
popd popd
endlocal endlocal

View File

@@ -2,11 +2,14 @@ chcp 65001 > NUL
@echo off @echo off
setlocal setlocal
@REM PowerShellのコマンド
set PS_CMD=PowerShell -NoProfile -NoLogo -ExecutionPolicy Bypass set PS_CMD=PowerShell -NoProfile -NoLogo -ExecutionPolicy Bypass
set DL_URL=https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/MinGit-2.44.0-64-bit.zip @REM PortableGitのURLと保存先
set DL_DST=MinGit-2.44.0-64-bit.zip set DL_URL=https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/PortableGit-2.44.0-64-bit.7z.exe
set DL_DST=%~dp0lib\PortableGit-2.44.0-64-bit.7z.exe
@REM Style-Bert-VITS2のリポジトリURL
set REPO_URL=https://github.com/litagin02/Style-Bert-VITS2 set REPO_URL=https://github.com/litagin02/Style-Bert-VITS2
@REM カレントディレクトリをbatファイルのディレクトリに変更 @REM カレントディレクトリをbatファイルのディレクトリに変更
@@ -16,69 +19,108 @@ pushd %~dp0
if not exist lib\ ( mkdir lib ) if not exist lib\ ( mkdir lib )
echo -------------------------------------------------- echo --------------------------------------------------
echo Downloading MinGit... echo PS_CMD: %PS_CMD%
echo DL_URL: %DL_URL%
echo DL_DST: %DL_DST%
echo REPO_URL: %REPO_URL%
echo -------------------------------------------------- echo --------------------------------------------------
curl -L %DL_URL% -o "%DL_DST%" echo.
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
@REM lib\MinGitフォルダに解凍
echo --------------------------------------------------
echo Extracting MinGit...
echo --------------------------------------------------
%PS_CMD% "Expand-Archive -LiteralPath %DL_DST% -DestinationPath .\lib\MinGit -Force"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
del %DL_DST%
@REM Gitコマンドのパスを設定
set PATH=%~dp0lib\MinGit\cmd;%PATH%
echo -------------------------------------------------- echo --------------------------------------------------
echo Checking Git Installation... echo Checking Git Installation...
echo -------------------------------------------------- echo --------------------------------------------------
echo Executing: git --version
pause
git --version git --version
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if %errorlevel% neq 0 (
echo --------------------------------------------------
echo Git is not installed, so download and use PortableGit.
echo Downloading PortableGit...
echo --------------------------------------------------
echo Executing: curl -L %DL_URL% -o "%DL_DST%"
pause
curl -L %DL_URL% -o "%DL_DST%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
echo --------------------------------------------------
echo Extracting PortableGit...
echo --------------------------------------------------
echo Executing: "%DL_DST%" -y
pause
"%DL_DST%" -y
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
echo --------------------------------------------------
echo Removing %DL_DST%...
echo --------------------------------------------------
echo Executing: del "%DL_DST%"
pause
del "%DL_DST%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
@REM Gitコマンドのパスを設定
echo --------------------------------------------------
echo Setting up PATH...
echo --------------------------------------------------
echo Executing: set "PATH=%~dp0lib\PortableGit\bin;%PATH%"
pause
set "PATH=%~dp0lib\PortableGit\bin;%PATH%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
echo --------------------------------------------------
echo Checking Git Installation...
echo --------------------------------------------------
echo Executing: git --version
pause
git --version
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
)
echo -------------------------------------------------- echo --------------------------------------------------
echo Cloning repository... echo Cloning repository...
echo -------------------------------------------------- echo --------------------------------------------------
echo Executing: git clone %REPO_URL%
pause
git clone %REPO_URL% git clone %REPO_URL%
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
@REM Pythonのセットアップ、仮想環境が有効化されて戻って来る
echo -------------------------------------------------- echo --------------------------------------------------
echo Setting up Python environment... echo Setting up Python environment...
echo -------------------------------------------------- echo --------------------------------------------------
echo Executing: call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv"
call Style-Bert-VITS2\scripts\Setup-Python.bat ..\..\lib\python ..\venv pause
call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv"
if %errorlevel% neq 0 ( popd & exit /b %errorlevel% ) if %errorlevel% neq 0 ( popd & exit /b %errorlevel% )
@REM Style-Bert-VITS2フォルダに移動
pushd Style-Bert-VITS2
echo -------------------------------------------------- echo --------------------------------------------------
echo Installing PyTorch... echo Installing PyTorch...
echo -------------------------------------------------- echo --------------------------------------------------
echo Executing: pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pause
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
echo -------------------------------------------------- echo --------------------------------------------------
echo Installing other dependencies... echo Installing other dependencies...
echo -------------------------------------------------- echo --------------------------------------------------
pip install -r Style-Bert-VITS2\requirements.txt echo Executing: pip install -r requirements.txt
pause
pip install -r requirements.txt
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
echo ---------------------------------------- echo ----------------------------------------
echo Environment setup is complete. Start downloading the model. echo Environment setup is complete. Start downloading the model.
echo ---------------------------------------- echo ----------------------------------------
echo Executing: python initialize.py
@REM Style-Bert-VITS2フォルダに移動
pushd Style-Bert-VITS2
@REM 初期化(必要なモデルのダウンロード)
python initialize.py python initialize.py
echo ---------------------------------------- echo ----------------------------------------
echo Model download is complete. Start Style-Bert-VITS2 Editor. echo Model download is complete. Start Style-Bert-VITS2 Editor.
echo ---------------------------------------- echo ----------------------------------------
echo Executing: python server_editor.py --inbrowser
@REM エディターの起動
python server_editor.py --inbrowser python server_editor.py --inbrowser
pause pause

View File

@@ -24,53 +24,102 @@ if "%2" neq "" (
set VENV_DIR=%~dp0venv set VENV_DIR=%~dp0venv
) )
echo --------------------------------------------------
echo PS_CMD: %PS_CMD% echo PS_CMD: %PS_CMD%
echo CURL_CMD: %CURL_CMD% echo CURL_CMD: %CURL_CMD%
echo PYTHON_CMD: %PYTHON_CMD% echo PYTHON_CMD: %PYTHON_CMD%
echo PYTHON_DIR: %PYTHON_DIR%
echo VENV_DIR: %VENV_DIR% echo VENV_DIR: %VENV_DIR%
echo --------------------------------------------------
if not exist %PYTHON_DIR%\ ( pause
echo https://www.python.org/
echo %CURL_CMD% -o python.zip https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip if not exist "%PYTHON_DIR%"\ (
echo --------------------------------------------------
echo Downloading Python...
echo --------------------------------------------------
echo Executing: %CURL_CMD% -o python.zip https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip
pause
%CURL_CMD% -o python.zip https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip %CURL_CMD% -o python.zip https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
echo %PS_CMD% Expand-Archive -Path python.zip -DestinationPath %PYTHON_DIR% echo --------------------------------------------------
%PS_CMD% Expand-Archive -Path python.zip -DestinationPath %PYTHON_DIR% echo Extracting zip...
echo --------------------------------------------------
echo Executing: %PS_CMD% Expand-Archive -Path python.zip -DestinationPath \"%PYTHON_DIR%\"
pause
%PS_CMD% Expand-Archive -Path python.zip -DestinationPath \"%PYTHON_DIR%\"
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
echo del python.zip echo --------------------------------------------------
echo Removing python.zip...
echo --------------------------------------------------
echo Executing: del python.zip
pause
del python.zip del python.zip
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
echo %PS_CMD% "&{(Get-Content '%PYTHON_DIR%/python310._pth') -creplace '#import site', 'import site' | Set-Content '%PYTHON_DIR%/python310._pth' }" echo --------------------------------------------------
echo Enabling 'site' module in the embedded Python environment...
echo --------------------------------------------------
echo Executing: %PS_CMD% "&{(Get-Content '%PYTHON_DIR%/python310._pth') -creplace '#import site', 'import site' | Set-Content '%PYTHON_DIR%/python310._pth' }"
pause
%PS_CMD% "&{(Get-Content '%PYTHON_DIR%/python310._pth') -creplace '#import site', 'import site' | Set-Content '%PYTHON_DIR%/python310._pth' }" %PS_CMD% "&{(Get-Content '%PYTHON_DIR%/python310._pth') -creplace '#import site', 'import site' | Set-Content '%PYTHON_DIR%/python310._pth' }"
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
echo https://github.com/pypa/get-pip echo --------------------------------------------------
echo %CURL_CMD% -o %PYTHON_DIR%\get-pip.py https://bootstrap.pypa.io/get-pip.py echo Installing pip and virtualenv...
%CURL_CMD% -o %PYTHON_DIR%\get-pip.py https://bootstrap.pypa.io/get-pip.py echo --------------------------------------------------
echo Executing: %CURL_CMD% -o "%PYTHON_DIR%\get-pip.py" https://bootstrap.pypa.io/get-pip.py
pause
%CURL_CMD% -o "%PYTHON_DIR%\get-pip.py" https://bootstrap.pypa.io/get-pip.py
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
echo %PYTHON_CMD% %PYTHON_DIR%\get-pip.py --no-warn-script-location echo --------------------------------------------------
%PYTHON_CMD% %PYTHON_DIR%\get-pip.py --no-warn-script-location echo Installing pip...
echo --------------------------------------------------
echo Executing: "%PYTHON_CMD%" "%PYTHON_DIR%\get-pip.py" --no-warn-script-location
pause
"%PYTHON_CMD%" "%PYTHON_DIR%\get-pip.py" --no-warn-script-location
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
echo %PYTHON_CMD% -m pip install virtualenv --no-warn-script-location echo --------------------------------------------------
%PYTHON_CMD% -m pip install virtualenv --no-warn-script-location echo Installing virtualenv...
echo --------------------------------------------------
echo Executing: "%PYTHON_CMD%" -m pip install virtualenv --no-warn-script-location
pause
"%PYTHON_CMD%" -m pip install virtualenv --no-warn-script-location
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
) )
if not exist %VENV_DIR%\ ( if not exist %VENV_DIR%\ (
echo %PYTHON_CMD% -m virtualenv --copies %VENV_DIR% echo --------------------------------------------------
%PYTHON_CMD% -m virtualenv --copies %VENV_DIR% echo Creating virtual environment...
echo --------------------------------------------------
echo Executing: "%PYTHON_CMD%" -m virtualenv --copies "%VENV_DIR%"
pause
"%PYTHON_CMD%" -m virtualenv --copies "%VENV_DIR%"
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
) )
echo call %VENV_DIR%\Scripts\activate.bat echo --------------------------------------------------
call %VENV_DIR%\Scripts\activate.bat echo Actibating virtual environment...
echo --------------------------------------------------
echo Executing: call "%VENV_DIR%\Scripts\activate.bat"
pause
call "%VENV_DIR%\Scripts\activate.bat"
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
echo python -m pip install --upgrade pip echo --------------------------------------------------
echo Upgrading pip...
echo --------------------------------------------------
echo Executing: python -m pip install --upgrade pip
pause
python -m pip install --upgrade pip python -m pip install --upgrade pip
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
echo --------------------------------------------------
echo Completed.
echo --------------------------------------------------
pause