added rvc-python

This commit is contained in:
deffcolony
2025-05-02 14:39:35 +02:00
parent 773d7dab71
commit 8d3c46e0e0
5 changed files with 395 additions and 0 deletions

View File

@@ -93,6 +93,21 @@ if exist "%xtts_modules_path%" (
)
)
REM Define variables to track module status (RVC-PYTHON)
set "rvc_python_modules_path=%~dp0bin\settings\modules-rvc-python.txt"
set "rvc_python_cuda_trigger=false"
set "rvc_python_harvest_trigger=false"
set "rvc_python_listen_trigger=false"
set "rvc_python_preload_trigger=false"
if exist "%rvc_python_modules_path%" (
for /f "tokens=1,* delims==" %%A in ('type "%rvc_python_modules_path%"') do (
set "%%A=%%B"
)
)
REM Define variables to track module status (STABLE DIFFUSION WEBUI)
set "sdwebui_modules_path=%~dp0bin\settings\modules-sdwebui.txt"
set "sdwebui_autolaunch_trigger=false"
@@ -208,6 +223,7 @@ set "alltalk_install_path=%voice_generation_dir%\alltalk_tts"
set "alltalk_v2_install_path=%voice_generation_dir%\alltalk_tts"
set "xtts_install_path=%voice_generation_dir%\xtts"
set "rvc_install_path=%voice_generation_dir%\Retrieval-based-Voice-Conversion-WebUI"
set "rvc_python_install_path=%voice_generation_dir%\rvc-python"
REM Define variables for the core directories
set "bin_dir=%~dp0bin"
@@ -367,6 +383,15 @@ REM Load modules-xtts flags from modules-xtts
for /f "tokens=*" %%a in (%xtts_modules_path%) do set "%%a"
REM Create modules-rvc-python if it doesn't exist
if not exist %rvc_python_modules_path% (
type nul > %rvc_python_modules_path%
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Created text file: "modules-rvc-python.txt"
)
REM Load modules-xtts flags from modules-xtts
for /f "tokens=*" %%a in (%rvc_python_modules_path%) do set "%%a"
REM Create modules-sdwebui if it doesn't exist
if not exist %sdwebui_modules_path% (
type nul > %sdwebui_modules_path%
@@ -1685,6 +1710,7 @@ echo %cyan_fg_strong%^| What would you like to do?
echo 1. AllTalk [Launch Options]
echo 2. Start XTTS
echo 3. RVC [Launch Options]
echo 4. Start RVC-Python
echo %cyan_fg_strong% ______________________________________________________________%reset%
echo %cyan_fg_strong%^| Menu Options: ^|%reset%
echo 0. Back
@@ -1716,6 +1742,19 @@ if "%app_launcher_voice_generation_choice%"=="1" (
)
) else if "%app_launcher_voice_generation_choice%"=="3" (
call :app_launcher_voice_generation_rvc
) else if "%app_launcher_voice_generation_choice%"=="4" (
set "caller=app_launcher_voice_generation"
if exist "%app_launcher_voice_generation_dir%\start_rvc_python.bat" (
call %app_launcher_voice_generation_dir%\start_rvc_python.bat
goto :home
) else (
echo [%DATE% %TIME%] ERROR: start_rvc_python.bat not found in: app_launcher_voice_generation_dir% >> %logs_stl_console_path%
echo %red_bg%[%time%]%reset% %red_fg_strong%[ERROR] start_rvc_python.bat not found in: %app_launcher_voice_generation_dir%%reset%
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Running Automatic Repair...
git pull
pause
goto :home
)
) else if "%app_launcher_voice_generation_choice%"=="0" (
goto :app_launcher
) else (
@@ -2716,6 +2755,7 @@ echo 1. Install AllTalk V2
echo 2. Install AllTalk
echo 3. Install XTTS
echo 4. Install RVC
echo 5. Install RVC-Python
echo %cyan_fg_strong% ______________________________________________________________%reset%
echo %cyan_fg_strong%^| Menu Options: ^|%reset%
echo 0. Back
@@ -2775,6 +2815,17 @@ if "%app_installer_voice_gen_choice%"=="1" (
pause
goto :app_installer_voice_generation
)
) else if "%app_installer_voice_gen_choice%"=="5" (
set "caller=app_installer_voice_generation"
if exist "%app_installer_voice_generation_dir%\install_rvc_python.bat" (
call %app_installer_voice_generation_dir%\install_rvc_python.bat
goto :app_installer_voice_generation
) else (
echo [%DATE% %TIME%] ERROR: install_rvc_python.bat not found in: %app_installer_voice_generation_dir% >> %logs_stl_console_path%
echo %red_bg%[%time%]%reset% %red_fg_strong%[ERROR] install_rvc_python.bat not found in: %app_installer_voice_generation_dir%%reset%
pause
goto :app_installer_voice_generation
)
) else if "%app_installer_voice_gen_choice%"=="0" (
goto :app_installer
) else (
@@ -4292,6 +4343,7 @@ echo %cyan_fg_strong% __________________________________________________________
echo %cyan_fg_strong%^| What would you like to do? ^|%reset%
echo 1. Edit XTTS Modules
echo 2. Edit RVC-PYTHON Modules
echo %cyan_fg_strong% ______________________________________________________________%reset%
echo %cyan_fg_strong%^| Menu Options: ^|%reset%
@@ -4318,6 +4370,17 @@ if "%editor_voice_generation_choice%"=="1" (
pause
goto :editor_voice_generation
)
) else if "%editor_voice_generation_choice%"=="2" (
set "caller=editor_voice_generation"
if exist "%editor_voice_generation_dir%\edit_rvc_python_modules.bat" (
call %editor_voice_generation_dir%\edit_rvc_python_modules.bat
goto :editor_voice_generation
) else (
echo [%DATE% %TIME%] ERROR: edit_rvc_python_modules.bat not found in: %editor_voice_generation_dir% >> %logs_stl_console_path%
echo %red_bg%[%time%]%reset% %red_fg_strong%[ERROR] edit_rvc_python_modules.bat not found in: %editor_voice_generation_dir%%reset%
pause
goto :editor_voice_generation
)
) else if "%editor_voice_generation_choice%"=="0" (
goto :editor
) else (

View File

@@ -0,0 +1,133 @@
@echo off
:install_rvc_python
title STL [INSTALL RVC PYTHON]
cls
echo %blue_fg_strong%/ Home / Install RVC Python%reset%
echo ---------------------------------------------------------------
REM GPU menu - Frontend
echo What is your GPU?
echo 1. NVIDIA
echo 2. AMD
echo 3. AMD/Intel DirectML
echo 4. Intel Arc IPEX
echo 0. Cancel
setlocal enabledelayedexpansion
chcp 65001 > nul
REM Get GPU information
for /f "skip=1 delims=" %%i in ('wmic path win32_videocontroller get caption') do (
set "gpu_info=!gpu_info! %%i"
)
echo.
echo %blue_bg%╔════ GPU INFO ═════════════════════════════════╗%reset%
echo %blue_bg%║ ║%reset%
echo %blue_bg%║* %gpu_info:~1%%reset%
echo %blue_bg%║ ║%reset%
echo %blue_bg%╚═══════════════════════════════════════════════╝%reset%
echo.
endlocal
set /p gpu_choice=Enter number corresponding to your GPU:
REM GPU menu - Backend
REM Set the GPU choice in an environment variable for choise callback
set "GPU_CHOICE=%gpu_choice%"
REM Check the user's response
if "%gpu_choice%"=="1" (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% GPU choice set to: NVIDIA
goto :install_rvc_python_pre
) else if "%gpu_choice%"=="2" (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% GPU choice set to: AMD
goto :install_rvc_python_pre
) else if "%gpu_choice%"=="3" (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% GPU choice set to: AMD/Intel DirectML
goto :install_rvc_python_pre
) else if "%gpu_choice%"=="4" (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% GPU choice set to: Intel Arc IPEX
goto :install_rvc_python_pre
) else if "%gpu_choice%"=="0" (
goto :app_installer_voice_generation
) else (
echo %red_bg%[%time%]%reset% %red_fg_strong%[ERROR] Invalid input. Please enter a valid number.%reset%
pause
goto :install_rvc_python
)
:install_rvc_python_pre
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Installing RVC...
REM Check if the folder exists
if not exist "%voice_generation_dir%" (
mkdir "%voice_generation_dir%"
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Created folder: "voice-generation"
) else (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO] "voice-generation" folder already exists.%reset%
)
cd /d "%voice_generation_dir%"
set max_retries=3
set retry_count=0
:retry_install_rvc_python
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Cloning the rvc-python repository...
git clone https://github.com/daswer123/rvc-python.git
if %errorlevel% neq 0 (
set /A retry_count+=1
echo %yellow_bg%[%time%]%reset% %yellow_fg_strong%[WARN] Retry %retry_count% of %max_retries%%reset%
if %retry_count% lss %max_retries% goto :retry_install_rvc_python
echo %red_bg%[%time%]%reset% %red_fg_strong%[ERROR] Failed to clone repository after %max_retries% retries.%reset%
pause
goto :home
)
cd /d "%rvc_python_install_path%"
REM Run conda activate from the Miniconda installation
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Activating Miniconda environment...
call "%miniconda_path%\Scripts\activate.bat"
REM Create a Conda environment named rvcpython
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Creating Conda environment: %cyan_fg_strong%rvcpython%reset%
call conda create -n rvcpython python=3.10.9 -y
REM Activate the rvcpython environment
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Activating Conda environment: %cyan_fg_strong%rvcpython%reset%
call conda activate rvcpython
REM Downgrade pip to version 24.0.0 because fairseq from facebookresearch fails at pip-24.2
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Downgrading pip-24.2 to: %cyan_fg_strong%pip-24.0%reset%
python -m pip install pip==24.0.0
REM Use the GPU choice made earlier to install requirements for rvcpython
if "%GPU_CHOICE%"=="1" (
echo %blue_bg%[%time%]%reset% %cyan_fg_strong%[rvcpython]%reset% %blue_fg_strong%[INFO]%reset% Installing NVIDIA version from requirements.txt in conda enviroment: %cyan_fg_strong%rvc%reset%
pip install torch==2.1.1+cu118 torchaudio==2.1.1+cu118 --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt
goto :install_rvc_python_final
) else if "%GPU_CHOICE%"=="2" (
echo %blue_bg%[%time%]%reset% %cyan_fg_strong%[rvcpython]%reset% %blue_fg_strong%[INFO]%reset% Installing AMD version from requirements-amd.txt in conda enviroment: %cyan_fg_strong%rvc%reset%
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.6
pip install -r requirements.txt
goto :install_rvc_python_final
) else if "%GPU_CHOICE%"=="3" (
echo %blue_bg%[%time%]%reset% %cyan_fg_strong%[rvcpython]%reset% %blue_fg_strong%[INFO]%reset% Installing AMD/Intel DirectML version from requirements-dml.txt in conda enviroment: %cyan_fg_strong%rvc%reset%
pip install torch torchvision torchaudio
pip install -r requirements.txt
goto :install_rvc_python_final
) else if "%GPU_CHOICE%"=="4" (
echo %blue_bg%[%time%]%reset% %cyan_fg_strong%[rvcpython]%reset% %blue_fg_strong%[INFO]%reset% Installing Intel Arc IPEX version from requirements-ipex.txt in conda enviroment: %cyan_fg_strong%rvc%reset%
pip install torch torchvision torchaudio
pip install -r requirements.txt
goto :install_rvc_python_final
)
:install_rvc_python_final
REM Install pip packages that are not in requirements list
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Installing pip modules
pip install rvc-python
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% %green_fg_strong%RVC successfully installed.%reset%
echo %yellow_bg%[%time%]%reset% %yellow_fg_strong%[WARN] In order to start RVC correctly please install FFMPEG from: / Home / Toolbox / App Installer / Core Utilities / Install FFmpeg%reset%
pause
goto :app_installer_voice_generation

