ホーム 暮らし [Stable Diffusion] What is VAE? An explanation of how to install and use it

[Stable Diffusion] What is VAE? An explanation of how to install and use it

三浦 拓海 三浦 拓海 • 更新: • 公開: • 読了約 14 分
目次

What happens when you use a VAE?

Are you struggling because you don't know how to install or use a VAE?

Using a VAE improves washed-out or dark looks and overall blurry impressions, resulting in brighter colors and a higher-quality finish.

You can use a VAE by downloading and installing it from sites like CIVITAI or Hugging Face.

Using one is essential because it dramatically changes the quality compared to not using one.

Please use this article as a reference to try out VAEs.

In this article, I will explain how to install and use VAEs in an easy-to-understand way.

Benefits of this article:
・You can increase quality by brightening the overall saturation.


What is a VAE?

nf68f31a75d17

VAE stands for Variational Auto-Encoder. When you use a VAE, you can mainlybrighten the overall colors.

The image below compares results with and without a VAE.

If you don't use a VAE, the generated image will look washed out or have pale colors, as shown on the left.

When you use a VAE, the colors are corrected and the overall image becomes brighter, as shown on the right.

It can also sometimes fix specific parts of an image to look better.


How to install a VAE

Many VAEs are distributed, and one recommended option is "vae-ft-mse-840000-ema-pruned.safetensors" distributed by Stability AI.

It corrects colors to be brighter regardless of the model used.

In this example, I will explain how to install the VAE "vae-ft-mse-840000-ema-pruned.safetensors".

You can download it from the following site called Hugging Face, so please access it.

https://huggingface.co/stabilityai/sd-vae-ft-mse-original/tree/main


For local users

Once you have accessed it, please click on "Files and versions" at the top.

You can download the file by clicking the download icon with the downward arrow on the right side of the "vae-ft-mse-840000-ema-prunded.safetensors" item.

If you are using Stable Diffusion Web UI in a local environment, you can install it by placing the file inside "stable-diffusion-webui/models/VAE/".


For Google Colab users

If you are using Google Colab, you need to copy the download URL, so please hover your mouse cursor over the download icon and right-click.


If you are using Google Chrome, you can copy the download URL by selecting "Copy link address".

I have provided sample code that you can use by simply copying and pasting it later, so there is no need to copy it now.


Please add the code using the download URL you copied.

Please refer to the sample code below for installing the "vae-ft-mse-840000-ema-prunded" VAE.

!wget https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors -O /content/stable-diffusion-webui/models/VAE/vae-ft-mse-840000-ema-pruned.safetensors

VAE files can be used by placing them inside "VAE/".


How to use VAE

Setting up VAE is easy as it only takes 4 steps.

Please follow the steps below to perform the operation.

1. Click the "Settings" tab.
2. Click "VAE" on the left side.
3. Click the "SD VAE" item and select "vae-ft-mse-840000-ema-pruned.safetensors".
4. Click the "Apply settings" button to apply the VAE.

There is no need to restart the Stable Diffusion Web UI.


Comparison images when using a VAE

I compared the results to see what happens when using the "vae-ft-mse-840000-ema-pruned.safetensors" VAE.

The comparison results between not using a VAE and using one are as follows.

You can see that the image is brighter when using a VAE than when not using one.

Sometimes parts of the image are corrected, but using a VAE can improve things or, conversely, cause them to break down.

In the case below, the fingers on the hand are slightly distorted because a VAE was used.

As a workaround, setting it to a different VAE may improve the result.


There are many other VAEs besides "vae-ft-mse-840000-ema-pruned.safetensors".

If you want to know more about other VAEs, I have introduced 10 recommended VAEs in the article below, so please read it as well.


VAEs may not be reflected depending on the model

Depending on the model, the color tone and other aspects may or may not change.

The image below shows the result of comparing the "chilled_remix" model, which is suitable for generating realistic (photographic) images, with and without the "vae-ft-mse-840000-ema-pruned.safetensors" VAE.

When compared, everything was the same and there were no changes.


It is possible that the model was trained using "vae-ft-mse-840000-ema-pruned.safetensors" in advance.

As such, depending on the model, images may be generated with brightness by default without using a VAE, so you may be fine leaving it as is.

If you want a different level of brightness or saturation, you should try using a different VAE.

The video below shows the comparison results using a VAE called "kl-f8anime2".

The overall saturation has changed, indicating that the VAE has been applied.


Summary

I have explained how to install and use a VAE.

Using a VAE makes the overall image brighter and improves quality, so you should definitely include one.

There are many VAEs available, but I recommend "vae-ft-mse-840000-ema-pruned.safetensors" as it provides good saturation for most models.

Please use this article as a reference and try using a VAE!

同じカテゴリの記事

三浦 拓海
コンテンツディレクター 三浦 拓海
プロフィールを見る →

映画と連続ドラマの公開情報を追う担当。配給会社のプレスシートと公式サイトの発表日を確認したうえで執筆します。

おすすめの関連記事