From 8170570f7a60ed0d83a0c4a70a497a5f11d4283a Mon Sep 17 00:00:00 2001 From: Johannes Stelzer Date: Mon, 8 Jan 2024 15:59:54 +0100 Subject: [PATCH] save latents_out earlier --- diffusers_holder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/diffusers_holder.py b/diffusers_holder.py index 8a560bb..c0ee5fe 100644 --- a/diffusers_holder.py +++ b/diffusers_holder.py @@ -262,9 +262,6 @@ class DiffusersHolder(): for i, t in enumerate(timesteps): # Set the right starting latents - if i < idx_start: - list_latents_out.append(None) - continue elif i == idx_start: latents = latents_start.clone() # Mix latents @@ -272,6 +269,9 @@ class DiffusersHolder(): latents_mixtarget = list_latents_mixing[i - 1].clone() latents = interpolate_spherical(latents, latents_mixtarget, list_mixing_coeffs[i]) + if i < idx_start: + list_latents_out.append(latents) + # expand the latents if we are doing classifier free guidance latent_model_input = torch.cat([latents] * 2) if do_classifier_free_guidance else latents latent_model_input = self.pipe.scheduler.scale_model_input(latent_model_input, t)