Setting up a local Stable Diffusion environment

This article can be read in about 6 minutes.
PR

The purpose

We will build a Stable Diffusion environment on a local Windows PC that supports CUDA.

Background

This blog has followed the difficult path of getting Stable Diffusion to run on an AMD GPU, but setting up the environment on a PC with CUDA is actually quite easy. Despite this, many other guides use a more complicated approach (involving installing Git and Python)

An article for non-CUDA environments.

AMD GPU(DirectML)

CPU

PR

Environment setup

Download

Open the page below.

GitHub - lllyasviel/stable-diffusion-webui-forge
Contribute to lllyasviel/stable-diffusion-webui-forge development by creating an account on GitHub.

Scroll down the page, find the ‘Installing Forge’ section, and click the recommended binary file to download it.

Extract

Unzip the downloaded file into any folder of your choice.

Install model

It seems that stable-diffusion-webui-forge doesn’t come with any models pre-installed.

We will install them by following the guide in the article below.

PR

Start

Run the run.bat file inside the extracted folder.

If you see the following error during the process (it will continue to run), just run the git config~ command that is displayed. This error might pop up multiple times. If it does, just re-run the command, as the folder path in the argument should have updated.

If a browser launches and the GUI appears as shown below, it means you have succeeded.

PR

Result

I was able to create an image by entering a prompt into the GUI that appeared and clicking ‘Generate’.

PR

Trouble Shooting

The driver versions are mismatched.

If you get a driver version mismatch error (or if the driver isn’t installed), please install the correct driver from the link below.

NVIDIA 公式最新ドライバーのダウンロード
最新の NVIDIA 公式ドライバーをダウンロードして、PC ゲーミング体験を向上し、アプリケーションをより速く実行しましょう。

 Runtime error (Input type (float) and bias type (struct c10::Half) should be the same)

If you get the Input type (float) and bias type (struct c10::Half) should be the same error during image generation, follow these steps.

Open the webui-user.bat file located in your installation_folder\webui directory.

Find the line below, make the correction, and restart Stable Diffusion.

Before:

set COMMANDLINE_ARGS=

After:

set COMMANDLINE_ARGS=--no-half

Runtime error (memory)

If image generation fails when using the GUI, the problem is most likely a lack of memory (VRAM). (Even if the error message doesn’t mention memory, that could still be the cause.)

Try the following improvements.

Make the generated images smaller

Could you please make the Width and Height of the generated images smaller?

Keep in mind that making them too small might result in poorly formed images. (It’s generally not recommended to go below 512×512.)

Modifying Startup Options

Open the webui-user.bat file located in the \webui folder inside your installation directory.

Look for the following line, modify it, and then restart Stable Diffusion.

Before:

set COMMANDLINE_ARGS=

After:

set COMMANDLINE_ARGS=--lowvram

comment

Copied title and URL