← Back to Notes

Stable Diffusion WebUI (Automatic1111) + SDXL 1.0

Automatic1111 (aka A1111) is the most popular web interface for Stable Diffusion. This guide covers installation, SDXL 1.0 setup, and fixes for common GitHub issues.

Quick Overview

Installation

First, make sure you have the prerequisites:

# Install Git (if not installed)
# Windows: https://git-scm.com/download/win
# macOS: brew install git
# Linux: sudo apt install git

# Install Python 3.10 (3.11 has issues with some extensions)
# Windows: https://www.python.org/downloads/
# macOS: brew install python@3.10
# Linux: sudo apt install python3.10-venv

Windows Installation

# Clone the repository
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui

# Run the webui
webui-user.bat

# That's it. It will download everything on first run.
# Open http://localhost:7860 in your browser when ready.

macOS Installation

# Install Command Line Tools
xcode-select --install

# Install Homebrew (if not installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install dependencies
brew install python@3.10 git

# Clone the repository
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui

# Run the webui
./webui.sh

# Open http://localhost:7860 when ready

Linux Installation

# Install dependencies
sudo apt update
sudo apt install python3.10-venv git

# Clone the repository
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui

# Run the webui
./webui.sh

# For AMD GPUs, use:
./webui-user.sh --precision full --no-half

# Open http://localhost:7860 when ready

Installing SDXL 1.0

SDXL 1.0 requires two model files (base + refiner):

# Navigate to models directory
cd stable-diffusion-webui/models/StableDiffusion

# Download SDXL 1.0 base model (6.9GB)
wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors

# Download SDXL 1.0 refiner (6.2GB)
wget https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors

# Or download from browser and move to the folder

Restart the webui. SDXL 1.0 base will appear in the dropdown at the top left.

Using the Refiner

SDXL works best with two-stage generation. First pass with base model, then refine:

# In the webui:
#
# 1. Select "sd_xl_base_1.0" as your checkpoint
# 2. Set resolution to 1024x1024 or 1024x1344
# 3. Generate your base images
#
# 4. Go to "Extras" tab
# 5. Select "sd_xl_refiner_1.0" as checkpoint
# 6. Upload your base image
# 7. Set denoising strength to 0.2-0.3
# 8. Run the refiner

This two-stage approach gives significantly better details and textures.

Common Problems & Solutions

Issue #10723: "Torch not compiled with CUDA enabled" on Windows
github.com/AUTOMATIC1111/stable-diffusion-webui/issues/10723

Problem: Fresh install on Windows 11 with RTX 4090, getting "RuntimeError: Torch not compiled with CUDA enabled".

What I Tried: Reinstalling PyTorch manually, updating CUDA toolkit - nothing worked.

Actual Fix: The webui was installing CPU-only PyTorch by default. Force GPU version in webui-user.bat:

# Edit webui-user.bat and add:

@echo off
set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--torch-compile --precision full --no-half

# Or manually install GPU PyTorch before running webui:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

After this, verify with python -c "import torch; print(torch.cuda.is_available())" - should return True.

Issue #11245: "AssertionError: No HF token found" for SDXL
github.com/AUTOMATIC1111/stable-diffusion-webui/issues/11245

Problem: Trying to use SDXL 1.0, getting "AssertionError: No HF token found. Please log in to Hugging Face and accept the license."

What I Tried: Creating HuggingFace account, accepting license - still got the error.

Actual Fix: You need to create an access token and add it to the webui:

# 1. Go to https://huggingface.co/settings/tokens
# 2. Create a new token (read permissions)
# 3. Add to webui-user.bat or webui-user.sh:

# Windows (webui-user.bat):
set HF_TOKEN=hf_your_token_here

# Linux/macOS (webui-user.sh):
export HF_TOKEN="hf_your_token_here"

# Or add to Commandline arguments in settings:
# Settings -> User interface -> Quicksettings list -> add "hf_token"
Issue #9876: SDXL Images Look Dark/Washed Out
github.com/AUTOMATIC1111/stable-diffusion-webui/issues/9876

Problem: SDXL 1.0 images look dark compared to SD 1.5, especially in shadows. Colors lack vibrancy.

What I Tried: Adjusting CFG scale, changing samplers - didn't fix the darkness.

Actual Fix: SDXL 1.0 has different VAE normalization. Need to disable "Empty latent noise" and adjust "VAE CFG"

# In Settings -> Stable Diffusion -> SDXL:

# 1. Uncheck "Empty latent noise"
# 2. Set "SDXL VAE_CFG scale" to 1.5-2.0
# 3. Enable "Apply style to prompt" (SDXL specific)

# Or in the API:
import requests

url = "http://127.0.0.1:7860/sdapi/v1/txt2img"

