# Can't use safetensors in the tutorial

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-safetensors-in-the-tutorial%2F141497%3E%5C
**Category:** Beginners\
**Created:** [February 18, 2025, 3:02am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-safetensors-in-the-tutorial%2F141497 "2025-02-18T03:02:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Myn1ac5022](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/myn1ac5022/32/41382_2.png) [@Myn1ac5022](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FMyn1ac5022)%5C
**Post date:** [February 18, 2025, 3:02am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-safetensors-in-the-tutorial%2F141497%2F1 "2025-02-18T03:02:46Z")

</div>

Hi experts!  
I’m new to diffusers and following the official tutorial. But I have trouble making the first pipeline:

```python
from diffusers import DDPMPipeline
ddpm = DDPMPipeline.from_pretrained("google/ddpm-cat-256", use_safetensors=True).to('cuda')
image = ddpm(num_inference_steps=25).images[0]
image.save("pipline_cat.png")

```

It reports:

```auto
 "OSError: Could not find the necessary `safetensors` weights in {'diffusion_pytorch_model.bin', 'diffusion_pytorch_model.safetensors'} (variant=None)"

```

When I remove the ‘use\_safetensores=True’ parameter, the error disappears. However, this also means I can no longer use safetensors to load the model. Could you advise how I might resolve this issue?

My Environment:

- 🤗 Diffusers version: 0.32.2
- Platform: Linux-5.15.0-130-generic-x86\_64-with-glibc2.31
- Running on Google Colab?: No
- Python version: 3.10.16
- PyTorch version (GPU?): 2.4.1+cu124 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Huggingface\_hub version: 0.28.1
- Transformers version: 4.48.3
- Accelerate version: 1.4.0
- PEFT version: not installed
- Bitsandbytes version: not installed
- Safetensors version: 0.5.2
- xFormers version: not installed

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [February 18, 2025, 3:52am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-safetensors-in-the-tutorial%2F141497%2F2 "2025-02-18T03:52:43Z")

</div>

It seems to be just a bug in Diffusers. In other words, the safetensors file placed in the root directory is not recognized as a replacement for the bin file.

After fixing the folder structure, it was recognized. I just did save\_pretrained…

```py
from diffusers import DDPMPipeline

#ddpm = DDPMPipeline.from_pretrained("google/ddpm-cat-256", use_safetensors=True) # it doesn't work.
ddpm = DDPMPipeline.from_pretrained("google/ddpm-cat-256")
ddpm.save_pretrained("ddpm-sft")
ddpm.from_pretrained("ddpm-sft", use_safetensors=True).to('cuda') # it works.
ddpm = DDPMPipeline.from_pretrained("John6666/google_ddpm-cat-256-safetensors", use_safetensors=True).to('cuda') # it works.
image = ddpm(num_inference_steps=25).images[0]
image.save("pipline_cat.png")

```

---

<div class="post-metadata">

**Author:** ![Myn1ac5022](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/myn1ac5022/32/41382_2.png) [@Myn1ac5022](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FMyn1ac5022)%5C
**Post date:** [February 18, 2025, 6:05am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-safetensors-in-the-tutorial%2F141497%2F3 "2025-02-18T06:05:39Z")

</div>

Thank you so much for your help! That totally fixed my issue. I really appreciate your time and expertise!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [February 18, 2025, 6:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-safetensors-in-the-tutorial%2F141497%2F4 "2025-02-18T18:06:32Z")

</div>

Closed on February 18, 2025, 6:06pm UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
