2022-10-13 10:47:58 +03:00
@ echo off
@ rem This script will install git and conda (if not found on the PATH variable)
@ rem using micromamba (an 8mb static-linked single-file binary, conda replacement).
@ rem For users who already have git and conda, this step will be skipped.
2022-10-13 12:26:50 +03:00
@ rem Then, it'll run the webui.cmd file to continue with the installation as usual.
2022-10-13 10:47:58 +03:00
@ rem This enables a user to install this project without manually installing conda and git.
2022-10-26 14:03:08 +03:00
echo " Installing Sygil WebUI.. "
echo .
2022-10-13 10:47:58 +03:00
@ rem config
set MAMBA_ROOT_PREFIX = %cd% \installer_files\mamba
set INSTALL_ENV_DIR = %cd% \installer_files\env
2022-10-26 14:03:08 +03:00
set MICROMAMBA_DOWNLOAD_URL = https://github.com/cmdr2/stable-diffusion-ui/releases/download/v1.1/micromamba.exe
2022-10-29 17:18:51 +03:00
set REPO_URL = https://github.com/Sygil-Dev/sygil-webui.git
2022-10-26 14:03:08 +03:00
@ rem Change the download URL to Sygil repo's release URL
@ rem We need to mirror micromamba.exe, because the official download URL uses tar.bz2 compression
@ rem which Windows can't unzip natively.
@ rem https://mamba.readthedocs.io/en/latest/installation.html#windows
2022-10-29 17:18:51 +03:00
set umamba_exists = F
2022-10-13 10:47:58 +03:00
@ rem figure out whether git and conda needs to be installed
2022-10-26 14:03:08 +03:00
if exist " %INSTALL_ENV_DIR% " set PATH = %INSTALL_ENV_DIR% ;%INSTALL_ENV_DIR% \Library\bin;%INSTALL_ENV_DIR% \Scripts;%INSTALL_ENV_DIR% \Library\usr\bin;%PATH%
2022-10-13 10:47:58 +03:00
set PACKAGES_TO_INSTALL =
call conda --version > .tmp1 2 > .tmp2
if " %ERRORLEVEL% " NEQ " 0 " set PACKAGES_TO_INSTALL = %PACKAGES_TO_INSTALL% conda
call git --version > .tmp1 2 > .tmp2
if " %ERRORLEVEL% " NEQ " 0 " set PACKAGES_TO_INSTALL = %PACKAGES_TO_INSTALL% git
2022-10-29 17:18:51 +03:00
call " %MAMBA_ROOT_PREFIX% \micromamba.exe " --version > .tmp1 2 > .tmp2
if " %ERRORLEVEL% " EQU " 0 " set umamba_exists = T
2022-10-13 10:47:58 +03:00
@ rem (if necessary) install git and conda into a contained environment
if " %PACKAGES_TO_INSTALL% " NEQ " " (
2022-10-26 14:03:08 +03:00
@ rem download micromamba
2022-10-29 17:18:51 +03:00
if " %umamba_exists% " == " F " (
2022-10-26 14:03:08 +03:00
echo " Downloading micromamba from %MICROMAMBA_DOWNLOAD_URL% to %MAMBA_ROOT_PREFIX% \micromamba.exe "
2022-10-13 10:47:58 +03:00
mkdir " %MAMBA_ROOT_PREFIX% "
2022-10-26 14:03:08 +03:00
call curl -L " %MICROMAMBA_DOWNLOAD_URL% " > " %MAMBA_ROOT_PREFIX% \micromamba.exe "
2022-10-13 10:47:58 +03:00
@ rem test the mamba binary
echo Micromamba version:
call " %MAMBA_ROOT_PREFIX% \micromamba.exe " --version
)
@ rem create the installer env
if not exist " %INSTALL_ENV_DIR% " (
call " %MAMBA_ROOT_PREFIX% \micromamba.exe " create -y --prefix " %INSTALL_ENV_DIR% "
)
echo " Packages to install: %PACKAGES_TO_INSTALL% "
call " %MAMBA_ROOT_PREFIX% \micromamba.exe " install -y --prefix " %INSTALL_ENV_DIR% " -c conda-forge %PACKAGES_TO_INSTALL%
2022-10-13 15:29:50 +03:00
2022-10-26 14:03:08 +03:00
if not exist " %INSTALL_ENV_DIR% " (
echo " There was a problem while installing %PACKAGES_TO_INSTALL% using micromamba. Cannot continue. "
pause
exit /b
2022-10-13 15:29:50 +03:00
)
2022-10-13 10:47:58 +03:00
)
2022-10-26 14:08:32 +03:00
set PATH = %INSTALL_ENV_DIR% ;%INSTALL_ENV_DIR% \Library\bin;%INSTALL_ENV_DIR% \Scripts;%INSTALL_ENV_DIR% \Library\usr\bin;%PATH%
2022-10-13 10:47:58 +03:00
@ rem get the repo (and load into the current directory)
if not exist " .git " (
call git config --global init.defaultBranch master
call git init
2022-10-26 14:03:08 +03:00
call git remote add origin %REPO_URL%
2022-10-13 10:47:58 +03:00
call git fetch
call git checkout origin/master -ft
)
2022-10-26 14:03:08 +03:00
@ rem activate the base env
call conda activate
2022-10-13 10:47:58 +03:00
@ rem make the models dir
mkdir models\ldm\stable-diffusion-v1
@ rem install the project
2022-10-13 10:53:56 +03:00
call webui.cmd
2022-10-13 10:47:58 +03:00
@ rem finally, tell the user that they need to download the ckpt
echo .
echo " Now you need to install the weights for the stable diffusion model. "
echo " Please follow the steps related to models weights at https://sd-webui.github.io/stable-diffusion-webui/docs/1.windows-installation.html#cloning-the-repo to complete the installation "
@ rem it would be nice if the weights downloaded automatically, and didn't need the user to do this manually.
2022-10-13 12:48:08 +03:00
pause