Unverified Commit 231bdf2e authored by Naga Sai Abhinay's avatar Naga Sai Abhinay Committed by GitHub
Browse files

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
parent 75124fc9
...@@ -376,14 +376,16 @@ class UnCLIPImageInterpolationPipeline(DiffusionPipeline): ...@@ -376,14 +376,16 @@ class UnCLIPImageInterpolationPipeline(DiffusionPipeline):
height = self.decoder.config.sample_size height = self.decoder.config.sample_size
width = 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( decoder_latents = self.prepare_latents(
(batch_size, num_channels_latents, height, width), (1, num_channels_latents, height, width),
text_encoder_hidden_states.dtype, text_encoder_hidden_states.dtype,
device, device,
generator, generator,
decoder_latents, decoder_latents,
self.decoder_scheduler, self.decoder_scheduler,
) )
decoder_latents = decoder_latents.repeat((batch_size, 1, 1, 1))
for i, t in enumerate(self.progress_bar(decoder_timesteps_tensor)): for i, t in enumerate(self.progress_bar(decoder_timesteps_tensor)):
# expand the latents if we are doing classifier free guidance # expand the latents if we are doing classifier free guidance
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment