From 231bdf2e560a57976749b55a941bcf3f311df6fc Mon Sep 17 00:00:00 2001 From: Naga Sai Abhinay Date: Thu, 15 Jun 2023 18:45:40 +0530 Subject: [PATCH] UnCLIP Image Interpolation -> Keep same initial noise across interpolation steps (#3782) * Maintain same decoder start noise for all interp steps * Correct comment * use batch_size for consistency --- examples/community/unclip_image_interpolation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/community/unclip_image_interpolation.py b/examples/community/unclip_image_interpolation.py index 453ac07af7..618ac25bdc 100644 --- a/examples/community/unclip_image_interpolation.py +++ b/examples/community/unclip_image_interpolation.py @@ -376,14 +376,16 @@ class UnCLIPImageInterpolationPipeline(DiffusionPipeline): height = self.decoder.config.sample_size width = self.decoder.config.sample_size + # Get the decoder latents for 1 step and then repeat the same tensor for the entire batch to keep same noise across all interpolation steps. decoder_latents = self.prepare_latents( - (batch_size, num_channels_latents, height, width), + (1, num_channels_latents, height, width), text_encoder_hidden_states.dtype, device, generator, decoder_latents, self.decoder_scheduler, ) + decoder_latents = decoder_latents.repeat((batch_size, 1, 1, 1)) for i, t in enumerate(self.progress_bar(decoder_timesteps_tensor)): # expand the latents if we are doing classifier free guidance