Error: AttributeError 'dict' object has no attribute 'images'

I’m just trying the basics from the diffusers readme. Not sure if the install on my machine is somehow horked but every time I try the basic script I get this error the error below.

I’ve tried different conda environments as well as python 3.8.5 and 3.10 but am stumped.

Exception has occurred: AttributeError
'dict' object has no attribute 'images'
from torch import autocast
from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=True)
pipe ="cuda")

prompt = "a photo of an astronaut riding a horse on mars"
with autocast("cuda"):
    image = pipe(prompt).images[0]  

This works.

image = pipe(prompt)["sample"][0]

Same here, I will post here if I find a solution

1 Like

Please! Nothing shows up on the google or the github.

Got it, just change the following line:
image = pipe(prompt).images[0]
image = pipe(prompt)[“sample”][0]

Looks like it was a change from 0.2.4 to 0.3.0. All the docs were probably from code and we were running form 0.2.4 from conda. conda now has 0.3.0