Kizi-Art commited on
Commit
d0a0701
1 Parent(s): 1e62ec2

Upload webui.bat with huggingface_hub

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