View File

@@ -0,0 +1,41 @@
@echo off
:start_rvc_python
REM Activate the rvc-python environment
call conda activate rvc-python
REM Start rvc-python
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% rvc-python launched in a new window.
REM Read modules-rvc-python and find the rvc_python_start_command line
set "rvc_python_start_command="
for /F "tokens=*" %%a in ('findstr /I "rvc_python_start_command=" "%rvc_python_modules_path%"') do (
set "%%a"
)
if not defined rvc_python_start_command (
echo %red_bg%[%time%]%reset% %red_fg_strong%[ERROR] No modules enabled.%reset%
echo %red_bg%Please make sure you enabled at least one of the modules from Edit rvc-python Modules.%reset%
echo.
echo %blue_bg%We will redirect you to the Edit rvc-python Modules menu.%reset%
pause
set "caller=editor_image_generation"
if exist "%editor_voice_generation_dir%\edit_rvc_python_modules.bat" (
call %editor_voice_generation_dir%\edit_rvc_python_modules.bat
goto :home
) else (
echo [%DATE% %TIME%] ERROR: edit_rvc_python_modules.bat not found in: editor_voice_generation_dir% >> %logs_stl_console_path%
echo %red_bg%[%time%]%reset% %red_fg_strong%[ERROR] edit_rvc_python_modules.bat not found in: %editor_voice_generation_dir%%reset%
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Running Automatic Repair...
git pull
pause
goto :home
)
)
set "rvc_python_start_command=%rvc_python_start_command:rvc_python_start_command=%"
start cmd /k "title RVC-Python && cd /d %rvc_python_install_path% && %rvc_python_start_command%"
goto :home

