launcher upgrades

+added ostris ai toolkit. Feature Request by: @BlueprintCoding
This commit is contained in:
deffcolony
2024-08-26 15:35:07 +02:00
parent 4046ad55a3
commit 73debbaafe
3 changed files with 153 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
@echo off
:install_ostrisaitoolkit
title STL [INSTALL OSTRIS AI TOOLKIT]
cls
echo %blue_fg_strong%/ Home / Toolbox / App Installer / Image Generation / Install Ostris AI Toolkit%reset%
echo -------------------------------------------------------------
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Installing Ostris AI Toolkit...
REM Check if the folder exists
if not exist "%image_generation_dir%" (
mkdir "%image_generation_dir%"
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Created folder: "image-generation"
) else (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO] "image-generation" folder already exists.%reset%
)
cd /d "%image_generation_dir%"
set max_retries=3
set retry_count=0
:retry_install_ostrisaitoolkit
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Cloning the ostris ai-toolkit repository...
git clone https://github.com/ostris/ai-toolkit.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_ostrisaitoolkit
echo %red_bg%[%time%]%reset% %red_fg_strong%[ERROR] Failed to clone repository after %max_retries% retries.%reset%
pause
goto :app_installer_image_generation
)
cd /d "%ostrisaitoolkit_install_path%"
git submodule update --init --recursive
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 ostrisaitoolkit
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Creating Conda environment: %cyan_fg_strong%ostrisaitoolkit%reset%
call conda create -n ostrisaitoolkit python=3.11 -y
REM Activate the ostrisaitoolkit environment
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Activating Conda environment: %cyan_fg_strong%ostrisaitoolkit%reset%
call conda activate ostrisaitoolkit
REM Install pip requirements
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Installing pip requirements
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% %green_fg_strong%Ostris AI Toolkit installed Successfully.%reset%
pause
goto :install_ostrisaitoolkit_menu

View File

@@ -0,0 +1,36 @@
@echo off
:uninstall_ostrisaitoolkit
title STL [UNINSTALL OSTRIS AI TOOLKIT]
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 Ostris AI Toolkit ║%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%ostrisaitoolkit%reset%
call conda deactivate
call conda remove --name ostrisaitoolkit --all -y
call conda clean -a -y
REM Remove the folder ai-toolkit
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Removing the ai-toolkit directory...
cd /d "%~dp0"
rmdir /s /q "%ostrisaitoolkit_install_path%"
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% %green_fg_strong%Ostris AI Toolkit has been uninstalled successfully.%reset%
pause
goto :app_uninstaller_image_generation
) else (
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Uninstall canceled.
pause
goto :app_uninstaller_image_generation
)