mirror of
https://github.com/Sygil-Dev/sygil-webui.git
synced 2024-12-14 22:13:41 +03:00
5853f3e1a1
# Adds the bridge code which when enabled turns the webui into a headless [Stable Horde](https://stablehorde.net) instance It adds a few new command-line args to be able to pass variables to the bridge, as well as the possibility to set it via a variables files `bridgeData.py`. To start the bridge, one needs to add the `--bridge` argument to their relauncher.py as well as any horde vars they want to specify. On top of that this adds the loguru module as well as my tuned loguru config. This provides a much nicer logging output and provides the capability to save output to files for issue reports etc. For now only the bridge is utilizing the nice format, but once it's merged, you can start replacing `print()` with `logger.xxx()` where appropriate To make the bridge work, I've had to add defaults to txt2img but this should not affect anything. # Checklist: - [ x ] I have changed the base branch to `dev` - [ x ] I have performed a self-review of my own code - [ x ] I have commented my code in hard-to-understand areas - [ x ] I have made corresponding changes to the documentation Co-authored-by: hlky <106811348+hlky@users.noreply.github.com> Co-authored-by: Thomas Mello <work.mello@gmail.com> Co-authored-by: Joshua Kimsey <jkimsey95@gmail.com> Co-authored-by: ZeroCool <ZeroCool940711@users.noreply.github.com>
107 lines
3.5 KiB
Batchfile
107 lines
3.5 KiB
Batchfile
@echo off
|
|
:: This file is part of stable-diffusion-webui (https://github.com/sd-webui/stable-diffusion-webui/).
|
|
|
|
:: Copyright 2022 sd-webui team.
|
|
:: This program is free software: you can redistribute it and/or modify
|
|
:: it under the terms of the GNU Affero General Public License as published by
|
|
:: the Free Software Foundation, either version 3 of the License, or
|
|
:: (at your option) any later version.
|
|
|
|
:: This program is distributed in the hope that it will be useful,
|
|
:: but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
:: GNU Affero General Public License for more details.
|
|
|
|
:: You should have received a copy of the GNU Affero General Public License
|
|
:: along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
:: Run all commands using this script's directory as the working directory
|
|
cd %~dp0
|
|
|
|
:: copy over the first line from environment.yaml, e.g. name: ldm, and take the second word after splitting by ":" delimiter
|
|
for /F "tokens=2 delims=: " %%i in (environment.yaml) DO (
|
|
set v_conda_env_name=%%i
|
|
goto EOL
|
|
)
|
|
:EOL
|
|
|
|
echo Environment name is set as %v_conda_env_name% as per environment.yaml
|
|
|
|
:: Put the path to conda directory in a file called "custom-conda-path.txt" if it's installed at non-standard path
|
|
IF EXIST custom-conda-path.txt (
|
|
FOR /F %%i IN (custom-conda-path.txt) DO set v_custom_path=%%i
|
|
)
|
|
|
|
set v_paths=%ProgramData%\miniconda3
|
|
set v_paths=%v_paths%;%USERPROFILE%\miniconda3
|
|
set v_paths=%v_paths%;%ProgramData%\anaconda3
|
|
set v_paths=%v_paths%;%USERPROFILE%\anaconda3
|
|
|
|
for %%a in (%v_paths%) do (
|
|
IF NOT "%v_custom_path%"=="" (
|
|
set v_paths=%v_custom_path%;%v_paths%
|
|
)
|
|
)
|
|
|
|
for %%a in (%v_paths%) do (
|
|
if EXIST "%%a\Scripts\activate.bat" (
|
|
SET v_conda_path=%%a
|
|
echo anaconda3/miniconda3 detected in %%a
|
|
goto :CONDA_FOUND
|
|
)
|
|
)
|
|
|
|
IF "%v_conda_path%"=="" (
|
|
echo anaconda3/miniconda3 not found. Install from here https://docs.conda.io/en/latest/miniconda.html
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
:CONDA_FOUND
|
|
echo Stashing local changes and pulling latest update...
|
|
call git stash
|
|
call git pull
|
|
set /P restore="Do you want to restore changes you made before updating? (Y/N): "
|
|
IF /I "%restore%" == "N" (
|
|
echo Removing changes please wait...
|
|
call git stash drop
|
|
echo Changes removed, press any key to continue...
|
|
pause >nul
|
|
) ELSE IF /I "%restore%" == "Y" (
|
|
echo Restoring changes, please wait...
|
|
call git stash pop --quiet
|
|
echo Changes restored, press any key to continue...
|
|
pause >nul
|
|
)
|
|
call "%v_conda_path%\Scripts\activate.bat"
|
|
|
|
for /f "delims=" %%a in ('git log -1 --format^="%%H" -- environment.yaml') DO set v_cur_hash=%%a
|
|
set /p "v_last_hash="<"z_version_env.tmp"
|
|
echo %v_cur_hash%>z_version_env.tmp
|
|
|
|
echo Current environment.yaml hash: %v_cur_hash%
|
|
echo Previous environment.yaml hash: %v_last_hash%
|
|
|
|
if "%v_last_hash%" == "%v_cur_hash%" (
|
|
echo environment.yaml unchanged. dependencies should be up to date.
|
|
echo if you still have unresolved dependencies, delete "z_version_env.tmp"
|
|
) else (
|
|
echo environment.yaml changed. updating dependencies
|
|
call conda env create --name "%v_conda_env_name%" -f environment.yaml
|
|
call conda env update --name "%v_conda_env_name%" -f environment.yaml
|
|
)
|
|
|
|
|
|
call "%v_conda_path%\Scripts\activate.bat" "%v_conda_env_name%"
|
|
|
|
:PROMPT
|
|
set SETUPTOOLS_USE_DISTUTILS=stdlib
|
|
IF EXIST "models\ldm\stable-diffusion-v1\model.ckpt" (
|
|
set "PYTHONPATH=%~dp0"
|
|
python scripts\relauncher.py %*
|
|
) ELSE (
|
|
echo Your model file does not exist! Place it in 'models\ldm\stable-diffusion-v1' with the name 'model.ckpt'.
|
|
pause
|
|
)
|
|
|
|
::cmd /k
|