CoolFace
Modelpublic

skyadmin/cog-webui-sd

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes23downloads
webui_v2.bat86 linesDownload Raw Back to root
1@echo off2 3if not defined PYTHON (set PYTHON=python)4if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv")5 6 7set ERROR_REPORTING=FALSE8 9mkdir tmp 2>NUL10 11%PYTHON% -c "" >tmp/stdout.txt 2>tmp/stderr.txt12if %ERRORLEVEL% == 0 goto :check_pip13echo Couldn't launch python14goto :show_stdout_stderr15 16:check_pip17%PYTHON% -mpip --help >tmp/stdout.txt 2>tmp/stderr.txt18if %ERRORLEVEL% == 0 goto :start_venv19if "%PIP_INSTALLER_LOCATION%" == "" goto :show_stdout_stderr20%PYTHON% "%PIP_INSTALLER_LOCATION%" >tmp/stdout.txt 2>tmp/stderr.txt21if %ERRORLEVEL% == 0 goto :start_venv22echo Couldn't install pip23goto :show_stdout_stderr24 25:start_venv26if ["%VENV_DIR%"] == ["-"] goto :skip_venv27if ["%SKIP_VENV%"] == ["1"] goto :skip_venv28 29dir "%VENV_DIR%\Scripts\Python.exe" >tmp/stdout.txt 2>tmp/stderr.txt30if %ERRORLEVEL% == 0 goto :activate_venv31 32for /f "delims=" %%i in ('CALL %PYTHON% -c "import sys; print(sys.executable)"') do set PYTHON_FULLNAME="%%i"33echo Creating venv in directory %VENV_DIR% using python %PYTHON_FULLNAME%34%PYTHON_FULLNAME% -m venv "%VENV_DIR%" >tmp/stdout.txt 2>tmp/stderr.txt35if %ERRORLEVEL% == 0 goto :activate_venv36echo Unable to create venv in directory "%VENV_DIR%"37goto :show_stdout_stderr38 39:activate_venv40set PYTHON="%VENV_DIR%\Scripts\Python.exe"41echo venv %PYTHON%42 43:skip_venv44if [%ACCELERATE%] == ["True"] goto :accelerate45goto :launch46 47:accelerate48echo Checking for accelerate49set ACCELERATE="%VENV_DIR%\Scripts\accelerate.exe"50if EXIST %ACCELERATE% goto :accelerate_launch51 52:launch53%PYTHON% webui_v2.py %*54pause55exit /b56 57:accelerate_launch58echo Accelerating59%ACCELERATE% launch --num_cpu_threads_per_process=6 webui_v2.py60pause61exit /b62 63:show_stdout_stderr64 65echo.66echo exit code: %errorlevel%67 68for /f %%i in ("tmp\stdout.txt") do set size=%%~zi69if %size% equ 0 goto :show_stderr70echo.71echo stdout:72type tmp\stdout.txt73 74:show_stderr75for /f %%i in ("tmp\stderr.txt") do set size=%%~zi76if %size% equ 0 goto :show_stderr77echo.78echo stderr:79type tmp\stderr.txt80 81:endofscript82 83echo.84echo Launch unsuccessful. Exiting.85pause86