# Device Type Error With Diffusers Pipeline TAT

**URL:** <https://discuss.huggingface.co/t/device-type-error-with-diffusers-pipeline-tat/42160>\
**Category:** Beginners\
**Created:** [June 5, 2023, 6:35pm UTC](https://discuss.huggingface.co/t/device-type-error-with-diffusers-pipeline-tat/42160 "2023-06-05T18:35:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexair](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/alexair/32/16578_2.png) [@Alexair](https://discuss.huggingface.co/u/Alexair)\
**Post date:** [June 5, 2023, 6:35pm UTC](https://discuss.huggingface.co/t/device-type-error-with-diffusers-pipeline-tat/42160/1 "2023-06-05T18:35:28Z")

</div>

Hi, I’m new here and have a problem that I encountered while studying a hugging face related [blog](https://huggingface.co/blog/stable_diffusion)

## Environment

- WIN 10 (remote ssh)
- diffusers version: 0.10.2
- Platform: Windows-10-10.0.19042-SP0
- Python version: 3.8.16
- PyTorch version (GPU?): 1.8.1 (True)
- Huggingface\_hub version: 0.15.1
- Transformers version: 4.29.2
- Using GPU in script?: \<fill in\>
- Using distributed or parallel set-up in script?: \<fill in\>

## Error Reproduce

First I downloaded the pre-trained model needed for the blog separately, instead of referring to the blog exactly, because it is large and difficult to download

I only downloaded the \*.bin (pytorch version) for every module of stable-diffusion-v1-4 with LFS

 ![2023-06-06 023043](https://us1.discourse-cdn.com/hellohellohello/original/3X/d/f/df728fb55800d442261709b9e915b2b229c4eedf.jpeg)

Then I followed the blog and executed the following code

```auto
from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained("./stable-diffusion-v1-4")

pipe.to("cuda")

prompt = "a photograph of an astronaut riding a horse"

image = pipe(prompt).images[0]
image.save(f"astronaut_rides_horse.png")

```

### Error Info

```auto
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last) 
Cell In[1], line 9
      5 pipe.to("cuda")
      7 prompt = "a photograph of an astronaut riding a horse"
----> 9 image = pipe(prompt).images[0]
     10 image.save(f"astronaut_rides_horse.png")

File h:\miniconda\conda\envs\deepke\lib\site-packages\torch\autograd\grad_mode.py:27, in _DecoratorContextManager. __call__..decorate_context(*args, **kwargs)
     24 @functools.wraps(func)
     25 def decorate_context(*args, **kwargs):
     26 with self. __class__ ():
---> 27 return func(*args, **kwargs)

File h:\miniconda\conda\envs\deepke\lib\site-packages\diffusers\pipelines\stable_diffusion\pipeline_stable_diffusion.py:477, in StableDiffusionPipeline. __call__ (self, prompt, height, width, num_inference_steps, guidance_scale, negative_prompt, num_images_per_prompt, eta, generator, latents, output_type, return_dict, callback, callback_steps)
    475 # 2. Define call parameters
    476 batch_size = 1 if isinstance(prompt, str) else len(prompt)
--> 477 device = self._execution_device
    478 # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
    479 # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
    480 # corresponds to doing no classifier free guidance.
    481 do_classifier_free_guidance = guidance_scale > 1.0

File h:\miniconda\conda\envs\deepke\lib\site-packages\diffusers\pipelines\stable_diffusion\pipeline_stable_diffusion.py:213, in StableDiffusionPipeline._execution_device(self)
    206 @property
...
--> 213 if self.device != torch.device("meta") or not hasattr(self.unet, "_hf_hook"):
    214 return self.device
    215 for module in self.unet.modules():

RuntimeError: Expected one of cpu, cuda, xpu, mkldnn, opengl, opencl, ideep, hip, msnpu, xla, vulkan device type at start of device string: meta

```

I tried my best to search for related issues but didn’t find anything that matched my situation

I would appreciate it if you could help me

---

<div class="post-metadata">

**Author:** ![iamzainsahahbaz](https://avatars.discourse-cdn.com/v4/letter/i/d2c977/32.png) [@iamzainsahahbaz](https://discuss.huggingface.co/u/iamzainsahahbaz)\
**Post date:** [July 24, 2023, 10:59pm UTC](https://discuss.huggingface.co/t/device-type-error-with-diffusers-pipeline-tat/42160/2 "2023-07-24T22:59:56Z")

</div>

same here, have you found the solution yet?

---

<div class="post-metadata">

**Author:** ![snare2000](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@snare2000](https://discuss.huggingface.co/u/snare2000)\
**Post date:** [August 19, 2023, 6:00am UTC](https://discuss.huggingface.co/t/device-type-error-with-diffusers-pipeline-tat/42160/3 "2023-08-19T06:00:47Z")

</div>

I ran into the same error as well, turned out the version of pytorch that I was using was 1.8 which upon upgrading to the latest 2.0 resolved the error.
