From a2a2cfa7654ea998c38d23be9b3007f432d4a499 Mon Sep 17 00:00:00 2001 From: user1 Date: Sat, 6 May 2023 13:10:56 -0700 Subject: [PATCH] Added resizing of controlnet image based on noise latent. Fixes a tensor mismatch issue. --- invokeai/app/invocations/latent.py | 1 - invokeai/backend/stable_diffusion/diffusers_pipeline.py | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/app/invocations/latent.py b/invokeai/app/invocations/latent.py index 6d33319654..4e5b97919f 100644 --- a/invokeai/app/invocations/latent.py +++ b/invokeai/app/invocations/latent.py @@ -328,7 +328,6 @@ class TextToLatentsInvocation(BaseInvocation): latents_shape=noise.shape, do_classifier_free_guidance=(self.cfg_scale >= 1.0)) - # TODO: Verify the noise is the right size result_latents, result_attention_map_saver = model.latents_from_embeddings( latents=torch.zeros_like(noise, dtype=torch_dtype(model.device)), diff --git a/invokeai/backend/stable_diffusion/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py index 41146c8004..ec2902e4d6 100644 --- a/invokeai/backend/stable_diffusion/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -1031,6 +1031,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): dtype=torch.float16, do_classifier_free_guidance=True, ): + if not isinstance(image, torch.Tensor): if isinstance(image, PIL.Image.Image): image = [image]