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

**URL:** <https://discuss.huggingface.co/t/attributeerror-stablediffusionpipeline-object-has-no-attribute-to/24408>\
**Category:** 🧨 Diffusers\
**Created:** [October 14, 2022, 3:43am UTC](https://discuss.huggingface.co/t/attributeerror-stablediffusionpipeline-object-has-no-attribute-to/24408 "2022-10-14T03:43:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![clamp7724](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@clamp7724](https://discuss.huggingface.co/u/clamp7724)\
**Post date:** [October 14, 2022, 3:43am UTC](https://discuss.huggingface.co/t/attributeerror-stablediffusionpipeline-object-has-no-attribute-to/24408/1 "2022-10-14T03:43:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![keturn](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/keturn/32/18215_2.png) [@keturn](https://discuss.huggingface.co/u/keturn)\
**Post date:** [October 14, 2022, 4:59am UTC](https://discuss.huggingface.co/t/attributeerror-stablediffusionpipeline-object-has-no-attribute-to/24408/2 "2022-10-14T04:59:54Z")

</div>

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](https://github.com/huggingface/diffusers/blob/v0.5.1/src/diffusers/pipeline_utils.py#L180), so I’m not sure why it would tell you it doesn’t.

---

<div class="post-metadata">

**Author:** ![fingermelody](https://avatars.discourse-cdn.com/v4/letter/f/b5a626/32.png) [@fingermelody](https://discuss.huggingface.co/u/fingermelody)\
**Post date:** [October 25, 2023, 6:37am UTC](https://discuss.huggingface.co/t/attributeerror-stablediffusionpipeline-object-has-no-attribute-to/24408/3 "2023-10-25T06:37:12Z")

</div>

same problem，have it solved?
