Upload webui.bat with huggingface_hub
Browse files
webui.bat
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
|
| 3 |
+
if exist webui.settings.bat (
|
| 4 |
+
call webui.settings.bat
|
| 5 |
+
)
|
| 6 |
+
|
| 7 |
+
if not defined PYTHON (set PYTHON=python)
|
| 8 |
+
if defined GIT (set "GIT_PYTHON_GIT_EXECUTABLE=%GIT%")
|
| 9 |
+
if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv")
|
| 10 |
+
|
| 11 |
+
set SD_WEBUI_RESTART=tmp/restart
|
| 12 |
+
set ERROR_REPORTING=FALSE
|
| 13 |
+
|
| 14 |
+
mkdir tmp 2>NUL
|
| 15 |
+
|
| 16 |
+
%PYTHON% -c "" >tmp/stdout.txt 2>tmp/stderr.txt
|
| 17 |
+
if %ERRORLEVEL% == 0 goto :check_pip
|
| 18 |
+
echo Couldn't launch python
|
| 19 |
+
goto :show_stdout_stderr
|
| 20 |
+
|
| 21 |
+
:check_pip
|
| 22 |
+
%PYTHON% -mpip --help >tmp/stdout.txt 2>tmp/stderr.txt
|
| 23 |
+
if %ERRORLEVEL% == 0 goto :start_venv
|
| 24 |
+
if "%PIP_INSTALLER_LOCATION%" == "" goto :show_stdout_stderr
|
| 25 |
+
%PYTHON% "%PIP_INSTALLER_LOCATION%" >tmp/stdout.txt 2>tmp/stderr.txt
|
| 26 |
+
if %ERRORLEVEL% == 0 goto :start_venv
|
| 27 |
+
echo Couldn't install pip
|
| 28 |
+
goto :show_stdout_stderr
|
| 29 |
+
|
| 30 |
+
:start_venv
|
| 31 |
+
if ["%VENV_DIR%"] == ["-"] goto :skip_venv
|
| 32 |
+
if ["%SKIP_VENV%"] == ["1"] goto :skip_venv
|
| 33 |
+
|
| 34 |
+
dir "%VENV_DIR%\Scripts\Python.exe" >tmp/stdout.txt 2>tmp/stderr.txt
|
| 35 |
+
if %ERRORLEVEL% == 0 goto :activate_venv
|
| 36 |
+
|
| 37 |
+
for /f "delims=" %%i in ('CALL %PYTHON% -c "import sys; print(sys.executable)"') do set PYTHON_FULLNAME="%%i"
|
| 38 |
+
echo Creating venv in directory %VENV_DIR% using python %PYTHON_FULLNAME%
|
| 39 |
+
%PYTHON_FULLNAME% -m venv "%VENV_DIR%" >tmp/stdout.txt 2>tmp/stderr.txt
|
| 40 |
+
if %ERRORLEVEL% == 0 goto :activate_venv
|
| 41 |
+
echo Unable to create venv in directory "%VENV_DIR%"
|
| 42 |
+
goto :show_stdout_stderr
|
| 43 |
+
|
| 44 |
+
:activate_venv
|
| 45 |
+
set PYTHON="%VENV_DIR%\Scripts\Python.exe"
|
| 46 |
+
echo venv %PYTHON%
|
| 47 |
+
|
| 48 |
+
:skip_venv
|
| 49 |
+
if [%ACCELERATE%] == ["True"] goto :accelerate
|
| 50 |
+
goto :launch
|
| 51 |
+
|
| 52 |
+
:accelerate
|
| 53 |
+
echo Checking for accelerate
|
| 54 |
+
set ACCELERATE="%VENV_DIR%\Scripts\accelerate.exe"
|
| 55 |
+
if EXIST %ACCELERATE% goto :accelerate_launch
|
| 56 |
+
|
| 57 |
+
:launch
|
| 58 |
+
%PYTHON% launch.py %*
|
| 59 |
+
if EXIST tmp/restart goto :skip_venv
|
| 60 |
+
pause
|
| 61 |
+
exit /b
|
| 62 |
+
|
| 63 |
+
:accelerate_launch
|
| 64 |
+
echo Accelerating
|
| 65 |
+
%ACCELERATE% launch --num_cpu_threads_per_process=6 launch.py
|
| 66 |
+
if EXIST tmp/restart goto :skip_venv
|
| 67 |
+
pause
|
| 68 |
+
exit /b
|
| 69 |
+
|
| 70 |
+
:show_stdout_stderr
|
| 71 |
+
|
| 72 |
+
echo.
|
| 73 |
+
echo exit code: %errorlevel%
|
| 74 |
+
|
| 75 |
+
for /f %%i in ("tmp\stdout.txt") do set size=%%~zi
|
| 76 |
+
if %size% equ 0 goto :show_stderr
|
| 77 |
+
echo.
|
| 78 |
+
echo stdout:
|
| 79 |
+
type tmp\stdout.txt
|
| 80 |
+
|
| 81 |
+
:show_stderr
|
| 82 |
+
for /f %%i in ("tmp\stderr.txt") do set size=%%~zi
|
| 83 |
+
if %size% equ 0 goto :show_stderr
|
| 84 |
+
echo.
|
| 85 |
+
echo stderr:
|
| 86 |
+
type tmp\stderr.txt
|
| 87 |
+
|
| 88 |
+
:endofscript
|
| 89 |
+
|
| 90 |
+
echo.
|
| 91 |
+
echo Launch unsuccessful. Exiting.
|
| 92 |
+
pause
|