Merge pull request #75 from cmdr2/develop

Check whether the dependencies were downloaded correctly, else displa…
This commit is contained in:
cmdr2 2022-09-06 18:33:15 +05:30 committed by GitHub
commit fe21889ab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,21 +27,29 @@
@>nul grep -c "conda_sd_env_created" ..\scripts\install_status.txt @>nul grep -c "conda_sd_env_created" ..\scripts\install_status.txt
@if "%ERRORLEVEL%" EQU "0" ( @if "%ERRORLEVEL%" EQU "0" (
@echo "Packages necessary for Stable Diffusion were already installed" @echo "Packages necessary for Stable Diffusion were already installed"
@call conda activate .\env
) else ( ) else (
@echo. & echo "Downloading packages necessary for Stable Diffusion.." & echo. & echo "***** This will take some time (depending on the speed of the Internet connection) and may appear to be stuck, but please be patient ***** .." & echo. @echo. & echo "Downloading packages necessary for Stable Diffusion.." & echo. & echo "***** This will take some time (depending on the speed of the Internet connection) and may appear to be stuck, but please be patient ***** .." & echo.
@rmdir /s /q .\env @rmdir /s /q .\env
@call conda env create --prefix env -f environment.yaml && ( @call conda env create --prefix env -f environment.yaml || (
@echo conda_sd_env_created >> ..\scripts\install_status.txt @echo. & echo "Error installing the packages necessary for Stable Diffusion. Please try re-running this installer. If it doesn't work, please copy the messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB or file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo.
) || (
echo "Error installing the packages necessary for Stable Diffusion. Please try re-running this installer. If it doesn't work, please copy the messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB or file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues"
pause pause
exit /b exit /b
) )
)
@call conda activate .\env @call conda activate .\env
for /f "tokens=*" %%a in ('python -c "import torch; import ldm; import transformers; import numpy; print(42)"') do if "%%a" NEQ "42" (
@echo. & echo "Dependency test failed! Error installing the packages necessary for Stable Diffusion. Please try re-running this installer. If it doesn't work, please copy the messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB or file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo.
pause
exit /b
)
@echo conda_sd_env_created >> ..\scripts\install_status.txt
)
@>nul grep -c "conda_sd_ui_deps_installed" ..\scripts\install_status.txt @>nul grep -c "conda_sd_ui_deps_installed" ..\scripts\install_status.txt
@if "%ERRORLEVEL%" EQU "0" ( @if "%ERRORLEVEL%" EQU "0" (
@ -49,15 +57,26 @@
) else ( ) else (
@echo. & echo "Downloading packages necessary for Stable Diffusion UI.." & echo. @echo. & echo "Downloading packages necessary for Stable Diffusion UI.." & echo.
@call conda install -c conda-forge -y --prefix env uvicorn fastapi && ( @call conda install -c conda-forge -y --prefix env uvicorn fastapi || (
@echo conda_sd_ui_deps_installed >> ..\scripts\install_status.txt
) || (
echo "Error installing the packages necessary for Stable Diffusion UI. Please try re-running this installer. If it doesn't work, please copy the messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB or file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" echo "Error installing the packages necessary for Stable Diffusion UI. Please try re-running this installer. If it doesn't work, please copy the messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB or file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues"
pause pause
exit /b exit /b
) )
) )
call WHERE uvicorn > .tmp
@>nul grep -c "uvicorn" .tmp
@if "%ERRORLEVEL%" NEQ "0" (
@echo. & echo "UI packages not found! Error installing the packages necessary for Stable Diffusion. Please try re-running this installer. If it doesn't work, please copy the messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB or file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo.
pause
exit /b
)
@>nul grep -c "conda_sd_ui_deps_installed" ..\scripts\install_status.txt
@if "%ERRORLEVEL%" NEQ "0" (
@echo conda_sd_ui_deps_installed >> ..\scripts\install_status.txt
)
@if exist "sd-v1-4.ckpt" ( @if exist "sd-v1-4.ckpt" (
for %%I in ("sd-v1-4.ckpt") do if %%~zI GTR 400000000 ( for %%I in ("sd-v1-4.ckpt") do if %%~zI GTR 400000000 (
echo "Data files (weights) necessary for Stable Diffusion were already downloaded" echo "Data files (weights) necessary for Stable Diffusion were already downloaded"