This commit is contained in:
AlexVeeBee
2023-12-13 20:51:30 +00:00
3 changed files with 112 additions and 55 deletions

View File

@@ -51,7 +51,7 @@ set "miniconda_path=%userprofile%\miniconda3"
REM Define variables to track module status
set "modules_path=%~dp0modules.txt"
set "xtts_trigger=false"
set "cuda_trigger=false"
set "rvc_trigger=false"
set "talkinghead_trigger=false"
set "caption_trigger=false"
@@ -138,12 +138,13 @@ echo %blue_fg_strong%/ Home%reset%
echo -------------------------------------
echo What would you like to do?
echo 1. Start SillyTavern
echo 2. Start SillyTavern + Extras
echo 3. Update
echo 4. Backup
echo 5. Switch branch
echo 6. Toolbox
echo 7. Exit
echo 2. Start Extras
echo 3. Start SillyTavern + Extras
echo 4. Update
echo 5. Backup
echo 6. Switch branch
echo 7. Toolbox
echo 0. Exit
REM Get the current Git branch
for /f %%i in ('git branch --show-current') do set current_branch=%%i
@@ -163,16 +164,18 @@ REM Home - backend
if "%choice%"=="1" (
call :start_st
) else if "%choice%"=="2" (
call :start_st_extras
call :start_extras
) else if "%choice%"=="3" (
call :update
call :start_st_extras
) else if "%choice%"=="4" (
call :backup_menu
call :update
) else if "%choice%"=="5" (
call :switchbrance_menu
call :backup_menu
) else if "%choice%"=="6" (
call :toolbox
call :switchbrance_menu
) else if "%choice%"=="7" (
call :toolbox
) else if "%choice%"=="0" (
exit
) else (
color 6
@@ -197,6 +200,26 @@ start cmd /k "title SillyTavern && cd /d %~dp0SillyTavern && call npm install --
goto :home
:start_extras
REM Run conda activate from the Miniconda installation
call "%miniconda_path%\Scripts\activate.bat"
REM Activate the extras environment
call conda activate extras
REM Start SillyTavern Extras with desired configurations
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Extras launched in a new window.
REM read modules.txt and find the start_command line
for /F "tokens=*" %%a in ('findstr /I "start_command=" %modules_path%') do (
set %%a
)
set start_command=%start_command:start_command=%
start cmd /k "title SillyTavern Extras && cd /d %~dp0SillyTavern-extras && %start_command%"
goto :home
:start_st_extras
REM Check if Node.js is installed
node --version > nul 2>&1
@@ -211,7 +234,6 @@ echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% SillyTavern launched
start cmd /k "title SillyTavern && cd /d %~dp0SillyTavern && call npm install --no-audit && node server.js && pause && popd"
REM Run conda activate from the Miniconda installation
call "%miniconda_path%\Scripts\activate.bat"
@@ -221,27 +243,23 @@ call conda activate extras
REM Start SillyTavern Extras with desired configurations
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Extras launched in a new window.
@REM echo "Getting start command from modules.txt"
@REM @REM read modules.txt and find the start_command line
REM read modules.txt and find the start_command line
for /F "tokens=*" %%a in ('findstr /I "start_command=" %modules_path%') do (
set start_command=%%a
set %%a
)
set start_command=%start_command:start_command=%
start cmd /k "title SillyTavern Extras && cd /d %~dp0SillyTavern-extras && %start_command%"
REM Activate the xtts environment
call conda activate xtts
REM Start XTTS
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% XTTS launched in a new window.
start cmd /k "title XTTSv2 API Server && cd /d %~dp0xtts && python -m xtts_api_server"
goto :home
@REM end of start_st_extras
:update
title SillyTavern [UPDATE]
@@ -298,7 +316,7 @@ echo -------------------------------------
echo What would you like to do?
echo 1. Switch to Release - SillyTavern
echo 2. Switch to Staging - SillyTavern
echo 3. Back to Home
echo 0. Back to Home
REM Get the current Git branch
for /f %%i in ('git branch --show-current') do set current_branch=%%i
@@ -312,7 +330,7 @@ if "%brance_choice%"=="1" (
call :switch_release_st
) else if "%brance_choice%"=="2" (
call :switch_staging_st
) else if "%brance_choice%"=="3" (
) else if "%brance_choice%"=="0" (
goto :home
) else (
color 6
@@ -358,7 +376,7 @@ echo What would you like to do?
REM color 7
echo 1. Create Backup
echo 2. Restore Backup
echo 3. Back to Home
echo 0. Back to Home
set /p backup_choice=Choose Your Destiny:
@@ -367,7 +385,7 @@ if "%backup_choice%"=="1" (
call :create_backup
) else if "%backup_choice%"=="2" (
call :restore_backup
) else if "%backup_choice%"=="3" (
) else if "%backup_choice%"=="0" (
goto :home
) else (
color 6
@@ -489,7 +507,7 @@ echo 5. Edit Extras Modules
echo 6. Reinstall SillyTavern
echo 7. Reinstall Extras
echo 8. Uninstall SillyTavern + Extras
echo 9. Back to Home
echo 0. Back to Home
set /p toolbox_choice=Choose Your Destiny:
@@ -510,7 +528,7 @@ if "%toolbox_choice%"=="1" (
call :reinstall_extras
) else if "%toolbox_choice%"=="8" (
call :uninstall_st_extras
) else if "%toolbox_choice%"=="9" (
) else if "%toolbox_choice%"=="0" (
goto :home
) else (
color 6
@@ -699,30 +717,31 @@ REM Edit Extras Modules - Frontend
cls
echo %blue_fg_strong%/ Home / Toolbox / Edit Extras Modules%reset%
echo -------------------------------------
echo Choose extras modules to enable or disable (e.g., "1 2 4" to enable XTTS, RVC, and Caption)
echo Choose extras modules to enable or disable (e.g., "1 2 4" to enable Cuda, RVC, and Caption)
REM color 7
REM Display module options with colors based on their status
call :printModule "1. XTTS (xtts_api_server --gpu 0 --cuda-device=0)" %xtts_trigger%
call :printModule "1. Cuda (--cuda)" %cuda_trigger%
call :printModule "2. RVC (--enable-modules=rvc --rvc-save-file --max-content-length=1000)" %rvc_trigger%
call :printModule "3. talkinghead (--enable-modules=talkinghead)" %talkinghead_trigger%
call :printModule "3. talkinghead (--enable-modules=talkinghead --talkinghead-gpu)" %talkinghead_trigger%
call :printModule "4. caption (--enable-modules=caption)" %caption_trigger%
call :printModule "5. summarize (--enable-modules=summarize)" %summarize_trigger%
echo 6. Back to Toolbox
call :printModule "6. listen (--listen)" %listen_trigger%
echo 0. Back to Toolbox
set "python_command="
set /p module_choices=Choose modules to enable/disable (1-5):
set /p module_choices=Choose modules to enable/disable (1-6):
REM Handle the user's module choices and construct the Python command
for %%i in (%module_choices%) do (
if "%%i"=="1" (
if "%xtts_trigger%"=="true" (
set "xtts_trigger=false"
if "%cuda_trigger%"=="true" (
set "cuda_trigger=false"
) else (
set "xtts_trigger=true"
set "cuda_trigger=true"
)
REM set "python_command= xtts_api_server --gpu 0 --cuda-device=0"
REM set "python_command= --gpu 0 --cuda-device=0"
) else if "%%i"=="2" (
if "%rvc_trigger%"=="true" (
set "rvc_trigger=false"
@@ -750,32 +769,43 @@ for %%i in (%module_choices%) do (
) else (
set "summarize_trigger=true"
)
REM set "python_command= --enable-modules=summarize"
) else if "%%i"=="6" (
if "%listen_trigger%"=="true" (
set "listen_trigger=false"
) else (
set "listen_trigger=true"
)
REM set "python_command= --listen"
) else if "%%i"=="0" (
goto :toolbox
)
)
REM Save the module flags to modules.txt
echo xtts_trigger=%xtts_trigger%>"%~dp0modules.txt"
echo cuda_trigger=%cuda_trigger%>"%~dp0modules.txt"
echo rvc_trigger=%rvc_trigger%>>"%~dp0modules.txt"
echo talkinghead_trigger=%talkinghead_trigger%>>"%~dp0modules.txt"
echo caption_trigger=%caption_trigger%>>"%~dp0modules.txt"
echo summarize_trigger=%summarize_trigger%>>"%~dp0modules.txt"
echo listen_trigger=%listen_trigger%>>"%~dp0modules.txt"
REM remove modules_enable
set "modules_enable="
REM Compile the Python command
set "python_command=python server.py"
if "%xtts_trigger%"=="true" (
set "python_command=%python_command% --gpu 0 --cuda-device=0 "
if "%listen_trigger%"=="true" (
set "python_command=%python_command% --listen"
)
if "%cuda_trigger%"=="true" (
set "python_command=%python_command% --cuda"
)
if "%rvc_trigger%"=="true" (
set "python_command=%python_command% --rvc-save-file --max-content-length=1000"
set "modules_enable=%modules_enable%rvc,"
)
if "%talkinghead_trigger%"=="true" (
set "python_command=%python_command% --talkinghead-gpu"
set "modules_enable=%modules_enable%talkinghead,"
)
if "%caption_trigger%"=="true" (
@@ -796,20 +826,11 @@ if defined modules_enable (
set "python_command=%python_command% --enable-modules=%modules_enable%"
)
@REM REM Save the constructed Python command to modules.txt for testing
REM Save the constructed Python command to modules.txt for testing
echo start_command=%python_command%>>"%~dp0modules.txt"
@REM REM echo start cmd /k python server.py %python_command%>>"%~dp0modules.txt"
@REM REM Construct and execute the Python command
@REM REM start cmd /k python server.py %python_command%
@REM echo "DEBUG: %python_command%"
@REM pause
goto :edit_extras_modules
:reinstall_extras
title SillyTavern [REINSTALL-EXTRAS]
setlocal enabledelayedexpansion

40
install.sh Normal file → Executable file
View File

@@ -141,7 +141,31 @@ log_message() {
;;
esac
}
boxDrawingText()
{
local string=$1
local maxwidth=$2
# empty string
local color=
if [ $# -eq 3 ]; then
color=$3
fi
local stringlength=${#string}
# stringlength < maxwidth ? maxwidth : stringlength
local width=$((stringlength < maxwidth ? maxwidth : stringlength))
local topL="╔"
local bottomL="╚"
local topR="╗"
local bottomR="╝"
local middle="║"
local space=" "
echo -e "$color$middle$string$(printf ' %.0s' $(seq 1 $((width - stringlength))))$middle"
}
# Log your messages test window
#log_message "INFO" "Something has been launched."
#log_message "WARN" "${yellow_fg_strong}Something is not installed on this system.${reset}"
@@ -350,6 +374,7 @@ install_st_extras() {
# Install pip requirements
log_message "INFO" "Installing pip requirements for xtts..."
pip install xtts-api-server
pip install pydub
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
# Create folders for xtts
@@ -407,6 +432,7 @@ install_st_extras() {
# Install pip requirements
log_message "INFO" "Installing modules from requirements.txt in extras..."
pip install -r requirements.txt
conda install -c conda-forge faiss-gpu -y
elif [ "$gpu_choice" == "2" ]; then
log_message "INFO" "Installing modules from requirements-rocm.txt in extras..."
pip install -r requirements-rocm.txt
@@ -420,6 +446,7 @@ install_st_extras() {
log_message "INFO" "Installing pip requirements-rvc in extras environment..."
pip install -r requirements-rvc.txt
pip install tensorboardX
# Cleanup the Downloaded file
rm -rf /tmp/$miniconda_installer
@@ -581,6 +608,7 @@ install_extras() {
# Install pip requirements
log_message "INFO" "Installing pip requirements for xtts..."
pip install xtts-api-server
pip install pydub
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
# Create folders for xtts
@@ -623,11 +651,11 @@ install_extras() {
done < <(lspci | grep VGA | cut -d ':' -f3)
echo ""
echo -e "${blue_bg}╔════ GPU INFO ═════════════════════════════════╗${reset}"
echo -e "${blue_bg}║ ║${reset}"
echo -e "${blue_bg}║* ${gpu_info:1}${reset}"
echo -e "${blue_bg}║ ║${reset}"
echo -e "${blue_bg}╚═══════════════════════════════════════════════╝${reset}"
echo -e "${blue_bg}╔════ GPU INFO ═════════════════════════════════════════════════════════════${reset}"
boxDrawingText "" 75 $blue_bg
boxDrawingText "* ${gpu_info:1}" 75 $blue_bg
boxDrawingText "" 75 $blue_bg
echo -e "${blue_bg}╚═══════════════════════════════════════════════════════════════════════════${reset}"
echo ""
# Prompt for GPU choice
@@ -638,6 +666,7 @@ install_extras() {
# Install pip requirements
log_message "INFO" "Installing modules from requirements.txt in extras..."
pip install -r requirements.txt
conda install -c conda-forge faiss-gpu -y
elif [ "$gpu_choice" == "2" ]; then
log_message "INFO" "Installing modules from requirements-rocm.txt in extras..."
pip install -r requirements-rocm.txt
@@ -651,6 +680,7 @@ install_extras() {
log_message "INFO" "Installing pip requirements-rvc in extras environment..."
pip install -r requirements-rvc.txt
pip install tensorboardX
# Cleanup the Downloaded file
rm -rf /tmp/$miniconda_installer

View File

@@ -247,6 +247,7 @@ if /i "%install_xtts_requirements%"=="Y" (
REM Install pip requirements
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Installing pip requirements for xtts...
pip install xtts-api-server
pip install pydub
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
REM Create folders for xtts
@@ -305,6 +306,7 @@ if "%gpu_choice%"=="1" (
REM Install pip requirements
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Installing modules from requirements.txt in extras
pip install -r requirements.txt
call conda install -c conda-forge faiss-gpu -y
) else if "%gpu_choice%"=="2" (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Installing modules from requirements-rocm.txt in extras
pip install -r requirements-rocm.txt
@@ -320,6 +322,7 @@ if "%gpu_choice%"=="1" (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Installing pip requirements-rvc in extras environment...
pip install -r requirements-rvc.txt
pip install tensorboardX
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% %green_fg_strong%Extras installed successfully.%reset%
@@ -334,6 +337,7 @@ if /i "%create_shortcut%"=="Y" (
"$WshShell = New-Object -ComObject WScript.Shell; " ^
"$Shortcut = $WshShell.CreateShortcut('%desktopPath%\%shortcutName%'); " ^
"$Shortcut.TargetPath = '%shortcutTarget%'; " ^
"$Shortcut.IconLocation = '%iconFile%'; " ^
"$Shortcut.WorkingDirectory = '%startIn%'; " ^
"$Shortcut.Description = '%comment%'; " ^
"$Shortcut.Save()"
@@ -548,6 +552,7 @@ if "%gpu_choice%"=="1" (
REM Install pip requirements
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Installing modules from requirements.txt in extras
pip install -r requirements.txt
call conda install -c conda-forge faiss-gpu -y
) else if "%gpu_choice%"=="2" (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Installing modules from requirements-rocm.txt in extras
pip install -r requirements-rocm.txt
@@ -563,6 +568,7 @@ if "%gpu_choice%"=="1" (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Installing pip requirements-rvc in extras environment...
pip install -r requirements-rvc.txt
pip install tensorboardX
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% %green_fg_strong%Extras installed successfully.%reset%