forked from ParisNeo/lollms-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc_webui.bat
159 lines (135 loc) · 5.08 KB
/
c_webui.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
@echo off
set environment_path=%cd%/lollms-webui/env
echo \u001b[34m
echo " ___ ___ ___ ___ ___ ___ "
echo " /\__\ /\ \ /\__\ /\__\ /\__\ /\ \ "
echo " /:/ / /::\ \ /:/ / /:/ / /::| | /::\ \ "
echo " /:/ / /:/\:\ \ /:/ / /:/ / /:|:| | /:/\ \ \ "
echo " /:/ / /:/ \:\ \ /:/ / /:/ / /:/|:|__|__ _\:\~\ \ \ "
echo " /:/__/ /:/__/ \:\__\ /:/__/ /:/__/ /:/ |::::\__\ /\ \:\ \ \__\ "
echo " \:\ \ \:\ \ /:/ / \:\ \ \:\ \ \/__/~~/:/ / \:\ \:\ \/__/ "
echo " \:\ \ \:\ /:/ / \:\ \ \:\ \ /:/ / \:\ \:\__\ "
echo " \:\ \ \:\/:/ / \:\ \ \:\ \ /:/ / \:\/:/ / "
echo " \:\__\ \::/ / \:\__\ \:\__\ /:/ / \::/ / "
echo " \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ "
echo By ParisNeo
echo \u001b[0m
echo Testing internet connection
ping -n 1 google.com >nul
if %errorlevel% equ 0 (
echo Internet Connection working fine
REM Install Git
echo Checking for Git...
where git >nul 2>nul
if %errorlevel% equ 0 (
echo Git is installed
) else (
set /p choice=Git is not installed. Would you like to install Git? [Y/N]
if /i "%choice%"=="Y" (
echo Installing Git...
REM Replace the following two lines with appropriate Git installation commands for Windows
echo Please install Git and try again.
exit /b 1
)
)
REM Check if repository exists
if exist .git (
echo Pulling latest changes
git pull
) else (
if exist lollms-webui (
cd ./lollms-webui
) else (
echo Cloning repository...
git clone https://github.com/ParisNeo/lollms-webui.git ./lollms-webui
cd ./lollms-webui
echo Cloned successfully
)
)
echo Pulling latest version...
git pull
REM Install Conda
echo Checking for Conda...
where conda >nul 2>nul
if %errorlevel% equ 0 (
echo Conda is installed
) else (
set /p choice="Conda is not installed. Would you like to install Conda? [Y/N]:"
if /i "%choice%"=="Y" (
echo Installing Conda...
set "miniconda_installer_url=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe"
set "miniconda_installer=miniconda_installer_filename.exe"
rem Download the Miniconda installer using curl.
curl -o "%miniconda_installer%" "%miniconda_installer_url%"
if exist "%miniconda_installer%" (
echo Miniconda installer downloaded successfully.
echo Installing Miniconda...
echo.
rem Run the Miniconda installer.
"%miniconda_installer%" /InstallationType=JustMe /AddToPath=yes /RegisterPython=0 /S /D="%USERPROFILE%\Miniconda"
if %errorlevel% equ 0 (
echo Miniconda has been installed successfully in "%USERPROFILE%\Miniconda".
) else (
echo Failed to install Miniconda.
)
rem Clean up the Miniconda installer file.
del "%miniconda_installer%"
rem Activate Miniconda.
call "%USERPROFILE%\Miniconda\Scripts\activate"
) else (
echo Failed to download the Miniconda installer.
exit /b 1
)
)
)
echo Deactivating any activated environment
conda deactivate
echo checking %environment_path% existance
rem Check the error level to determine if the file exists
if not exist "%environment_path%" (
REM Create a new Conda environment
echo Creating Conda environment...
conda create --prefix ./env python=3.10
conda activate ./env
pip install --upgrade pip setuptools wheel
conda install -c conda-forge cudatoolkit-dev
) else (
echo Environment already exists. Skipping environment creation.
conda activate ./env
)
echo Activating environment
conda activate ./env
echo Conda environment is created
REM Install the required packages
echo Installing requirements using pip...
pip install -r requirements.txt
if %errorlevel% neq 0 (
echo Failed to install required packages. Please check your internet connection and try again.
exit /b 1
)
echo Cleanup
REM Cleanup
if exist "./tmp" (
echo Cleaning tmp folder
rmdir /s /q "./tmp"
echo Done
)
echo Ready
echo launching app
REM Launch the Python application
python app.py %*
set app_result=%errorlevel%
pause >nul
exit /b 0
) else (
REM Go to webui folder
cd lollms-webui
REM Activate environment
conda activate ./env
echo launching app
REM Launch the Python application
python app.py %*
set app_result=%errorlevel%
pause >nul
exit /b 0
)