From b41c3009becd6f2ecb1d4d326444e2d6531abe2d Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Thu, 14 Sep 2023 13:03:36 -0400 Subject: [PATCH] revert diffusers --- modules/sd_models.py | 6 +++++- requirements.txt | 2 +- webui.bat | 14 +++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/sd_models.py b/modules/sd_models.py index e83f461c2..3e053988e 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -557,6 +557,7 @@ class ModelData: shared.log.error("Failed to load stable diffusion model") errors.display(e, "loading stable diffusion model") self.sd_model = None + self.sd_model.model_type = shared.sd_model_type return self.sd_model def set_sd_model(self, v): @@ -577,6 +578,7 @@ class ModelData: shared.log.error("Failed to load stable diffusion model") errors.display(e, "loading stable diffusion model") self.sd_refiner = None + self.sd_refiner.model_type = shared.sd_refiner_type return self.sd_refiner def set_sd_refiner(self, v): @@ -701,7 +703,6 @@ def load_diffuser(checkpoint_info=None, already_loaded_state_dict=None, timer=No try: shared.log.debug(f'Model load {op} config: {diffusers_load_config}') sd_model = diffusers.DiffusionPipeline.from_pretrained(model_file, **diffusers_load_config) - sd_model.model_type = sd_model.__class__.__name__ except Exception as e: shared.log.error(f'Failed loading model: {model_file} {e}') list_models() # rescan for downloaded model @@ -830,6 +831,9 @@ def load_diffuser(checkpoint_info=None, already_loaded_state_dict=None, timer=No else: sd_model.vae.config["force_upcast"] = False sd_model.vae.config.force_upcast = False + if shared.opts.no_half_vae: + devices.dtype_vae = torch.float32 + sd_model.vae.to(devices.dtype_vae) shared.log.debug(f'Model {op} VAE: name={sd_vae.loaded_vae_file} upcast={sd_model.vae.config.get("force_upcast", None)}') if shared.opts.cross_attention_optimization == "xFormers" and hasattr(sd_model, 'enable_xformers_memory_efficient_attention'): sd_model.enable_xformers_memory_efficient_attention() diff --git a/requirements.txt b/requirements.txt index 67aad81ef..d926ae426 100644 --- a/requirements.txt +++ b/requirements.txt @@ -47,7 +47,7 @@ requests==2.31.0 tqdm==4.66.1 accelerate==0.20.3 opencv-python-headless==4.7.0.72 -diffusers==0.21.1 +diffusers==0.20.2 einops==0.4.1 gradio==3.43.2 huggingface_hub==0.17.1 diff --git a/webui.bat b/webui.bat index 6a6edcf10..022be1367 100755 --- a/webui.bat +++ b/webui.bat @@ -7,7 +7,7 @@ mkdir tmp 2>NUL %PYTHON% -c "" >tmp/stdout.txt 2>tmp/stderr.txt if %ERRORLEVEL% == 0 goto :check_pip -echo Couldn't launch python +echo Cannot launch python goto :show_stdout_stderr :check_pip @@ -16,7 +16,7 @@ if %ERRORLEVEL% == 0 goto :start_venv if "%PIP_INSTALLER_LOCATION%" == "" goto :show_stdout_stderr %PYTHON% "%PIP_INSTALLER_LOCATION%" >tmp/stdout.txt 2>tmp/stderr.txt if %ERRORLEVEL% == 0 goto :start_venv -echo Couldn't install pip +echo Cannot install pip goto :show_stdout_stderr :start_venv @@ -27,10 +27,11 @@ dir "%VENV_DIR%\Scripts\Python.exe" >tmp/stdout.txt 2>tmp/stderr.txt if %ERRORLEVEL% == 0 goto :activate_venv for /f "delims=" %%i in ('CALL %PYTHON% -c "import sys; print(sys.executable)"') do set PYTHON_FULLNAME="%%i" -echo Creating venv in directory %VENV_DIR% using python %PYTHON_FULLNAME% +echo Using python: %PYTHON_FULLNAME% +echo Creating VENV: %VENV_DIR% %PYTHON_FULLNAME% -m venv "%VENV_DIR%" >tmp/stdout.txt 2>tmp/stderr.txt if %ERRORLEVEL% == 0 goto :activate_venv -echo Unable to create venv in directory "%VENV_DIR%" +echo Failed creating VENV: "%VENV_DIR%" goto :show_stdout_stderr :activate_venv @@ -42,7 +43,6 @@ if [%ACCELERATE%] == ["True"] goto :accelerate goto :launch :accelerate -echo Checking for accelerate: %ACCELERATE% set ACCELERATE="%VENV_DIR%\Scripts\accelerate.exe" if EXIST %ACCELERATE% goto :accelerate_launch @@ -52,7 +52,7 @@ pause exit /b :accelerate_launch -echo Accelerating +echo Using accelerate %ACCELERATE% launch --num_cpu_threads_per_process=6 launch.py %* pause exit /b @@ -78,5 +78,5 @@ type tmp\stderr.txt :endofscript echo. -echo Launch unsuccessful. Exiting. +echo Launch Failed pause