2022-09-06 12:40:17 +02:00
@ echo off
2022-09-02 12:11:53 +02:00
2022-11-15 23:29:32 +01:00
@ REM Caution, this file will make your eyes and brain bleed. It's such an unholy mess.
@ REM Note to self: Please rewrite this in Python. For the sake of your own sanity.
2023-04-17 12:55:17 +02:00
@ copy sd-ui-files\scripts\on_env_start.bat scripts\ /Y
@ copy sd-ui-files\scripts\bootstrap.bat scripts\ /Y
@ copy sd-ui-files\scripts\check_modules.py scripts\ /Y
2023-04-19 12:43:29 +02:00
@ copy sd-ui-files\scripts\check_models.py scripts\ /Y
2022-09-09 13:54:30 +02:00
2022-10-26 08:45:58 +02:00
if exist " %cd% \profile " (
set USERPROFILE = %cd% \profile
)
2022-12-24 09:07:50 +01:00
@ rem set the correct installer path (current vs legacy)
if exist " %cd% \installer_files\env " (
set INSTALL_ENV_DIR = %cd% \installer_files\env
)
if exist " %cd% \stable-diffusion\env " (
set INSTALL_ENV_DIR = %cd% \stable-diffusion\env
)
2022-11-15 23:29:32 +01:00
@ mkdir tmp
@ set TMP = %cd% \tmp
@ set TEMP = %cd% \tmp
2022-10-26 08:45:58 +02:00
@ rem activate the installer env
call conda activate
2022-11-22 06:10:20 +01:00
@ if " %ERRORLEVEL% " NEQ " 0 " (
2023-02-14 09:05:23 +01:00
@ echo . & echo " Error activating conda for Easy Diffusion. Sorry about that, please try to: " & echo " 1. Run this installer again. " & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting " & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB " & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues " & echo " Thanks! " & echo .
2022-11-22 06:10:20 +01:00
pause
exit /b
)
2022-09-09 17:35:24 +02:00
2022-10-22 19:54:13 +02:00
@ REM remove the old version of the dev console script, if it's still present
2022-10-07 16:22:31 +02:00
if exist " Open Developer Console.cmd " del " Open Developer Console.cmd "
2022-10-06 07:55:14 +02:00
2022-12-24 09:07:50 +01:00
@ rem create the stable-diffusion folder, to work with legacy installations
if not exist " stable-diffusion " mkdir stable-diffusion
cd stable-diffusion
2022-09-13 16:29:41 +02:00
2022-12-24 09:07:50 +01:00
@ rem activate the old stable-diffusion env, if it exists
if exist " env " (
call conda activate .\env
2022-09-02 10:28:36 +02:00
)
2022-12-24 09:31:33 +01:00
@ rem disable the legacy src and ldm folder (otherwise this prevents installing gfpgan and realesrgan)
if exist src rename src src-old
if exist ldm rename ldm ldm-old
2022-12-28 14:38:39 +01:00
2023-02-20 23:02:27 +01:00
if not exist " %INSTALL_ENV_DIR% \DLLs\libssl-1_1-x64.dll " copy " %INSTALL_ENV_DIR% \Library\bin\libssl-1_1-x64.dll " " %INSTALL_ENV_DIR% \DLLs\ "
if not exist " %INSTALL_ENV_DIR% \DLLs\libcrypto-1_1-x64.dll " copy " %INSTALL_ENV_DIR% \Library\bin\libcrypto-1_1-x64.dll " " %INSTALL_ENV_DIR% \DLLs\ "
2023-04-18 12:12:33 +02:00
@ rem install or upgrade the required modules
2023-02-06 15:12:24 +01:00
set PATH = C:\Windows\System32;%PATH%
2022-09-06 15:02:36 +02:00
2023-04-18 12:12:33 +02:00
@ REM prevent from using packages from the user's home directory, to avoid conflicts
set PYTHONNOUSERSITE = 1
set PYTHONPATH = %INSTALL_ENV_DIR% \lib\site-packages
2022-09-12 13:09:23 +02:00
2023-04-19 12:41:16 +02:00
@ rem Download the required packages
2023-04-18 12:12:33 +02:00
call python ..\scripts\check_modules.py
if " %ERRORLEVEL% " NEQ " 0 " (
pause
exit /b
2022-09-02 10:28:36 +02:00
)
2022-10-08 19:15:43 +02:00
call WHERE uvicorn > .tmp
2022-10-23 07:17:44 +02:00
@ > nul findstr /m " uvicorn " .tmp
2022-10-08 19:15:43 +02:00
@ if " %ERRORLEVEL% " NEQ " 0 " (
2022-10-17 11:46:31 +02:00
@ echo . & echo " UI packages not found! Sorry about that, please try to: " & echo " 1. Run this installer again. " & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting " & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB " & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues " & echo " Thanks! " & echo .
2022-10-08 19:15:43 +02:00
pause
exit /b
)
2022-09-06 15:02:36 +02:00
2022-10-23 07:17:44 +02:00
@ > nul findstr /m " conda_sd_ui_deps_installed " ..\scripts\install_status.txt
2022-09-06 15:02:36 +02:00
@ if " %ERRORLEVEL% " NEQ " 0 " (
@ echo conda_sd_ui_deps_installed >> ..\scripts\install_status.txt
)
2023-04-19 12:41:16 +02:00
@ rem Download the required models
call python ..\scripts\check_models.py
if " %ERRORLEVEL% " NEQ " 0 " (
pause
exit /b
2022-09-09 17:35:24 +02:00
)
2022-10-23 07:17:44 +02:00
@ > nul findstr /m " sd_install_complete " ..\scripts\install_status.txt
2022-09-07 09:32:41 +02:00
@ if " %ERRORLEVEL% " NEQ " 0 " (
2022-09-02 13:01:34 +02:00
@ echo sd_weights_downloaded >> ..\scripts\install_status.txt
@ echo sd_install_complete >> ..\scripts\install_status.txt
)
2022-09-02 10:28:36 +02:00
2023-02-14 09:05:23 +01:00
@ echo . & echo " Easy Diffusion installation complete! Starting the server! " & echo .
2022-09-02 10:28:36 +02:00
2022-09-12 19:36:51 +02:00
@ set SD_DIR = %cd%
2022-12-24 09:07:50 +01:00
set PYTHONPATH = %INSTALL_ENV_DIR% \lib\site-packages
echo PYTHONPATH=%PYTHONPATH%
2022-09-12 19:36:51 +02:00
2022-10-26 12:30:21 +02:00
call where python
call python --version
2022-09-05 12:00:04 +02:00
@ cd ..
@ set SD_UI_PATH = %cd% \ui
2023-04-21 00:09:27 +02:00
@ FOR /F " tokens=* USEBACKQ " %% F IN ( `python scripts\get_config.py --default=9000 net listen_port` ) DO (
@ SET ED_BIND_PORT = %% F
)
@ FOR /F " tokens=* USEBACKQ " %% F IN ( `python scripts\get_config.py --default=False net listen_to_network` ) DO (
if " %% F " EQU " True " (
@ SET ED_BIND_IP = 0.0.0.0
) else (
@ SET ED_BIND_IP = 127.0.0.1
)
)
2022-09-05 12:00:04 +02:00
@ cd stable-diffusion
2022-09-02 10:28:36 +02:00
2022-12-28 12:18:12 +01:00
@ rem set any overrides
set HF_HUB_DISABLE_SYMLINKS_WARNING = true
2023-04-21 00:09:27 +02:00
@ uvicorn main:server_api --app-dir " %SD_UI_PATH% " --port %ED_BIND_PORT% --host %ED_BIND_IP% --log-level error
2022-11-05 23:30:40 +01:00
2022-09-02 10:28:36 +02:00
2022-10-09 06:26:44 +02:00
@ pause