payload = {
    "prompt": "a beautiful landscape",
    "negative_prompt": "blurry, low quality",
    "steps": 30,
    "cfg_scale": 7.5,
    "width": 1024,
    "height": 1024,
    "sdxl_vae_cfg_scale": 1.8,
    "sdxl_empty_latent_noise": False,
    "override_settings": {
        "sdxl_vae_cfg_scale": 1.8,
        "sdxl_empty_latent_noise": False
    }
}
Issue #10567: "Out of Memory" with SDXL on 8GB GPU
github.com/AUTOMATIC1111/stable-diffusion-webui/issues/10567

Problem: RTX 3070 with 8GB VRAM, getting CUDA OOM errors with SDXL at 1024x1024.

What I Tried: Reducing batch size to 1, lowering resolution - still crashed.

Actual Fix: Enable tiling and optimized attention:

# Add to command line args in webui-user.bat or webui-user.sh:

# Windows:
set COMMANDLINE_ARGS=--xformers --opt-sdp-attention --medvram

# Linux/macOS:
export COMMANDLINE_ARGS="--xformers --opt-sdp-attention --medvram"

# Alternative: Use lower resolution first, then upscale
# Generate at 512x512, then use extras to upscale to 1024

# Or use SDXL turbo (faster, less VRAM):
# Download sd_xl_turbo.safetensors instead of base model
# Uses 40% less VRAM but slightly lower quality

The --medvram flag splits computation across CPU/GPU, making SDXL usable on 8GB cards.

Issue #10234: Extensions Break After Update
github.com/AUTOMATIC1111/stable-diffusion-webui/issues/10234

Problem: After pulling latest updates, extensions like ControlNet or ADetailer stopped working.

What I Tried: Reinstalling extensions, clearing cache - errors persisted.

Actual Fix: Extension API changes in newer webui versions. Need to update extensions and clear Python cache:

# Update all extensions
cd stable-diffusion-webui/extensions
for d in */; do
    cd "$d"
    git pull
    cd ..
done

# Clear Python cache
cd ..
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete

# Reinstall requirements
cd extensions
for d in */; do
    if [ -f "$d/requirements.txt" ]; then
        pip install -r "$d/requirements.txt"
    fi
done

If still broken, pin webui to a specific commit: git checkout where extensions were working.

Optimization Tips

GPU Memory Optimization

# Add to command line args based on your VRAM:

# 8GB or less:
--medvram --opt-sdp-attention

# 12GB:
--lowvram --opt-sdp-attention

# 16GB+:
--xformers --opt-sdp-attention

# All GPUs benefit from:
--no-half-vae  # Fixes some VAE issues

Recommended Extensions

These extensions significantly improve the webui:

# Install from URLs in Extensions tab:
# https://github.com/Mikubill/sd-webui-controlnet
# ControlNet for precise control over pose, depth, edges

# https://github.com/Bing-su/adetailer
# Automatic face detail fixing

# https://github.com/zanllp/sd-webui-infinite-image-browsing
# Better image gallery browser

# https://github.com/continue-revolution/sd-webui-animatediff
# Generate animated GIFs

# Install via git:
cd stable-diffusion-webui/extensions
git clone https://github.com/Mikubill/sd-webui-controlnet.git

Sampler Selection

Different samplers for different use cases:

Sampler Best For Steps
DPM++ 2M KarrasGeneral purpose20-30
DPM++ SDE KarrasHigh detail25-40
Euler aFast generation15-20
DDIMVideo/animation30-50

SDXL Prompting Tips

SDXL 1.0 requires different prompting than SD 1.5:

# SDXL prompts should be shorter and more natural:

# Good SDXL prompt:
"cinematic photo of a cyberpunk street at night, neon lights, rain"

# Verbose SDXL prompt (not necessary):
"masterpiece, best quality, ultra detailed, cinematic photo of a cyberpunk
street at night with neon lights reflecting on wet pavement in the rain,
8k resolution, professional photography"

# SDXL handles style better:
# Add style to the end or use the style dropdown

# Negative prompt for SDXL:
"blurry, low quality, distorted, watermark, text, bad anatomy"

SDXL 1.0 was trained on shorter, more natural prompts. Over-describing can hurt quality.

API Usage

The webui has a REST API for automation:

import requests
import json

url = "http://127.0.0.1:7860"

# Text to Image
payload = {
    "prompt": "a serene mountain landscape at sunset",
    "negative_prompt": "blurry, low quality",
    "steps": 30,
    "cfg_scale": 7.5,
    "width": 1024,
    "height": 1024,
    "sampler_name": "DPM++ 2M Karras"
}

response = requests.post(url=f"{url}/sdapi/v1/txt2img", json=payload)
result = response.json()

# Save image
import base64
import io
from PIL import Image

img_data = base64.b64decode(result['images'][0])
img = Image.open(io.BytesIO(img_data))
img.save("output.png")

# Image to Image
files = {"image": open("input.png", "rb")}
data = {
    "prompt": "turn this into a painting",
    "denoising_strength": 0.6
}

response = requests.post(url=f"{url}/sdapi/v1/img2img", files=files, data=data)

Production Considerations

Recommended Reading

Audiocraft: AI Music

Meta's MusicGen and AudioGen

BabyAGI: AI Agents

Autonomous AI agents tutorial