revert diffusers

pull/2194/head
Vladimir Mandic 2023-09-14 13:03:36 -04:00
parent 2a63564638
commit b41c3009be
3 changed files with 13 additions and 9 deletions

View File

@ -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()

View File

@ -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

View File

@ -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