2023-04-06 19:12:49 +00:00
@ echo off
2023-04-06 20:07:20 +00:00
echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHH .HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHH. ,HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHH.## HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHHH#.HHHHH/*,*,*,*,*,*,*,*,***,*,**#HHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHHHHH.*,,***,***,***,***,***,***,*******HHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHHH*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*,,,,,HHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHH.,,,***,***,***,***,***,***,***,***,***,***/HHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHH*,,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*HHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHH#,***,***,***,***,***,***,***,***,***,***,***,**HHHHHHHHHHHHHHHHH
echo HHHHHHHHHH..HHH,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*#HHHHHHHHHHHHHHHH
echo HHHHHHH,,,**,/H*,***,***,***,,,*,***,***,***,**,,,**,***,***,***H,,*,***HHHHHHHH
echo HHHHHH.*,,,*,,,,,*,*,*,***#HHHHH.,,*,*,*,*,**/HHHHH.,*,*,*,*,*,*,*,*****HHHHHHHH
echo HHHHHH.*,***,*,*,***,***,.HHHHHHH/**,***,****HHHHHHH.***,***,***,*******HHHHHHHH
echo HHHHHH.,,,,,,,,,,,,,,,,,,,.HHHHH.,,,,,,,,,,,,.HHHHHH,,,,,,,,,,,,,,,,,***HHHHHHHH
echo HHHHHH.,,,,,,/H,,,**,***,***,,,*,***,***,***,**,,,,*,***,***,***H***,***HHHHHHHH
echo HHHHHHH.,,,,*.H,,,,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,***H*,,,,/HHHHHHHHH
echo HHHHHHHHHHHHHHH*,***,***,**,,***,***,***,***,***,***,***,***,**.HHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHH,,,,,,,,*,,#H#,,,,,*,,,*,,,,,,,,*#H*,,,,,,,,,**HHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHH,,*,***,***,**/.HHHHHHHHHHHHH#*,,,*,***,***,*HHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHH,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*HHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHH**,***,***,***,***,***,***,***,***,***,***,*.HHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHH*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*HHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHH**,***,***,*******/..HHHHHHHHH.#/*,*,,,***,***HHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHH*,*,*,******#HHHHHHHHHHHHHHHHHHHHHHHHHHHH./**,,,.HHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHH.,,*,***.HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH.*#HHHHHHHHHHHH
echo HHHHHHHHHHHHHHH/,,,*.HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHH,,#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHH.HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
2023-04-06 20:16:52 +00:00
if not exist " ./tmp " mkdir " ./tmp "
2023-04-06 20:07:20 +00:00
2023-04-09 11:37:16 +00:00
REM Check if Git is installed
echo " Checking for git... "
where git > nul 2 >& 1
if %ERRORLEVEL% EQU 0 (
goto GIT_CHECKED
) else (
goto GIT_INSTALL
)
: GIT_FINISH
REM Check if Git is installed
: GIT_CHECKED
echo " Git is installed. "
goto GIT_SKIP
: GIT_INSTALL
echo .
choice /C YN /M " Do you want to download and install Git? "
if errorlevel 2 goto GIT_CANCEL
if errorlevel 1 goto GIT_INSTALL_2
: GIT_INSTALL_2
echo " Git is not installed. Installing Git... "
powershell.exe -Command " Start-Process https://git-scm.com/download/win -Wait "
goto GIT_SKIP
: GIT_CANCEL
echo .
echo Git download cancelled.
echo Please install Git and try again.
pause
exit /b 1
: GIT_SKIP
2023-04-06 19:12:49 +00:00
REM Check if Python is installed
set /p = " Checking for python... " < nul
2023-04-06 20:07:20 +00:00
where python > nul 2 >& 1
2023-04-11 08:24:12 +00:00
if %ERRORLEVEL% EQU 0 (
goto PYTHON_CHECKED
2023-04-06 19:12:49 +00:00
) else (
2023-04-11 08:24:12 +00:00
goto PYTHON_INSTALL
2023-04-06 19:12:49 +00:00
)
2023-04-11 08:24:12 +00:00
: PYTHON_CHECKED
echo " Python is installed. "
goto PYTHON_SKIP
: PYTHON_INSTALL
echo .
choice /C YN /M " Do you want to download and install python? "
if errorlevel 2 goto PYTHON_CANCEL
if errorlevel 1 goto PYTHON_INSTALL_2
: PYTHON_INSTALL_2
REM Download Python installer
echo Downloading Python installer...
powershell -Command " Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe' -OutFile 'tmp/python.exe' "
REM Install Python
echo Installing Python...
tmp/python.exe /quiet /norestart
: PYTHON_CANCEL
echo Please install python and try again.
pause
exit /b 1
: PYTHON_SKIP
2023-04-06 19:12:49 +00:00
2023-04-06 20:07:20 +00:00
2023-04-06 19:12:49 +00:00
REM Check if pip is installed
set /p = " Checking for pip... " < nul
python -m pip > nul 2 >& 1
2023-04-11 08:24:12 +00:00
if %ERRORLEVEL% EQU 0 (
goto PIP_CHECKED
2023-04-06 19:12:49 +00:00
) else (
2023-04-11 08:24:12 +00:00
goto PIP_INSTALL
2023-04-06 19:12:49 +00:00
)
2023-04-11 08:24:12 +00:00
: PIP_CHECKED
echo " Pip is installed. "
goto PIP_SKIP
: PIP_INSTALL
echo .
choice /C YN /M " Do you want to download and install pip? "
if errorlevel 2 goto PIP_CANCEL
if errorlevel 1 goto PIP_INSTALL_2
: PIP_INSTALL_2
REM Download get-pip.py
echo Downloading get-pip.py...
powershell -Command " Invoke-WebRequest -Uri 'https://bootstrap.pypa.io/get-pip.py' -OutFile 'tmp/get-pip.py' "
REM Install pip
echo Installing pip...
python tmp/get-pip.py
: PIP_CANCEL
echo Please install pip and try again.
pause
exit /b 1
: PIP_SKIP
2023-04-06 19:12:49 +00:00
2023-04-11 08:24:12 +00:00
REM Upgrading pip setuptools and wheel
echo Updating pip setuptools and wheel
python -m pip install --upgrade pip setuptools wheel
REM Check if pip is installed
set /p = " Checking for virtual environment... " < nul
2023-04-06 19:12:49 +00:00
python -c " import venv " > nul 2 >& 1
2023-04-11 08:24:12 +00:00
if %ERRORLEVEL% EQU 0 (
goto VENV_CHECKED
2023-04-06 19:12:49 +00:00
) else (
2023-04-11 08:24:12 +00:00
goto VENV_INSTALL
2023-04-06 19:12:49 +00:00
)
2023-04-11 08:24:12 +00:00
: VENV_CHECKED
echo " Virtual environment is installed. "
goto VENV_SKIP
: VENV_INSTALL
echo .
choice /C YN /M " Do you want to download and install venv? "
if errorlevel 2 goto VENV_CANCEL
if errorlevel 1 goto VENV_INSTALL_2
: VENV_INSTALL_2
REM Installinv venv
echo installing venv...
pip install virtualenv
: VENV_CANCEL
echo Please install venv and try again.
pause
exit /b 1
: VENV_SKIP
2023-04-06 19:12:49 +00:00
REM Create a new virtual environment
set /p = " Creating virtual environment ... " < nul
2023-04-11 08:24:12 +00:00
python -m venv env > nul 2 >& 1
if %ERRORLEVEL% EQU 0 (
goto VENV_CREATED
) else (
2023-04-06 19:12:49 +00:00
echo Failed to create virtual environment. Please check your Python installation and try again.
pause
exit /b 1
)
2023-04-11 08:24:12 +00:00
: VENV_CREATED
2023-04-06 19:12:49 +00:00
REM Activate the virtual environment
set /p = " Activating virtual environment ... " < nul
call env\Scripts\activate.bat
echo OK
REM Install the required packages
echo Installing requirements ...
python -m pip install pip --upgrade
python -m pip install -r requirements.txt
2023-04-07 07:15:54 +00:00
if %ERRORLEVEL% neq 0 (
2023-04-06 19:12:49 +00:00
echo Failed to install required packages. Please check your internet connection and try again.
pause
exit /b 1
)
2023-04-06 20:16:52 +00:00
echo Downloading latest model
2023-04-07 11:40:08 +00:00
if not exist models (
2023-04-07 07:07:59 +00:00
md models
2023-04-07 07:47:43 +00:00
)
2023-04-07 08:37:57 +00:00
2023-04-07 11:40:08 +00:00
if not exist models/gpt4all-lora-quantized-ggml.bin (
echo .
choice /C YNB /M " The default model file (gpt4all-lora-quantized-ggml.bin) does not exist. Do you want to download it? Press B to download it with a browser (faster). "
if errorlevel 3 goto DOWNLOAD_WITH_BROWSER
if errorlevel 2 goto DOWNLOAD_SKIP
if errorlevel 1 goto MODEL_DOWNLOAD
2023-04-07 08:37:57 +00:00
) ELSE (
echo .
2023-04-07 11:40:08 +00:00
choice /C YNB /M " The default model file (gpt4all-lora-quantized-ggml.bin) already exists. Do you want to replace it? Press B to download it with a browser (faster). "
if errorlevel 3 goto DOWNLOAD_WITH_BROWSER
if errorlevel 2 goto DOWNLOAD_SKIP
if errorlevel 1 goto MODEL_DOWNLOAD
)
: DOWNLOAD_WITH_BROWSER
2023-04-14 19:06:47 +00:00
start https://huggingface.co/ParisNeo/GPT4All/resolve/main/gpt4all-lora-quantized-ggml.bin
2023-04-09 10:55:55 +00:00
echo Link has been opened with the default web browser, make sure to save it into the models folder before continuing. Press any key to continue...
2023-04-07 11:40:08 +00:00
pause
goto : CONTINUE
: MODEL_DOWNLOAD
echo .
echo Downloading latest model...
2023-04-14 19:06:47 +00:00
powershell -Command " Invoke-WebRequest -Uri 'https://huggingface.co/ParisNeo/GPT4All/resolve/main/gpt4all-lora-quantized-ggml.bin' -OutFile 'models/gpt4all-lora-quantized-ggml.bin' "
2023-04-07 11:40:08 +00:00
if errorlevel 1 (
echo Failed to download model. Please check your internet connection.
choice /C YN /M " Do you want to try downloading again? "
if errorlevel 2 goto DOWNLOAD_SKIP
if errorlevel 1 goto MODEL_DOWNLOAD
) else (
echo Model successfully downloaded.
2023-04-07 07:47:43 +00:00
)
2023-04-07 11:40:08 +00:00
goto : CONTINUE
: DOWNLOAD_SKIP
echo .
echo Skipping download of model file...
goto : CONTINUE
2023-04-07 08:37:57 +00:00
: CONTINUE
2023-04-06 20:16:52 +00:00
2023-04-09 10:55:55 +00:00
: END
2023-04-08 10:25:40 +00:00
2023-04-06 20:16:52 +00:00
echo Cleaning tmp folder
rd /s /q " ./tmp "
2023-04-06 21:26:42 +00:00
echo Virtual environment created and packages installed successfully.
echo Every thing is setup. Just run run.bat
2023-04-06 19:12:49 +00:00
pause
exit /b 0