From 67e03165786d3ba023d08d57468f3d7e8936f117 Mon Sep 17 00:00:00 2001 From: jazcollins Date: Tue, 3 Oct 2023 16:45:21 -0700 Subject: [PATCH] add negative_prompt_embeds to zero_out_negative_prompt check --- diffusion/models/stable_diffusion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diffusion/models/stable_diffusion.py b/diffusion/models/stable_diffusion.py index 16f7be47..4435d0bc 100644 --- a/diffusion/models/stable_diffusion.py +++ b/diffusion/models/stable_diffusion.py @@ -413,7 +413,7 @@ def generate( # negative prompt is given in place of the unconditional input in classifier free guidance pooled_embeddings = None if do_classifier_free_guidance: - if not negative_prompt and not tokenized_negative_prompts and zero_out_negative_prompt: + if not negative_prompt and not tokenized_negative_prompts and not negative_prompt_embeds and zero_out_negative_prompt: # Negative prompt is empty and we want to zero it out unconditional_embeddings = torch.zeros_like(text_embeddings) pooled_unconditional_embeddings = torch.zeros_like(pooled_text_embeddings) if self.sdxl else None