Skip to content

Commit

Permalink
fix: UnboundLocalError with image_latents
Browse files Browse the repository at this point in the history
  • Loading branch information
a-r-r-o-w committed Nov 5, 2023
1 parent 080081b commit 6a993f4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -724,10 +724,11 @@ def prepare_latents(

if image.shape[1] == 4:
image_latents = image.to(device=device, dtype=dtype)
image_latents = image_latents.repeat(batch_size // image_latents.shape[0], 1, 1, 1)
elif return_image_latents or (latents is None and not is_strength_max):
image = image.to(device=device, dtype=dtype)
image_latents = self._encode_vae_image(image=image, generator=generator)
image_latents = image_latents.repeat(batch_size // image_latents.shape[0], 1, 1, 1)
image_latents = image_latents.repeat(batch_size // image_latents.shape[0], 1, 1, 1)

if latents is None and add_noise:
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
Expand Down

0 comments on commit 6a993f4

Please sign in to comment.