View File

@@ -0,0 +1,36 @@
@echo off
:uninstall_rvc_python
title STL [UNINSTALL RVC-PYTHON]
setlocal enabledelayedexpansion
chcp 65001 > nul
REM Confirm with the user before proceeding
echo.
echo %red_bg%╔════ DANGER ZONE ══════════════════════════════════════════════════════════════════════════════╗%reset%
echo %red_bg%║ WARNING: This will delete all data of RVC-Python ║%reset%
echo %red_bg%║ If you want to keep any data, make sure to create a backup before proceeding. ║%reset%
echo %red_bg%╚═══════════════════════════════════════════════════════════════════════════════════════════════╝%reset%
echo.
set /p "confirmation=Are you sure you want to proceed? [Y/N]: "
if /i "%confirmation%"=="Y" (
REM Remove the Conda environment
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Removing the Conda enviroment: %cyan_fg_strong%rvc%reset%
call conda deactivate
call conda remove --name rvcpython --all -y
call conda clean -a -y
REM Remove the folder
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Removing the rvc-python directory...
cd /d "%~dp0"
rmdir /s /q "%rvc_python_install_path%"
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% %green_fg_strong%rvc-python has been uninstalled successfully.%reset%
pause
goto :app_uninstaller_voice_generation
) else (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Uninstall canceled.
pause
goto :app_uninstaller_voice_generation
)

View File

@@ -0,0 +1,122 @@
@echo off
REM ############################################################
REM ############## EDIT rvc-python MODULES - FRONTEND ##########
REM ############################################################
:edit_rvc_python_modules
title STL [EDIT RVC-PYTHON MODULES]
cls
echo %blue_fg_strong%/ Home / Toolbox / Editor / Voice Generation / Edit RVC-PYTHON Modules%reset%
echo -------------------------------------------------------------
echo Choose RVC modules to enable or disable (e.g., "1 2 4" to enable CUDA, Harvest, and Preload Model)
REM Display module options with colors based on their status
call :printModule "1. CUDA (--device cuda:0)" %rvc_python_cuda_trigger%
call :printModule "2. Harvest Method (--method harvest)" %rvc_python_harvest_trigger%
call :printModule "3. Listen (--listen)" %rvc_python_listen_trigger%
call :printModule "4. Preload Model (--preload-model)" %rvc_python_preload_trigger%
echo 00. Quick Start RVC-Python
echo 0. Back
set "python_command="
set /p rvc_python_module_choices=Choose modules to enable/disable:
REM Handle the user's module choices and construct the Python command
for %%i in (%rvc_python_module_choices%) do (
if "%%i"=="1" (
if "%rvc_python_cuda_trigger%"=="true" (
set "rvc_python_cuda_trigger=false"
) else (
set "rvc_python_cuda_trigger=true"
)
) else if "%%i"=="2" (
if "%rvc_python_harvest_trigger%"=="true" (
set "rvc_python_harvest_trigger=false"
) else (
set "rvc_python_harvest_trigger=true"
)
) else if "%%i"=="3" (
if "%rvc_python_listen_trigger%"=="true" (
set "rvc_python_listen_trigger=false"
) else (
set "rvc_python_listen_trigger=true"
)
) else if "%%i"=="4" (
if "%rvc_python_preload_trigger%"=="true" (
set "rvc_python_preload_trigger=false"
) else (
set "rvc_python_preload_trigger=true"
)
) else if "%%i"=="00" (
set "caller=app_launcher_voice_generation"
if exist "%app_launcher_voice_generation_dir%\start_rvc_python.bat" (
call %app_launcher_voice_generation_dir%\start_rvc_python.bat
goto :home
) else (
echo [%DATE% %TIME%] ERROR: start_rvc_python.bat not found in: app_launcher_voice_generation_dir% >> %logs_stl_console_path%
echo %red_bg%[%time%]%reset% %red_fg_strong%[ERROR] start_rvc_python.bat not found in: %app_launcher_voice_generation_dir%%reset%
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Running Automatic Repair...
git pull
pause
goto :edit_rvc_python_modules
)
) else if "%%i"=="0" (
goto :editor_voice_generation
)
)
REM Save the module flags to rvc-python
echo rvc_python_cuda_trigger=%rvc_python_cuda_trigger%>%rvc_python_modules_path%
echo rvc_python_harvest_trigger=%rvc_python_harvest_trigger%>>%rvc_python_modules_path%
echo rvc_python_listen_trigger=%rvc_python_listen_trigger%>>%rvc_python_modules_path%
echo rvc_python_preload_trigger=%rvc_python_preload_trigger%>>%rvc_python_modules_path%
REM remove modules_enable
set "modules_enable="
REM Compile the Python command (default to API mode; adjust for CLI if needed)
set "python_command=python -m rvc_python api"
if "%rvc_python_cuda_trigger%"=="true" (
set "python_command=%python_command% --device cuda:0"
) else (
set "python_command=%python_command% --device cpu"
)
if "%rvc_python_harvest_trigger%"=="true" (
set "python_command=%python_command% --method harvest"
)
if "%rvc_python_listen_trigger%"=="true" (
set "python_command=%python_command% --listen"
)
if "%rvc_python_preload_trigger%"=="true" (
set "python_command=%python_command% --preload-model default_model.pth"
)
REM is modules_enable empty?
if defined modules_enable (
REM remove last comma
set "modules_enable=%modules_enable:~0,-1%"
)
REM command completed
if defined modules_enable (
set "python_command=%python_command% --enable-modules=%modules_enable%"
)
REM Save the constructed Python command to rvc-python for testing
echo rvc_python_start_command=%python_command%>>%rvc_python_modules_path%
goto :edit_rvc_python_modules
REM Function to print module options with color based on their status
:printModule
if "%2"=="true" (
echo %green_fg_strong%%1 [Enabled]%reset%
) else (
echo %red_fg_strong%%1 [Disabled]%reset%
)
exit /b