Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: local variable 'image_latents' referenced before assignment #5463

Closed
shubhamworks opened this issue Oct 20, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@shubhamworks
Copy link

Describe the bug

Getting this error with strength = 1.0 (is_strength_max) other wise it's working fine in the StableDiffusionXLControlNetInpaintPipeline

Reproduction

sdxl_inpaint_pipe(
        prompt=prompt,
        negative_prompt= negative_prompt,
        width=1024,
        height=1024,
        num_inference_steps=30,
        image= image.convert("RGB"),
        mask_image= mask.convert("L"),
        control_image=control_image,
        controlnet_conditioning_scale=0.5,
        guidance_scale=5,
        num_images_per_prompt=1,
        strength=1.0,
).images

Logs

783     image = image.to(device=device, dtype=dtype)
    784     image_latents = self._encode_vae_image(image=image, generator=generator)
--> 786 image_latents = image_latents.repeat(batch_size // image_latents.shape[0], 1, 1, 1)
    788 if latents is None and add_noise:
    789     noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)

System Info

  • diffusers version: 0.22.0.dev0
  • Platform: Linux-5.15.0-1041-aws-x86_64-with-glibc2.31
  • Python version: 3.10.12
  • PyTorch version (GPU?): 2.0.1 (True)
  • Huggingface_hub version: 0.16.4
  • Transformers version: 4.30.2
  • Accelerate version: 0.21.0
  • xFormers version: 0.0.20
  • Using GPU in script?: Yes
  • Using distributed or parallel set-up in script?: No

Who can help?

@sayakpaul @yiyixuxu @DN6 @patrickvonplaten

@shubhamworks shubhamworks added the bug Something isn't working label Oct 20, 2023
@DN6
Copy link
Collaborator

DN6 commented Oct 20, 2023

cc: @yiyixuxu Could you please take a look here?

@patrickvonplaten
Copy link
Contributor

@shubhamworks we would need a fully reproducible code snippet here I think

@shubhamworks
Copy link
Author

@patrickvonplaten The issue got fixed in the last commit
Thanks team. Closing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants