├── .github └── README.md ├── .gitignore ├── INSTRUCTIONS.txt ├── download-model.bat ├── install.bat ├── miniconda-cmd.bat └── start-webui.bat /.github/README.md: -------------------------------------------------------------------------------- 1 | # one-click-installers 2 | Alternative versions of the installer are located in the various branches of this repo. 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | installer_files/ 2 | text-generation-webui/ -------------------------------------------------------------------------------- /INSTRUCTIONS.txt: -------------------------------------------------------------------------------- 1 | Thank you for downloading oobabooga/text-generation-webui. 2 | Here is how to get it up and running: 3 | 4 | 1. Run the "install" script to install the web UI and its requirements in this folder. 5 | 2. Run the "download-model" script to download a model of your choice. 6 | 3. Run the "start-webui" script to launch the web UI. 7 | 8 | To add flags like --api, --cpu, --extensions, etc, edit the 9 | "start-webui" script using a text editor and add the desired flags 10 | to the CMD_FLAGS variable at the top. It should look like this: 11 | 12 | set "CMD_FLAGS=--auto-launch" 13 | 14 | For instance, to add the --api flag, change it to 15 | 16 | set "CMD_FLAGS=--auto-launch --api" 17 | 18 | To get the latest updates in the future, just re-run the "install" script. 19 | This will only install the updates, so it should be much faster. 20 | 21 | You can open a command-line attached to the virtual environment by running the "miniconda-cmd" script. 22 | 23 | This installer uses a custom-built Windows-compatible version of bitsandbytes. Source: https://github.com/acpopescu/bitsandbytes/tree/cmake_windows 24 | -------------------------------------------------------------------------------- /download-model.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | cd /D "%~dp0" 4 | 5 | @rem better isolation for virtual environment 6 | SET "CONDA_SHLVL=" 7 | SET PYTHONNOUSERSITE=1 8 | SET "PYTHONPATH=" 9 | SET "PYTHONHOME=" 10 | SET "TEMP=%cd%\installer_files\temp" 11 | SET "TMP=%cd%\installer_files\temp" 12 | 13 | @rem workaround for broken Windows installs 14 | set PATH=%PATH%;%SystemRoot%\system32 15 | 16 | set INSTALL_ENV_DIR=%cd%\installer_files\env 17 | set MINICONDA_DIR=%cd%\installer_files\miniconda3 18 | 19 | if not exist "%MINICONDA_DIR%\Scripts\activate.bat" ( echo Miniconda not found. && goto end ) 20 | call "%MINICONDA_DIR%\Scripts\activate.bat" activate "%INSTALL_ENV_DIR%" 21 | 22 | cd text-generation-webui || goto end 23 | 24 | @rem HuggingFace user access token goes here between '=' and '"' 25 | set "HF_TOKEN=" 26 | 27 | :start 28 | echo. 29 | echo Type the name of your desired Hugging Face model in the format organization/name or the URL to the model page. 30 | echo. 31 | echo Examples: 32 | echo. 33 | echo facebook/opt-1.3b 34 | echo https://huggingface.co/facebook/opt-1.3b 35 | echo EleutherAI/pythia-1.4b-deduped 36 | echo https://huggingface.co/EleutherAI/pythia-1.4b-deduped 37 | echo. 38 | echo. 39 | echo. 40 | echo You can download a specific branch of a model's repo by using '--branch=BRANCH' or by using the full URL for the branch. 41 | echo. 42 | echo Examples: 43 | echo. 44 | echo TheBloke/Wizard-Vicuna-7B-Uncensored-GPTQ --branch=gptq-4bit-32g-actorder_True 45 | echo https://huggingface.co/TheBloke/Wizard-Vicuna-7B-Uncensored-GPTQ --branch=gptq-4bit-32g-actorder_True 46 | echo https://huggingface.co/TheBloke/Wizard-Vicuna-7B-Uncensored-GPTQ/tree/gptq-4bit-32g-actorder_True 47 | echo. 48 | echo. 49 | echo. 50 | echo Other flags can also be used: 51 | echo. 52 | for /F "delims=" %%a in ('call python download-model.py --help') do echo %%a| findstr /C:"-h, --help" >nul && call :counter save || call :counter 1 53 | set /A "FLAGS_LINE=%COUNTER_SAVE%+3" 54 | for /F "skip=%FLAGS_LINE% delims=" %%a in ('call python download-model.py --help') do echo %%a 55 | echo. 56 | 57 | set /p "modelchoice=Input> " 58 | 59 | set "modeldlcmd=python download-model.py %modelchoice:\=/%" 60 | set "modelbranch=main" 61 | echo %modelchoice%| findstr /C:"--branch=" >nul && ( 62 | set "tempvar=%modelchoice:*--branch=%" 63 | set "tempvar=%tempvar:~1%" 64 | for /F "delims=" %%a in ("%tempvar%") do set "modelbranch=%%a" 65 | set "tempvar=" 66 | ) 67 | for /F "tokens=1,2* delims=/ " %%a in ("%modelchoice:\=/%") do ( 68 | set "linklistcmd=python -c "exec^(\"import importlib\nlinks ^= importlib.import_module^('download-model'^).ModelDownloader^(^).get_download_links_from_huggingface^('%%a/%%b'^, '%modelbranch%'^)\nfor link in links[0]: print^(link^)\"^)"" 69 | ) 70 | echo %modelchoice:\=/%| findstr /C:"/tree/" >nul && for /F "tokens=3,4,6* delims=/ " %%a in ("%modelchoice:\=/%") do ( 71 | set "modeldlcmd=python download-model.py %%a/%%b --branch=%%c %%d" 72 | set "modelbranch=%%c" 73 | set "linklistcmd=python -c "exec^(\"import importlib\nlinks ^= importlib.import_module^('download-model'^).ModelDownloader^(^).get_download_links_from_huggingface^('%%a/%%b'^, '%%c'^)\nfor link in links[0]: print^(link^)\"^)"" 74 | ) 75 | if "%modelchoice%" == "%modelchoice:*/tree/=%" echo %modelchoice%| findstr /C:"huggingface.co/" >nul && for /F "tokens=3,4* delims=/ " %%a in ("%modelchoice%") do ( 76 | set "modeldlcmd=python download-model.py %%a/%%b %%c" 77 | set "linklistcmd=python -c "exec^(\"import importlib\nlinks ^= importlib.import_module^('download-model'^).ModelDownloader^(^).get_download_links_from_huggingface^('%%a/%%b'^, '%modelbranch%'^)\nfor link in links[0]: print^(link^)\"^)"" 78 | ) 79 | echo. 80 | if "%modelchoice%" == "%modelchoice:*--specific-file=%" echo %modelchoice%| findstr /I /C:"GGML" /C:"GGUF" >nul && ( 81 | echo GGML/GGUF model detected. 82 | echo Select a file to download or enter 'all' to download all files: 83 | for /F "usebackq tokens=7* delims=/" %%a in (`call %linklistcmd%`) do echo %%a%%b 84 | echo. 85 | set /p "filechoice=Input> " 86 | if /I "%filechoice%" == "all" set "filechoice=" 87 | echo. 88 | ) 89 | 90 | if defined filechoice set "modeldlcmd=%modeldlcmd% --specific-file=%filechoice%" 91 | 92 | call %modeldlcmd% 93 | 94 | :end 95 | pause 96 | set "modelchoice=" 97 | set "modelbranch=" 98 | set "modeldlcmd=" 99 | set "linklistcmd=" 100 | set "filechoice=" 101 | call :counter reset 102 | cls 103 | goto :start 104 | 105 | :counter 106 | if /I "%1" == "reset" ( 107 | set "COUNTER=" 108 | exit /b 109 | ) else if /I "%1" == "save" ( 110 | set "COUNTER_SAVE=%COUNTER%" 111 | exit /b 112 | ) 113 | set /A "COUNTER=%COUNTER%+%1" 114 | exit /b 115 | -------------------------------------------------------------------------------- /install.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | @rem This script will install miniconda and git with all dependencies for this project 4 | @rem This enables a user to install this project without manually installing conda and git. 5 | 6 | @rem workaround for broken Windows installs 7 | set PATH=%PATH%;%SystemRoot%\system32 8 | 9 | cd /D "%~dp0" 10 | 11 | echo "%cd%"| findstr /C:" " >nul && call :PrintBigMessage "This script relies on Miniconda which can not be silently installed under a path with spaces." && goto end 12 | call :PrintBigMessage "WARNING: This script relies on Miniconda which will fail to install if the path is too long." 13 | set "SPCHARMESSAGE="WARNING: Special characters were detected in the installation path!" " This can cause the installation to fail!"" 14 | echo "%CD%"| findstr /R /C:"[!#\$%&()\*+,;<=>?@\[\]\^`{|}~]" >nul && ( 15 | call :PrintBigMessage %SPCHARMESSAGE% 16 | ) 17 | set SPCHARMESSAGE= 18 | 19 | pause 20 | cls 21 | 22 | echo What is your GPU? 23 | echo. 24 | echo A) NVIDIA 25 | echo B) None (I want to run in CPU mode) 26 | echo. 27 | set /p "gpuchoice=Input> " 28 | set gpuchoice=%gpuchoice:~0,1% 29 | 30 | if /I "%gpuchoice%" == "A" ( 31 | set "PACKAGES_TO_INSTALL=python=3.10 cuda-toolkit ninja git" 32 | set "CHANNEL=-c nvidia/label/cuda-11.7.0 -c nvidia -c conda-forge" 33 | set "PYTORCH_CMD=torch==2.0.1+cu117 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117" 34 | ) else if /I "%gpuchoice%" == "B" ( 35 | set "PACKAGES_TO_INSTALL=python=3.10 ninja git" 36 | set "CHANNEL=-c conda-forge" 37 | set "PYTORCH_CMD=torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu" 38 | ) else ( 39 | echo Invalid choice. Exiting... 40 | exit 41 | ) 42 | 43 | @rem better isolation for virtual environment 44 | SET "CONDA_SHLVL=" 45 | SET PYTHONNOUSERSITE=1 46 | SET "PYTHONPATH=" 47 | SET "PYTHONHOME=" 48 | SET "TEMP=%cd%\installer_files\temp" 49 | SET "TMP=%cd%\installer_files\temp" 50 | 51 | set MINICONDA_DIR=%cd%\installer_files\miniconda3 52 | set INSTALL_ENV_DIR=%cd%\installer_files\env 53 | set MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe 54 | set REPO_URL=https://github.com/oobabooga/text-generation-webui.git 55 | 56 | if not exist "%MINICONDA_DIR%\Scripts\conda.exe" ( 57 | @rem download miniconda 58 | echo Downloading Miniconda installer from %MINICONDA_DOWNLOAD_URL% 59 | call curl -LOk "%MINICONDA_DOWNLOAD_URL%" 60 | 61 | @rem install miniconda 62 | echo. && echo Installing Miniconda To "%MINICONDA_DIR%" && echo Please Wait... && echo. 63 | start "" /W /D "%cd%" "Miniconda3-latest-Windows-x86_64.exe" /InstallationType=JustMe /NoShortcuts=1 /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /S /D=%MINICONDA_DIR% || ( echo. && echo Miniconda installer not found. && goto end ) 64 | del /q "Miniconda3-latest-Windows-x86_64.exe" 65 | if not exist "%MINICONDA_DIR%\Scripts\activate.bat" ( echo. && echo Miniconda install failed. && goto end ) 66 | ) 67 | 68 | @rem activate miniconda 69 | call "%MINICONDA_DIR%\Scripts\activate.bat" || ( echo Miniconda hook not found. && goto end ) 70 | 71 | @rem create the installer env 72 | if not exist "%INSTALL_ENV_DIR%" ( 73 | echo Packages to install: %PACKAGES_TO_INSTALL% 74 | call conda create --no-shortcuts -y -k -p "%INSTALL_ENV_DIR%" %CHANNEL% %PACKAGES_TO_INSTALL% || ( echo. && echo Conda environment creation failed. && goto end ) 75 | call conda run --live-stream -p "%INSTALL_ENV_DIR%" python -m pip install %PYTORCH_CMD%|| ( echo. && echo Pytorch installation failed.&& goto end ) 76 | ) 77 | 78 | @rem check if conda environment was actually created 79 | if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo Conda environment is empty. && goto end ) 80 | 81 | @rem activate installer env 82 | call conda activate "%INSTALL_ENV_DIR%" || ( echo. && echo Conda environment activation failed. && goto end ) 83 | 84 | @rem set default cuda toolkit to the one in the environment 85 | set "CUDA_PATH=%INSTALL_ENV_DIR%" 86 | 87 | @rem clone the repository 88 | if exist text-generation-webui\ ( 89 | cd text-generation-webui 90 | git pull 91 | ) else ( 92 | git clone https://github.com/oobabooga/text-generation-webui.git 93 | cd text-generation-webui || goto end 94 | ) 95 | 96 | @rem Loop through each "git+" requirement and uninstall it workaround for inconsistent git package updating 97 | for /F "delims=" %%a in (requirements.txt) do echo "%%a"| findstr /C:"git+" >nul&& for /F "tokens=4 delims=/" %%b in ("%%a") do for /F "delims=@" %%c in ("%%b") do python -m pip uninstall -y %%c 98 | 99 | @rem install the pip requirements 100 | call python -m pip install -r requirements.txt --upgrade 101 | 102 | @rem install all extension requirements except for superbooga 103 | for /R extensions %%I in (requirements.t?t) do ( 104 | echo %%~I| FINDSTR "extensions\superbooga" >nul 2>&1 || call python -m pip install -r %%~I --upgrade 105 | ) 106 | 107 | if not exist repositories\ ( 108 | mkdir repositories 109 | ) 110 | cd repositories || goto end 111 | 112 | @rem download or update exllama as needed 113 | if not exist exllama\ ( 114 | git clone https://github.com/turboderp/exllama.git 115 | ) else pushd exllama && git pull && popd 116 | 117 | 118 | 119 | @rem below are functions for the script next line skips these during normal execution 120 | goto end 121 | 122 | :GetHighestCompute 123 | if not defined HIGHEST_COMPUTE ( 124 | set "HIGHEST_COMPUTE=%1" 125 | ) else if %1 GTR %HIGHEST_COMPUTE% set "HIGHEST_COMPUTE=%1" 126 | exit /b 127 | 128 | :PrintBigMessage 129 | echo. && echo. 130 | echo ******************************************************************* 131 | for %%M in (%*) do echo * %%~M 132 | echo ******************************************************************* 133 | echo. && echo. 134 | exit /b 135 | 136 | :end 137 | pause 138 | -------------------------------------------------------------------------------- /miniconda-cmd.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | cd /D "%~dp0" 4 | 5 | @rem better isolation for virtual environment 6 | SET "CONDA_SHLVL=" 7 | SET PYTHONNOUSERSITE=1 8 | SET "PYTHONPATH=" 9 | SET "PYTHONHOME=" 10 | SET "TEMP=%cd%\installer_files\temp" 11 | SET "TMP=%cd%\installer_files\temp" 12 | 13 | @rem workaround for broken Windows installs 14 | set PATH=%PATH%;%SystemRoot%\system32 15 | 16 | set INSTALL_ENV_DIR=%cd%\installer_files\env 17 | set MINICONDA_DIR=%cd%\installer_files\miniconda3 18 | 19 | if not exist "%MINICONDA_DIR%\Scripts\activate.bat" ( echo Miniconda not found. && goto end ) 20 | call "%MINICONDA_DIR%\Scripts\activate.bat" activate "%INSTALL_ENV_DIR%" 21 | 22 | @rem set default cuda toolkit to the one in the environment 23 | set "CUDA_PATH=%INSTALL_ENV_DIR%" 24 | 25 | cmd /k "%*" 26 | 27 | :end 28 | pause 29 | -------------------------------------------------------------------------------- /start-webui.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set "CMD_FLAGS=--auto-launch" 4 | 5 | @echo Starting the web UI... 6 | 7 | cd /D "%~dp0" 8 | 9 | @rem better isolation for virtual environment 10 | SET "CONDA_SHLVL=" 11 | SET PYTHONNOUSERSITE=1 12 | SET "PYTHONPATH=" 13 | SET "PYTHONHOME=" 14 | SET "TEMP=%cd%\installer_files\temp" 15 | SET "TMP=%cd%\installer_files\temp" 16 | 17 | @rem workaround for broken Windows installs 18 | set PATH=%PATH%;%SystemRoot%\system32 19 | 20 | set INSTALL_ENV_DIR=%cd%\installer_files\env 21 | set MINICONDA_DIR=%cd%\installer_files\miniconda3 22 | 23 | if not exist "%MINICONDA_DIR%\Scripts\activate.bat" ( echo Miniconda not found. && goto end ) 24 | call "%MINICONDA_DIR%\Scripts\activate.bat" activate "%INSTALL_ENV_DIR%" 25 | cd text-generation-webui 26 | 27 | @rem set default cuda toolkit to the one in the environment 28 | set "CUDA_PATH=%INSTALL_ENV_DIR%" 29 | 30 | call python server.py %CMD_FLAGS% 31 | 32 | :end 33 | pause 34 | --------------------------------------------------------------------------------