From bf84ee8168f6fc784f2df71f372a953d9eeb0ec3 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Fri, 7 Jul 2023 12:48:27 -0400 Subject: [PATCH] update diffusers --- DIFFUSERS.md | 8 +++++--- modules/processing.py | 10 ++++++++++ requirements.txt | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/DIFFUSERS.md b/DIFFUSERS.md index df2c462fc..db052527c 100644 --- a/DIFFUSERS.md +++ b/DIFFUSERS.md @@ -21,6 +21,8 @@ All notes have moved to [Wiki page](https://github.com/vladmandic/automatic/wiki ## TODO - VAE - > vae = AutoencoderKL.from_pretrained("stabilityai/sdxl-vae") - > pipe = StableDiffusionPipeline.from_pretrained(model, vae=vae) -- Refiner handler with medvram/lowvram +- Refiner with medvram/lowvram +- SD-XL from safetensors +- Hires fix +- Callbacks +- Stop/Skip diff --git a/modules/processing.py b/modules/processing.py index fd3adebef..9ebd20ede 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -711,6 +711,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed: shared.state.current_latent = latents shared.state.set_current_image() + # shared.sd_model.to(devices.device) output = shared.sd_model( # pylint: disable=not-callable prompt=prompts, negative_prompt=negative_prompts, @@ -723,8 +724,13 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed: cross_attention_kwargs=cross_attention_kwargs, **task_specific_kwargs ) + # if shared.cmd_opts.lowvram or shared.cmd_opts.medvram: + # shared.sd_model.to('cpu') + # devices.torch_gc(force=True) + if shared.sd_refiner is not None: + # shared.sd_refiner.to(devices.device) init_image = output.images[0] output = shared.sd_refiner( # pylint: disable=not-callable prompt=prompts, @@ -738,6 +744,10 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed: cross_attention_kwargs=cross_attention_kwargs, image=init_image ) + # if shared.cmd_opts.lowvram or shared.cmd_opts.medvram: + # shared.sd_refiner.to('cpu') + # devices.torch_gc(force=True) + x_samples_ddim = output.images diff --git a/requirements.txt b/requirements.txt index 6dc79e46a..12add323f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -49,7 +49,7 @@ requests==2.31.0 tqdm==4.65.0 accelerate==0.20.3 opencv-python==4.7.0.72 -diffusers==0.18.0 +diffusers==0.18.1 einops==0.4.1 gradio==3.32.0 numexpr==2.8.4