lollms-webui/scripts/windows/win_install.bat

232 lines
6.3 KiB
Batchfile
Raw Normal View History

2023-07-12 13:01:20 +00:00
@echo off
@rem This script will install miniconda and git with all dependencies for this project
@rem This enables a user to install this project without manually installing conda and git.
2024-09-14 23:37:41 +00:00
echo "L🍓LLMS: Lord of Large Language and Multimodal Systems"
echo V12 Strawberry
2023-12-31 15:07:59 +00:00
echo -----------------
echo By ParisNeo
echo -----------------
2023-07-12 13:01:20 +00:00
@rem workaround for broken Windows installs
set PATH=%PATH%;%SystemRoot%\system32
cd /D "%~dp0"
2023-12-05 21:45:01 +00:00
echo "%cd%"| findstr /C:" " >nul && call :PrintBigMessage "This script relies on Miniconda which can not be silently installed under a path with spaces. Please put it in a path without spaces and try again" && goto failed
2023-07-12 13:01:20 +00:00
call :PrintBigMessage "WARNING: This script relies on Miniconda which will fail to install if the path is too long."
set "SPCHARMESSAGE="WARNING: Special characters were detected in the installation path!" " This can cause the installation to fail!""
echo "%CD%"| findstr /R /C:"[!#\$%&()\*+,;<=>?@\[\]\^`{|}~]" >nul && (
call :PrintBigMessage %SPCHARMESSAGE%
)
set SPCHARMESSAGE=
pause
cls
2023-08-26 16:01:09 +00:00
md
2023-07-12 13:01:20 +00:00
@rem better isolation for virtual environment
SET "CONDA_SHLVL="
SET PYTHONNOUSERSITE=1
SET "PYTHONPATH="
SET "PYTHONHOME="
SET "TEMP=%cd%\installer_files\temp"
SET "TMP=%cd%\installer_files\temp"
set MINICONDA_DIR=%cd%\installer_files\miniconda3
2023-07-12 15:02:35 +00:00
set INSTALL_ENV_DIR=%cd%\installer_files\lollms_env
2023-07-12 13:01:20 +00:00
set MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe
set REPO_URL=https://github.com/ParisNeo/lollms-webui.git
2024-01-04 13:17:41 +00:00
set "PACKAGES_TO_INSTALL=python=3.11 git pip"
2023-12-31 11:43:49 +00:00
2023-07-12 13:01:20 +00:00
if not exist "%MINICONDA_DIR%\Scripts\conda.exe" (
@rem download miniconda
echo Downloading Miniconda installer from %MINICONDA_DOWNLOAD_URL%
2024-02-19 08:05:33 +00:00
call curl -LO "%MINICONDA_DOWNLOAD_URL%"
2023-07-12 13:01:20 +00:00
@rem install miniconda
echo. && echo Installing Miniconda To "%MINICONDA_DIR%" && echo Please Wait... && echo.
2023-12-05 21:45:01 +00:00
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 failed )
2023-07-12 13:01:20 +00:00
del /q "Miniconda3-latest-Windows-x86_64.exe"
if not exist "%MINICONDA_DIR%\Scripts\activate.bat" ( echo. && echo Miniconda install failed. && goto end )
)
@rem activate miniconda
call "%MINICONDA_DIR%\Scripts\activate.bat" || ( echo Miniconda hook not found. && goto end )
2023-08-31 07:29:44 +00:00
2023-07-12 13:01:20 +00:00
@rem create the installer env
if not exist "%INSTALL_ENV_DIR%" (
echo Packages to install: %PACKAGES_TO_INSTALL%
call conda create --no-shortcuts -y -k -p "%INSTALL_ENV_DIR%" %CHANNEL% %PACKAGES_TO_INSTALL% || ( echo. && echo Conda environment creation failed. && goto end )
)
@rem check if conda environment was actually created
if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo Conda environment is empty. && goto end )
@rem activate installer env
call conda activate "%INSTALL_ENV_DIR%" || ( echo. && echo Conda environment activation failed. && goto end )
2024-02-01 22:30:31 +00:00
@rem install conda library
call conda install conda -y
2023-12-31 14:42:34 +00:00
2024-09-14 23:37:41 +00:00
echo Installing pytorch (required for RAG)
:: Check if CUDA-enabled device is available
nvidia-smi >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
echo CUDA-enabled device detected.
echo Installing PyTorch with CUDA support...
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia -y
) ELSE (
echo No CUDA-enabled device detected.
echo Installing PyTorch for CPU only...
cconda install pytorch torchvision torchaudio cpuonly -c pytorch -y
)
2023-12-31 14:42:34 +00:00
2023-07-12 13:01:20 +00:00
@rem clone the repository
if exist lollms-webui\ (
cd lollms-webui
git pull
2023-12-31 14:42:34 +00:00
git submodule update --init --recursive
2023-12-31 14:50:29 +00:00
cd
2024-01-10 20:22:17 +00:00
cd lollms_core
2023-12-31 14:42:34 +00:00
pip install -e .
2024-09-05 13:57:33 +00:00
cd ..
2023-07-12 13:01:20 +00:00
) else (
2023-12-31 14:42:34 +00:00
git clone --depth 1 --recurse-submodules https://github.com/ParisNeo/lollms-webui.git
git submodule update --init --recursive
2023-12-31 15:07:59 +00:00
cd lollms-webui\lollms_core
2023-12-31 14:42:34 +00:00
pip install -e .
2024-09-05 13:57:33 +00:00
cd ..
2023-07-12 13:01:20 +00:00
)
2024-09-05 13:57:33 +00:00
cd
2024-09-14 23:37:41 +00:00
conda env update --file environment.yml
2023-07-12 13:01:20 +00:00
@rem create launcher
2023-07-12 15:02:35 +00:00
if exist ..\win_run.bat (
echo Win run found
2023-07-12 13:01:20 +00:00
) else (
2023-10-16 22:08:17 +00:00
copy scripts\windows\win_run.bat ..\
2023-07-12 13:01:20 +00:00
)
2023-08-31 06:42:13 +00:00
if exist ..\win_conda_session.bat (
echo win conda session script found
) else (
2023-10-16 22:08:17 +00:00
copy scripts\windows\win_conda_session.bat ..\
2023-08-31 06:42:13 +00:00
)
2024-09-05 13:57:33 +00:00
cd
2023-08-31 06:42:13 +00:00
2024-04-21 21:36:08 +00:00
echo Select the default binding to be installed:
echo 1) None (install the binding later)
echo 2) Local binding - ollama
echo 3) Local binding - python_llama_cpp
echo 4) Local binding - bs_exllamav2
2024-09-01 01:28:43 +00:00
echo 5) Remote binding - groq
echo 6) Remote binding - open_router
echo 7) Remote binding - open_ai
echo 8) Remote binding - mistral_ai
echo 9) Remote binding - gemini
echo 10) Remote binding - vllm
echo 11) Remote binding - xAI
echo 12) Remote binding - elf
echo 13) Remote binding - remote lollms
2024-04-21 21:36:08 +00:00
echo.
set /p choice="Type the number of your choice and press Enter: "
if "%choice%"=="1" goto :none
if "%choice%"=="2" goto :ollama
if "%choice%"=="3" goto :python_llama_cpp
if "%choice%"=="4" goto :bs_exllamav2
2024-09-01 01:28:43 +00:00
if "%choice%"=="5" goto :groq
if "%choice%"=="6" goto :open_router
if "%choice%"=="7" goto :open_ai
if "%choice%"=="8" goto :mistral_ai
if "%choice%"=="9" goto :gemini
if "%choice%"=="10" goto :vllm
if "%choice%"=="11" goto :xAI
if "%choice%"=="12" goto :elf
if "%choice%"=="13" goto :remote_lollms
2024-04-21 21:36:08 +00:00
goto :end
:none
echo You selected None. No binding will be installed now.
goto :end
:ollama
call python zoos/bindings_zoo/ollama/__init__.py
goto :end
:python_llama_cpp
call python zoos/bindings_zoo/python_llama_cpp/__init__.py
goto :end
:bs_exllamav2
call python zoos/bindings_zoo/bs_exllamav2/__init__.py
goto :end
2024-09-01 01:28:43 +00:00
:groq
call python zoos/bindings_zoo/groq/__init__.py
goto :end
2024-04-21 21:36:08 +00:00
:open_router
call python zoos/bindings_zoo/open_router/__init__.py
goto :end
:open_ai
call python zoos/bindings_zoo/open_ai/__init__.py
goto :end
:mistral_ai
call python zoos/bindings_zoo/mistral_ai/__init__.py
goto :end
2023-07-20 15:28:58 +00:00
2024-09-01 01:28:43 +00:00
:gemini
call python zoos/bindings_zoo/gemini/__init__.py
goto :end
:vllm
call python zoos/bindings_zoo/vllm/__init__.py
goto :end
:xAI
call python zoos/bindings_zoo/xAI/__init__.py
goto :end
:elf
call python zoos/bindings_zoo/elf/__init__.py
goto :end
:remote_lollms
call python zoos/bindings_zoo/remote_lollms/__init__.py
goto :end
2023-07-21 13:38:45 +00:00
2023-07-12 13:01:20 +00:00
:PrintBigMessage
echo. && echo.
echo *******************************************************************
for %%M in (%*) do echo * %%~M
echo *******************************************************************
echo. && echo.
exit /b
2023-12-05 21:45:01 +00:00
goto end
:failed
echo Install failed
goto endend
2023-07-12 13:01:20 +00:00
:end
2024-01-01 03:18:49 +00:00
2023-08-27 18:15:31 +00:00
echo Installation complete.
2023-12-05 21:45:01 +00:00
:endend
2023-08-31 01:04:04 +00:00
pause