From 9fb0b0959fd6e3291dbadde8fcae946a46399669 Mon Sep 17 00:00:00 2001 From: Sergey Borisov Date: Fri, 14 Jul 2023 05:25:09 +0300 Subject: [PATCH] Make sde and ancestral schedulers reproducible --- invokeai/app/invocations/sdxl.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/invokeai/app/invocations/sdxl.py b/invokeai/app/invocations/sdxl.py index 048865ef07..676fb09d58 100644 --- a/invokeai/app/invocations/sdxl.py +++ b/invokeai/app/invocations/sdxl.py @@ -101,6 +101,11 @@ class SDXLTextToLatentsInvocation(BaseInvocation): cross_attention_kwargs = None with unet_info as unet: + if "generator" in set(inspect.signature(scheduler.step).parameters.keys()): + extra_step_kwargs.update( + generator=torch.Generator(device=unet.device).manual_seed(0), + ) + if not context.services.configuration.sequential_guidance: prompt_embeds = torch.cat([negative_prompt_embeds, prompt_embeds], dim=0) add_text_embeds = torch.cat([negative_pooled_prompt_embeds, pooled_prompt_embeds], dim=0)