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

StableDiffusion errors out with any backend other than TF #2187

Closed
fchollet opened this issue Nov 22, 2023 · 1 comment
Closed

StableDiffusion errors out with any backend other than TF #2187

fchollet opened this issue Nov 22, 2023 · 1 comment
Assignees
Labels
type:Bug Something isn't working

Comments

@fchollet
Copy link
Contributor

When using the method generate_image you get:

File ~/.local/lib/python3.10/site-packages/keras_cv/src/models/stable_diffusion/stable_diffusion.py:203, in StableDiffusionBase.generate_image(self, encoded_text, negative_prompt, batch_size, num_steps, unconditional_guidance_scale, diffusion_noise, seed)
    201 if diffusion_noise is not None:
    202     diffusion_noise = ops.squeeze(diffusion_noise)
--> 203     if diffusion_noise.shape.rank == 3:
    204         diffusion_noise = ops.repeat(
    205             ops.expand_dims(diffusion_noise, axis=0), batch_size, axis=0
    206         )
    207     latent = diffusion_noise

AttributeError: 'tuple' object has no attribute 'rank'

When using a backend other than TF, tensor shapes do not have a rank attribute. Instead, use len(ops.shape(diffusion_noise)) which will work across all backends.

@fchollet fchollet added the type:Bug Something isn't working label Nov 22, 2023
@divyashreepathihalli divyashreepathihalli self-assigned this Dec 1, 2023
@divyashreepathihalli
Copy link
Collaborator

fixed here - #2208

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

No branches or pull requests

2 participants