2023-03-12 20:42:50 +01:00
|
|
|
@echo off
|
|
|
|
|
|
|
|
@rem Based on the installer found here: https://github.com/Sygil-Dev/sygil-webui
|
2023-03-24 23:27:29 +01:00
|
|
|
@rem This script will install git and all dependencies
|
2023-03-12 20:42:50 +01:00
|
|
|
@rem using micromamba (an 8mb static-linked single-file binary, conda replacement).
|
|
|
|
@rem This enables a user to install this project without manually installing conda and git.
|
|
|
|
|
2023-03-31 03:48:40 +02:00
|
|
|
echo WARNING: This script relies on Micromamba which may have issues on some systems when installed under a path with spaces.
|
|
|
|
echo May also have issues with long paths.&& echo.
|
2023-03-31 03:04:16 +02:00
|
|
|
|
2023-04-10 04:46:54 +02:00
|
|
|
pause
|
|
|
|
cls
|
|
|
|
|
2023-03-12 20:42:50 +01:00
|
|
|
echo What is your GPU?
|
|
|
|
echo.
|
|
|
|
echo A) NVIDIA
|
|
|
|
echo B) None (I want to run in CPU mode)
|
|
|
|
echo.
|
|
|
|
set /p "gpuchoice=Input> "
|
|
|
|
set gpuchoice=%gpuchoice:~0,1%
|
2023-03-24 23:27:29 +01:00
|
|
|
|
|
|
|
if /I "%gpuchoice%" == "A" (
|
2023-04-05 23:52:05 +02:00
|
|
|
set "PACKAGES_TO_INSTALL=python=3.10.9 pytorch[version=2,build=py3.10_cuda11.7*] torchvision torchaudio pytorch-cuda=11.7 cuda-toolkit ninja git"
|
|
|
|
set "CHANNEL=-c pytorch -c nvidia/label/cuda-11.7.0 -c nvidia -c conda-forge"
|
2023-03-24 23:27:29 +01:00
|
|
|
) else if /I "%gpuchoice%" == "B" (
|
|
|
|
set "PACKAGES_TO_INSTALL=pytorch torchvision torchaudio cpuonly git"
|
|
|
|
set "CHANNEL=-c conda-forge -c pytorch"
|
2023-03-12 20:42:50 +01:00
|
|
|
) else (
|
|
|
|
echo Invalid choice. Exiting...
|
|
|
|
exit
|
|
|
|
)
|
|
|
|
|
2023-03-24 23:51:13 +01:00
|
|
|
cd /D "%~dp0"
|
|
|
|
|
2023-03-31 03:04:16 +02:00
|
|
|
set PATH=%PATH%;%SystemRoot%\system32
|
2023-03-25 03:25:14 +01:00
|
|
|
|
2023-03-12 20:42:50 +01:00
|
|
|
set MAMBA_ROOT_PREFIX=%cd%\installer_files\mamba
|
|
|
|
set INSTALL_ENV_DIR=%cd%\installer_files\env
|
2023-03-29 09:47:19 +02:00
|
|
|
set MICROMAMBA_DOWNLOAD_URL=https://github.com/mamba-org/micromamba-releases/releases/download/1.4.0-0/micromamba-win-64
|
2023-03-12 20:42:50 +01:00
|
|
|
set REPO_URL=https://github.com/oobabooga/text-generation-webui.git
|
|
|
|
set umamba_exists=F
|
|
|
|
|
|
|
|
@rem figure out whether git and conda needs to be installed
|
2023-03-24 23:27:29 +01:00
|
|
|
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" --version >nul 2>&1
|
2023-03-12 20:42:50 +01:00
|
|
|
if "%ERRORLEVEL%" EQU "0" set umamba_exists=T
|
|
|
|
|
|
|
|
@rem (if necessary) install git and conda into a contained environment
|
|
|
|
if "%PACKAGES_TO_INSTALL%" NEQ "" (
|
|
|
|
@rem download micromamba
|
|
|
|
if "%umamba_exists%" == "F" (
|
2023-03-24 23:27:29 +01:00
|
|
|
echo "Downloading Micromamba from %MICROMAMBA_DOWNLOAD_URL% to %MAMBA_ROOT_PREFIX%\micromamba.exe"
|
2023-03-12 20:42:50 +01:00
|
|
|
|
|
|
|
mkdir "%MAMBA_ROOT_PREFIX%"
|
2023-04-04 19:31:26 +02:00
|
|
|
call curl -Lk "%MICROMAMBA_DOWNLOAD_URL%" > "%MAMBA_ROOT_PREFIX%\micromamba.exe" || ( echo. && echo Micromamba failed to download. && goto end )
|
2023-03-12 20:42:50 +01:00
|
|
|
|
|
|
|
@rem test the mamba binary
|
|
|
|
echo Micromamba version:
|
2023-04-04 19:31:26 +02:00
|
|
|
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" --version || ( echo. && echo Micromamba not found. && goto end )
|
2023-03-24 23:27:29 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
@rem create micromamba hook
|
2023-03-25 07:14:29 +01:00
|
|
|
if not exist "%MAMBA_ROOT_PREFIX%\condabin\micromamba.bat" (
|
2023-03-24 23:27:29 +01:00
|
|
|
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" shell hook >nul 2>&1
|
2023-03-12 20:42:50 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
@rem create the installer env
|
|
|
|
if not exist "%INSTALL_ENV_DIR%" (
|
2023-03-25 07:14:29 +01:00
|
|
|
echo Packages to install: %PACKAGES_TO_INSTALL%
|
2023-04-04 19:31:26 +02:00
|
|
|
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" create -y --prefix "%INSTALL_ENV_DIR%" %CHANNEL% %PACKAGES_TO_INSTALL% || ( echo. && echo Conda environment creation failed. && goto end )
|
2023-03-12 20:42:50 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2023-04-04 19:31:26 +02:00
|
|
|
@rem check if conda environment was actually created
|
|
|
|
if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo Conda environment is empty. && goto end )
|
|
|
|
|
2023-03-25 07:14:29 +01:00
|
|
|
@rem activate installer env
|
2023-04-04 19:31:26 +02:00
|
|
|
call "%MAMBA_ROOT_PREFIX%\condabin\micromamba.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo MicroMamba hook not found. && goto end )
|
2023-03-25 07:14:29 +01:00
|
|
|
|
2023-03-12 20:42:50 +01:00
|
|
|
@rem clone the repository and install the pip requirements
|
|
|
|
if exist text-generation-webui\ (
|
|
|
|
cd text-generation-webui
|
|
|
|
git pull
|
|
|
|
) else (
|
|
|
|
git clone https://github.com/oobabooga/text-generation-webui.git
|
2023-03-31 03:04:16 +02:00
|
|
|
call python -m pip install https://github.com/jllllll/bitsandbytes-windows-webui/raw/main/bitsandbytes-0.37.2-py3-none-any.whl
|
2023-03-24 23:27:29 +01:00
|
|
|
cd text-generation-webui || goto end
|
2023-03-12 20:42:50 +01:00
|
|
|
)
|
2023-03-14 02:49:13 +01:00
|
|
|
call python -m pip install -r requirements.txt --upgrade
|
2023-03-24 23:27:29 +01:00
|
|
|
call python -m pip install -r extensions\api\requirements.txt --upgrade
|
|
|
|
call python -m pip install -r extensions\elevenlabs_tts\requirements.txt --upgrade
|
|
|
|
call python -m pip install -r extensions\google_translate\requirements.txt --upgrade
|
|
|
|
call python -m pip install -r extensions\silero_tts\requirements.txt --upgrade
|
|
|
|
call python -m pip install -r extensions\whisper_stt\requirements.txt --upgrade
|
|
|
|
|
|
|
|
@rem skip gptq install if cpu only
|
|
|
|
if /I not "%gpuchoice%" == "A" goto bandaid
|
|
|
|
|
|
|
|
@rem download gptq and compile locally and if compile fails, install from wheel
|
|
|
|
if not exist repositories\ (
|
|
|
|
mkdir repositories
|
|
|
|
)
|
|
|
|
cd repositories || goto end
|
|
|
|
if not exist GPTQ-for-LLaMa\ (
|
2023-04-02 06:11:05 +02:00
|
|
|
git clone https://github.com/oobabooga/GPTQ-for-LLaMa.git -b cuda
|
2023-03-24 23:27:29 +01:00
|
|
|
cd GPTQ-for-LLaMa || goto end
|
2023-03-25 08:22:02 +01:00
|
|
|
call python -m pip install -r requirements.txt
|
2023-03-24 23:27:29 +01:00
|
|
|
call python setup_cuda.py install
|
|
|
|
if not exist "%INSTALL_ENV_DIR%\lib\site-packages\quant_cuda-0.0.0-py3.10-win-amd64.egg" (
|
|
|
|
echo CUDA kernal compilation failed. Will try to install from wheel.
|
2023-04-04 19:31:26 +02:00
|
|
|
call python -m pip install https://github.com/jllllll/GPTQ-for-LLaMa-Wheels/raw/main/quant_cuda-0.0.0-cp310-cp310-win_amd64.whl || ( echo. && echo Wheel installation failed. && goto end )
|
2023-03-24 23:27:29 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
:end
|
2023-03-25 08:22:02 +01:00
|
|
|
pause
|