# How do you set up a VAE in Diffusers?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-you-set-up-a-vae-in-diffusers%2F34725%3E%5C
**Category:** 🧨 Diffusers\
**Created:** [March 26, 2023, 6:55pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-you-set-up-a-vae-in-diffusers%2F34725 "2023-03-26T18:55:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AliceM](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/alicem/32/14956_2.png) [@AliceM](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FAliceM)%5C
**Post date:** [March 26, 2023, 6:55pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-you-set-up-a-vae-in-diffusers%2F34725%2F1 "2023-03-26T18:55:31Z")

</div>

Hey guyss, I’m trying to use the diffusers library with `andite/pastel-mix` =\> `https://huggingface.co/andite/pastel-mix`  
How do you set up the VAE here?

---

<div class="post-metadata">

**Author:** ![pcuenq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pcuenq/32/32135_2.png) [@pcuenq](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpcuenq)%5C
**Post date:** [March 27, 2023, 7:01am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-you-set-up-a-vae-in-diffusers%2F34725%2F2 "2023-03-27T07:01:08Z")

</div>

Hi @AliceM!, I’m not sure I fully understand your question, looking at the model repo it looks like it’s a valid diffusers checkpoint. To use it you’d use code similar to the one that appears in the model card:

```plaintext
from diffusers import StableDiffusionPipeline
import torch

model_id = "andite/pastel-mix"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")

prompt = "hatsune_miku"
image = pipe(prompt).images[0]

image.save("./hatsune_miku.png")

```

Is that not working for you?

---

<div class="post-metadata">

**Author:** ![AliceM](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/alicem/32/14956_2.png) [@AliceM](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FAliceM)%5C
**Post date:** [March 27, 2023, 5:17pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-you-set-up-a-vae-in-diffusers%2F34725%2F3 "2023-03-27T17:17:29Z")

</div>

I’m only getting dull colors with that snippet…  
 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/2/2e6a92ddb8a419efd62a591ffae7c56cb2254d4d.jpeg)

After experimenting a lot, it seems like it only works when I put another vae on it:

```auto
vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse").to("cuda")
pipeline.vae = vae

```

This feels very dirty though so I wonder why it doesn’t work…

---

<div class="post-metadata">

**Author:** ![pcuenq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pcuenq/32/32135_2.png) [@pcuenq](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpcuenq)%5C
**Post date:** [March 27, 2023, 5:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-you-set-up-a-vae-in-diffusers%2F34725%2F4 "2023-03-27T17:37:57Z")

</div>

Oh, I see. It would appear that the model was trained with a different vae but the model card was not updated to reflect that fact. In addition, I see in the root of the repo a few different `vae` models, I’m not sure how they are supposed to be used.

I’d recommend you open a discussion in the repo itself asking for clarification. I’d ask the author if it is possible to update the model card with instructions, and ideally update the `vae` folder of the repo so that it contains the recommended `vae` instead of the default one. To open a discussion, please use the `Community` tab in the repo.

Hope that helps 🙂

---

<div class="post-metadata">

**Author:** ![Tangokiss](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/tangokiss/32/19533_2.png) [@Tangokiss](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FTangokiss)%5C
**Post date:** [September 15, 2023, 7:05pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-you-set-up-a-vae-in-diffusers%2F34725%2F5 "2023-09-15T19:05:49Z")

</div>

Hello, I have something very similar, I come from the implementation of automatic1111, where I have generated checkpoints with dreambooth of which in automatic1111 they work correctly, but now that I implement my model in diffusers library and in different formats such as .safetensors, .ckpt, .bin, I have not achieved the quality in the images that I used to generate in automatic1111, I have implemented and added “VAE”, “scheduler”, “clip skip”, and I have not been able to generate the same consistency in the images, I do not know if there are more configuration in diffusers to be able to achieve a good quality of my images, does anyone have an idea on how to improve the generation

---

<div class="post-metadata">

**Author:** ![Tangokiss](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/tangokiss/32/19533_2.png) [@Tangokiss](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FTangokiss)%5C
**Post date:** [September 15, 2023, 7:08pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-you-set-up-a-vae-in-diffusers%2F34725%2F7 "2023-09-15T19:08:14Z")

</div>

EXamples Difussers: the colors come out very opaque and not saturated  
 ![9ff2f3af-8b07-48fa-873d-2aa2af304487](https://us1.discourse-cdn.com/hellohellohello/original/3X/6/3/63e2bf0d90b0c355ded4ce27d8fdb89e96736131.png)
