AttributeError: 'StableDiffusionPipeline' object has no attribute 'to'

when I try to excute the code:
from torch import autocast
from diffusers import StableDiffusionPipeline

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

prompt = “a photo of an astronaut riding a horse on mars”
with autocast(“cuda”):
image = pipe(prompt)[“sample”][0]

image.save(“astronaut_rides_horse.png”)

It showed me that
AttributeError: ‘StableDiffusionPipeline’ object has no attribute ‘to’

‘pip install --upgrade diffusers’ is not worked

what should I do to solve this question? is it a version problem?

Might be a version problem?

The current release of diffusers (0.5.1) has had use_auth_token=True removed from all the examples, and for the most part doesn’t use autocast anymore either.

But DiffusionPipeline.to() definitely exists, so I’m not sure why it would tell you it doesn’t.

same problem,have it solved?