Saturday, 22 October 2022

How to Install & run Stable Diffusion AI image generator with a Web UI on Windows PC

Stable Diffusion is among the best AI art generators right now. In this post, I outline the steps to install its local copy with a Web UI on a Windows PC.

How to Install

1)  install prerequisite software:

2) install Stable Diffusion web UI by AUTOMATIC1111:

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

3) install the models:

  • the Stable Diffusion model checkpoint, a file with .ckpt extension, needs to be downloaded from this repo (v1.4 or v1.5, free Hugging Face login account required) and placed in the models/Stable-diffusion directory
  • (Optional) GFPGANv1.4.pth and/or GFPGANv1.3.pth, needed to be downloaded from this repo and placed in the base directory, alongside webui.py

How to Run

1) run webui-user.bat from Windows Explorer as normal, non-administrator, user:

  • first run may take long time since web app need download and install all dependencies automatically
  • if first run seem to be frozen, press space key to resume its execution

2) when Running on local URL: http://127.0.0.1:7860 appears in the command prompt window, the stable diffusion local instance is running.

  • It can be accessed with browsing the localhost link from the current PC
  • to stop the web app, either of the following methods:
    • close the command prompt window of webui-user.bat
    • press ctrl+c in the command prompt window of webui-user.bat

Some useful Tips

vram setting

Makes the Stable Diffusion model consume less VRAM so that it can run on low end computer, add the follow arguments in webui-user.bat (add to the end of the line as "set COMMANDLINE_ARGS="):

  • --medvram for the PC with less than 4GB vram GPU
  • --lowvram for the PC with less than 2GB vram GPU