Repo Image & Video

AUTOMATIC1111/stable-diffusion-webui

A Gradio-based web interface for Stable Diffusion with txt2img, img2img, inpainting, upscaling, training tools and an API, installable on Windows and Linux.

  • 165k GitHub stars
  • Python
  • ⚖️ AGPL-3.0
  • 🎯 Intermediate
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
AUTOMATIC1111/stable-diffusion-webui preview image

What it is

Stable Diffusion web UI is a browser interface for Stable Diffusion, implemented with the Gradio library. It offers original txt2img and img2img modes along with outpainting, inpainting, prompt matrix, upscaling and many other generation tools. It also includes training for embeddings and hypernetworks, a checkpoint merger, an API and support for community custom scripts.

Who it's for

  • Users who want a browser-based interface for generating images with Stable Diffusion
  • Users who want to train embeddings or hypernetworks and preprocess training images
  • Developers who want to extend the UI with custom scripts or extensions, or use its API
  • Users with low-VRAM GPUs (4GB supported, with reports of 2GB working)

Requirements

Requirements

  • Python and git must be installed (the one-click script does not install them)
  • Python 3.10.6 for Windows automatic installation (newer Python versions do not support torch)
  • On very new Linux systems, python3.11 or python3.10
  • Linux dependency packages such as wget, git, python3 and python3-venv (Debian-based)
  • NVidia GPUs are recommended; AMD, Intel and Ascend NPUs are covered by separate instructions

Setup

  1. Windows release package (NVidia GPUs)

    Download sd.webui.zip from the v1.0.0-pre release and extract its contents. Then run update.bat, followed by run.bat.

  2. Automatic installation on Windows

    Install Python 3.10.6 (checking "Add Python to PATH") and git. Clone the repository, then run webui-user.bat from Windows Explorer as a normal, non-administrator user.

    bash
    git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
  3. Linux: install dependencies (Debian-based example)

    Install the dependencies for your distribution. The README also gives Red Hat, openSUSE and Arch variants.

    bash
    sudo apt install wget git python3 python3-venv libgl1 libglib2.0-0
  4. Linux: get and run the webui

    Download webui.sh into the directory where you want to install, or clone the repo instead. Then run webui.sh and check webui-user.sh for options.

    bash
    wget -q https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh
    # or
    git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

Examples

Attention emphasis syntax

Prompt
prompt
a man in a ((tuxedo))
a man in a (tuxedo:1.21)

Expected output: Two syntaxes for making the model pay more attention to part of the prompt. Selecting text and pressing Ctrl+Up or Ctrl+Down adjusts attention automatically.

Composable Diffusion with weights

Prompt
prompt
a cat :1.2 AND a dog AND a penguin :2.2

Expected output: Uppercase AND separates multiple prompts used at once, and weights can be attached to each.

Pin Python 3.11 on Linux

bash
bash
export python_cmd="python3.11"
# or in webui-user.sh
python_cmd="python3.11"

What it does: On very new systems, set this variable in the launch script or in webui-user.sh so the correct Python version is used.

Pros & cons

Pros

  • Pro:Large built-in feature set: inpainting, outpainting, upscalers, face restoration, checkpoint merger, X/Y/Z plots and more
  • Pro:Training tab supports embeddings and hypernetworks, and embeddings can be trained on 8GB (reports of 6GB working)
  • Pro:Low-VRAM support (4GB, with reports of 2GB working) and an optional xformers speed-up
  • Pro:Generation parameters are saved in each image and can be restored via the PNG info tab, plus an API and community custom scripts

Cons

  • Con:Python and git must be installed separately even with the one-click script
  • Con:Windows setup requires Python 3.10.6, since newer Python versions do not support torch
  • Con:Detailed documentation lives in the wiki rather than the README, and Intel and Ascend instructions are on external wiki pages

Images