# Smaller pretrained models for Stable Diffusion?

**URL:** <https://discuss.huggingface.co/t/smaller-pretrained-models-for-stable-diffusion/23574>\
**Category:** 🧨 Diffusers\
**Created:** [September 24, 2022, 9:19pm UTC](https://discuss.huggingface.co/t/smaller-pretrained-models-for-stable-diffusion/23574 "2022-09-24T21:19:47Z")\
**Posts on this page:** 5\
**Page:** 1

<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:** [September 24, 2022, 9:19pm UTC](https://discuss.huggingface.co/t/smaller-pretrained-models-for-stable-diffusion/23574/1 "2022-09-24T21:19:47Z")

</div>

As I restart my program for the hundredth time, I think: _maybe if I used a smaller model while developing, I wouldn’t spend so long waiting for it to load._

Are there smaller pretrained models available that work with the same 🧨diffusers StableDiffusionPipeline?

I looked at a few of the options at [Models - Hugging Face](https://huggingface.co/models?other=stable-diffusion) but they seem to be mostly fine-tunings of the SD models and they’re not any smaller, and/or they don’t have data published for fp16.

---

<div class="post-metadata">

**Author:** ![pcuenq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pcuenq/32/32135_2.png) [@pcuenq](https://discuss.huggingface.co/u/pcuenq)\
**Post date:** [September 25, 2022, 8:10pm UTC](https://discuss.huggingface.co/t/smaller-pretrained-models-for-stable-diffusion/23574/2 "2022-09-25T20:10:56Z")

</div>

Hi @keturn!

If you just want fast loading and don’t care about generation you could try to use [this tiny model](https://huggingface.co/hf-internal-testing/tiny-stable-diffusion-pipe) for development. It’s not trained or anything so predictions will be useless, but it could be helpful when you are working on new features.

You can use it like this:

```nohighlight
from diffusers import DiffusionPipeline
pipe = DiffusionPipeline.from_pretrained("hf-internal-testing/tiny-stable-diffusion-pipe")

```

If you do need some reasonable outputs, then I’m not sure what would be the best option.

---

<div class="post-metadata">

**Author:** ![dkackman](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/dkackman/32/56859_2.png) [@dkackman](https://discuss.huggingface.co/u/dkackman)\
**Post date:** [September 26, 2022, 12:00am UTC](https://discuss.huggingface.co/t/smaller-pretrained-models-for-stable-diffusion/23574/3 "2022-09-26T00:00:12Z")

</div>

Have you tried passing `local_files_only=True` to `from_pretrained`? I think the slow part is the fact that is checks for updates online. I’ve also serialized the Pipeline to disk and then load time is just deserialization, which is pretty fast.

---

<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:** [September 26, 2022, 1:13am UTC](https://discuss.huggingface.co/t/smaller-pretrained-models-for-stable-diffusion/23574/4 "2022-09-26T01:13:29Z")

</div>

> [@dkackman](#):
>
> I think the slow part is the fact that is checks for updates online.

Hmm, what makes you think that? I never suspected that might be a problem, since these files aren’t getting updates often.

I tried `local_files_only` and it saves about a second (less than 10% of the total time).

> [@dkackman](#):
>
> I’ve also serialized the Pipeline to disk and then load time is just deserialization, which is pretty fast.

How is that different than the default implementation? Do you have a serialization format that’s lots faster to load than pytorch’s pickle-based format?

> [@pcuenq](#):
>
> If you do need some reasonable outputs, then I’m not sure what would be the best option.

I don’t need anything _impressive,_ but yes, something like _reasonable_ outputs would be nice so I can tell whether or not I’ve completely biffed up the inputs or processing.

Thank you both for the suggestions!

---

<div class="post-metadata">

**Author:** ![dkackman](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/dkackman/32/56859_2.png) [@dkackman](https://discuss.huggingface.co/u/dkackman)\
**Post date:** [September 26, 2022, 1:59pm UTC](https://discuss.huggingface.co/t/smaller-pretrained-models-for-stable-diffusion/23574/5 "2022-09-26T13:59:55Z")

</div>

> Hmm, what makes you think that?

Just an assumption. Mostly wrong it looks like.

> How is that different than the default implementation? Do you have a serialization format that’s lots faster \> to load than pytorch’s pickle-based format?

Plain old pickle binary format. But I’m serializing the output of `from_pretrained` thereby paying that cost only once. Seems about 5 times faster give or take (this is on an NVME drive mind you)
