1. Quick Start
Stable Diffusion WebUI (commonly called "A1111") is a browser-based interface for running Stable Diffusion image generation models locally on your own hardware. Built on Gradio, it provides a full-featured GUI for text-to-image, image-to-image, inpainting, upscaling, and dozens of other image generation workflows — all without cloud dependencies or subscriptions.
Key Features
- Text-to-image generation with advanced prompt syntax (emphasis, scheduling, alternation)
- Image-to-image with inpainting, outpainting, and InstructPix2Pix support
- Multiple model architectures: SD 1.x, SD 2.x, SDXL, SD3, Alt-Diffusion
- Extra networks: LoRA, LyCORIS, textual inversion embeddings, hypernetworks
- Upscaling: ESRGAN, RealESRGAN, SwinIR, ScuNET, DAT, HAT, LDSR, and more
- Face restoration: CodeFormer and GFPGAN
- X/Y/Z plot for systematic parameter comparison
- Extensions system for community-built add-ons
- REST API for programmatic access and automation
Prerequisites
- GPU: NVIDIA GPU with 4 GB+ VRAM (6 GB+ recommended); AMD GPUs supported on Linux
- Python: 3.10.x (3.10.6 recommended; 3.12+ may cause issues)
- Git: installed and on PATH
- Disk: ~10 GB for installation + models (each checkpoint is 2–7 GB)
Quickest Install (Windows)
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
webui-user.bat
The launcher automatically creates a Python virtual environment, installs dependencies, and opens the UI at http://127.0.0.1:7860.
Tip
Place your model checkpoint files (
.safetensorsor.ckpt) in themodels/Stable-diffusion/folder before launching. The UI will detect them on startup and let you select from a dropdown.
First Image
- Select a model from the Stable Diffusion checkpoint dropdown at the top
- Type a prompt:
a photo of a mountain landscape at sunset, dramatic lighting, 4k - Click Generate (or press Ctrl+Enter)
- Your image appears in the output gallery within seconds
What to Try Next
- Section 4.1 — master prompt syntax and sampling parameters
- Section 4.2 — transform existing images
- Section 4.5 — add LoRAs for styles and characters
- Section 5 — step-by-step recipes for popular workflows
2. Installation
System Requirements
| Component | Minimum | Recommended |
|---|---|---|
| GPU | NVIDIA 4 GB VRAM | NVIDIA 8+ GB VRAM |
| RAM | 8 GB | 16 GB |
| Disk | 10 GB (+ models) | 50 GB SSD |
| Python | 3.10.x | 3.10.6 |
| OS | Windows 10, Linux, macOS 12+ | Windows 10/11, Ubuntu 22.04+ |
| Git | 2.x | Latest |
Important
Python 3.10.x is strongly recommended. Versions 3.12 and above may fail during dependency installation due to breaking changes in
setuptoolsanddistutils. If you seeCannot import setuptools.build_meta, downgrade to Python 3.10.6.
Platform-Specific Instructions
Windows
- Install Python 3.10.6 — check "Add Python to PATH" during install
- Install Git for Windows
- Clone and launch:
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
webui-user.bat
The batch file creates a venv, installs PyTorch with CUDA support, installs all Python dependencies, and starts the server.
Linux
- Install prerequisites:
# Ubuntu/Debian
sudo apt install wget git python3 python3-venv libgl1 libglib2.0-0
# Arch
sudo pacman -S wget git python3
- Clone and launch:
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
./webui.sh
The shell script sources webui-user.sh for configuration, creates a venv, installs dependencies, and starts the server.
macOS
- Install Homebrew, then:
brew install cmake protobuf rust python@3.10 git wget
- Clone and launch:
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
./webui.sh
On macOS, the launcher automatically sources webui-macos-env.sh, which sets --skip-torch-cuda-test, --upcast-sampling, --no-half-vae, and --use-cpu interrogate for Apple Silicon compatibility.
Docker
The repository does not include an official Dockerfile. Community-maintained Docker images are available on Docker Hub and GitHub Container Registry.
Warning
Always verify the source of third-party Docker images before running them. Prefer images with published Dockerfiles you can audit.
Check the project wiki for community Docker setups that bundle NVIDIA Container Toolkit support.
Environment Variables
Customize the installation and launch behavior by setting these variables in webui-user.bat (Windows) or webui-user.sh (Linux/macOS):
| Variable | Default | Purpose |
|---|---|---|
COMMANDLINE_ARGS |
(empty) | CLI flags passed to launch.py |
TORCH_COMMAND |
(auto-detected) | Custom PyTorch install command |
TORCH_INDEX_URL |
https://download.pytorch.org/whl/cu121 |
PyTorch wheel index URL |
REQS_FILE |
requirements_versions.txt |
Requirements file to install from |
XFORMERS_PACKAGE |
(auto) | Specific xformers version |
GIT |
git |
Path to git executable |
SD_WEBUI_LOG_LEVEL |
(default) | Python log level |
SD_WEBUI_RICH_LOG |
(off) | Enable rich formatted logging |
GRADIO_TEMP_DIR |
(system temp) | Temp directory for Gradio files |
WEBUI_EXTENSIONS_INDEX |
(built-in) | Custom extensions index URL |
HF_ENDPOINT |
https://huggingface.co |
HuggingFace endpoint override |
Post-Install Verification
After the first launch completes, verify:
- The console shows
Running on local URL: http://127.0.0.1:7860 - Open
http://127.0.0.1:7860in your browser - The checkpoint dropdown at the top lists your model files
- Generate a test image with a simple prompt
Customizing Launch (webui-user Files)
Windows — edit webui-user.bat:
@echo off
set COMMANDLINE_ARGS=--xformers --autolaunch
set TORCH_COMMAND=pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
Linux/macOS — edit webui-user.sh:
export COMMANDLINE_ARGS="--xformers --autolaunch"
export TORCH_COMMAND="pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121"
3. Configuration
UI Settings Tab
The Settings tab in the web interface exposes hundreds of configurable options organized into sections. Changes take effect after clicking Apply settings (some require Reload UI). Settings are persisted to config.json in the webui root.
Key user-facing settings categories:
- Saving images: output directory, filename patterns, image format (PNG/JPEG/WEBP), quality, metadata embedding
- Saving paths: per-feature output directories (txt2img, img2img, extras, grids)
- Face restoration: default model, CodeFormer fidelity weight
- Upscaling: default upscaler for hires fix, upscaler order in the UI
- Stable Diffusion: checkpoint, VAE, clip skip, emphasis mode, enable quantization
- Sampler parameters: default sampler, eta, s_churn, s_noise
- UI: theme, quicksettings list, gallery height
Command-Line Flags
Pass flags via COMMANDLINE_ARGS in your webui-user file or directly on the command line.
GPU & Memory
| Flag | Effect |
|---|---|
--medvram |
Split model into three parts to reduce VRAM usage (~4 GB) |
--lowvram |
Aggressive VRAM optimization for GPUs with 2–4 GB |
--no-half |
Use full float32 precision (fixes NaN on some GPUs) |
--no-half-vae |
Use float32 for VAE only (fixes black images) |
--xformers |
Enable xformers memory-efficient attention (recommended for NVIDIA) |
--opt-sdp-attention |
Use PyTorch 2.0 scaled dot product attention |
--opt-sdp-no-mem-attention |
SDP attention without memory-efficient mode |
--opt-sub-quad-attention |
Sub-quadratic attention (lower VRAM, slower) |
--upcast-sampling |
Upcast sampling for better precision (needed on macOS) |
--skip-torch-cuda-test |
Skip CUDA availability check (for CPU/macOS) |
--use-cpu |
Force specific modules to CPU (e.g., --use-cpu interrogate) |
Network
| Flag | Effect |
|---|---|
--listen |
Listen on 0.0.0.0 instead of 127.0.0.1 (LAN access) |
--port PORT |
Set the listening port (default: 7860) |
--share |
Create a Gradio public URL (temporary tunnel) |
--ngrok TOKEN |
Use ngrok for public access with auth token |
--gradio-auth USER:PASS |
Require login credentials for the UI |
UI
| Flag | Effect |
|---|---|
--theme |
Set Gradio theme (dark or light) |
--autolaunch |
Open browser automatically on start |
Paths
| Flag | Effect |
|---|---|
--ckpt-dir PATH |
Custom directory for model checkpoints |
--vae-dir PATH |
Custom directory for VAE models |
--embeddings-dir PATH |
Custom directory for textual inversion embeddings |
--lora-dir PATH |
Custom directory for LoRA files |
--data-dir PATH |
Base directory for all data |
--styles-file PATH |
Path to styles CSV file(s) (supports glob patterns) |
API & Misc
| Flag | Effect |
|---|---|
--api |
Enable the REST API alongside the web UI |
--api-auth USER:PASS |
Set API authentication credentials |
--nowebui |
Run API-only without the Gradio UI |
--cors-allow-origins URL |
Allow CORS from specified origins |
--freeze-settings |
Prevent settings from being modified through the UI |
--disable-safe-unpickle |
Disable safety check for pickle files (use with caution) |
For the complete flag reference with all 129 flags, see the Admin Guide.
Styles Files
The --styles-file flag specifies one or more CSV files containing saved prompt styles. By default, this is styles.csv in the webui root. You can specify multiple files using glob patterns (e.g., --styles-file "styles/*.csv").
4. Core Usage
4.1 Text-to-Image (txt2img)
The txt2img tab is the primary interface for generating images from text descriptions.
Prompt Syntax
Prompts support several special syntax features:
Emphasis — adjust the weight of specific terms:
(word) — increase attention by 1.1x
((word)) — increase attention by 1.21x (1.1 * 1.1)
(word:1.5) — increase attention by 1.5x
[word] — decrease attention by 1.1x (multiply by 1/1.1)
Prompt scheduling — change prompts during generation:
[from:to:0.5] — switch from "from" to "to" at 50% of steps
[from:to:10] — switch at step 10
[to:0.5] — add "to" starting at 50% of steps
[from::0.5] — remove "from" after 50% of steps
Alternating — alternate between terms each step:
[cat|dog] — alternate between cat and dog each step
[cat|dog|bird] — cycle through three terms
Note
Prompt weights stack multiplicatively.
((word))is equivalent to(word:1.21). Avoid extreme weights above 2.0 or below 0.3, as they tend to produce artifacts rather than meaningful emphasis changes.
Negative Prompts
The negative prompt field tells the model what to avoid. Common negative prompt terms:
blurry, low quality, deformed, ugly, extra limbs, watermark, text, signature
Negative prompts use the same syntax as positive prompts, including emphasis and scheduling.
Sampling Parameters
| Parameter | Range | Purpose |
|---|---|---|
| Sampler | 27 options | Algorithm for denoising (see sampler list below) |
| Steps | 1–150 | Number of denoising iterations; 20–30 is typical |
| CFG Scale | 1–30 | How closely to follow the prompt; 7–12 is typical |
| Seed | -1 or fixed | Random seed; -1 for random, fixed for reproducibility |
| Width/Height | 64–2048 | Output resolution (in 8-pixel increments) |
Batch Controls
- Batch count: how many batches to run sequentially
- Batch size: how many images to generate in parallel per batch (limited by VRAM)
Hires Fix
Hires fix generates at a lower resolution first, then upscales and re-renders at full resolution. This avoids the composition problems that occur when generating directly at high resolutions with SD 1.x/2.x models.
- Enable the Hires. fix checkbox
- Choose an Upscaler (Latent, ESRGAN, etc.)
- Set Hires steps (0 = same as main steps)
- Set Denoising strength (0.5–0.7 typical)
- Set target resolution with Upscale by or explicit dimensions
Tip
For SD 1.5 models, generate at 512x512 with Hires fix upscaling to 1024x1024. This produces much better results than generating directly at 1024x1024, which often creates duplicated subjects or distorted anatomy.
4.2 Image-to-Image (img2img)
The img2img tab transforms an existing image guided by a text prompt.
Basic Workflow
- Upload or drag an image to the input area
- Write a prompt describing the desired output
- Set Denoising strength (0.0 = no change, 1.0 = completely new image; 0.4–0.75 typical)
- Click Generate
Resize Modes
| Mode | Behavior |
|---|---|
| Just resize | Stretch to target dimensions |
| Crop and resize | Crop to aspect ratio, then resize |
| Resize and fill | Fit within dimensions, fill empty space |
| Just resize (latent upscale) | Resize in latent space |
Inpainting
Inpainting lets you selectively regenerate parts of an image:
- Switch to the Inpaint sub-tab
- Upload an image
- Paint over the area you want to regenerate (white = regenerate, black = keep)
- Write a prompt for what should appear in the masked area
- Configure fill settings:
- Fill: fill masked area with blurred surroundings
- Original: keep original content as starting point
- Latent noise: fill with random noise
- Latent nothing: fill with zero latent
Soft inpainting (available via the built-in extension) provides smoother blending at mask boundaries by using a gradient transition instead of a hard edge.
InstructPix2Pix
When using an InstructPix2Pix model (instruct-pix2pix.yaml config), you can give editing instructions as prompts (e.g., "make it winter", "change the color to red") and the model applies those edits while preserving the overall image structure.
4.3 Upscaling & Extras
The Extras tab provides standalone upscaling and post-processing without regeneration.
Available Upscalers
| Upscaler | Best For |
|---|---|
| ESRGAN_4x | General purpose |
| RealESRGAN (multiple variants) | Photos, realistic content |
| SwinIR | High quality, slower |
| ScuNET | Denoising + upscaling |
| DAT | State-of-the-art quality |
| HAT | High-accuracy texture recovery |
| LDSR | Highest quality, very slow |
| Lanczos | Fast, traditional algorithm |
| Nearest | Pixel art (no interpolation) |
Usage
- Go to the Extras tab
- Upload a single image or use the Batch Process / Batch from Directory sub-tabs
- Select an upscaler from the Upscaler 1 dropdown
- Set the Resize factor (e.g., 2x, 4x) or explicit target dimensions
- Optionally set Upscaler 2 with a visibility blend for combining two upscalers
- Click Generate
4.4 Face Restoration
Two face restoration models are available as post-processors:
CodeFormer — the recommended option, with an adjustable weight parameter:
- Weight 0 = maximum restoration (sharper faces, may alter features)
- Weight 1 = maximum fidelity (preserves original, less correction)
- Weight 0.5 is a good starting point
GFPGAN — an older alternative, no weight parameter.
Face restoration can be applied:
- Automatically during generation (enable in Settings → Face restoration)
- As a post-processor in the Extras tab
- Via the built-in scripts (
postprocessing_codeformer.py,postprocessing_gfpgan.py)
4.5 Using Extra Networks
Extra networks modify the generation process without changing the base model. Access them via the card icon button below the Generate button.
LoRA / LyCORIS
LoRA (Low-Rank Adaptation) and LyCORIS files add trained concepts — characters, styles, objects — on top of a base model.
Setup: Place .safetensors files in models/Lora/.
Usage: Click the LoRA card in the Extra Networks panel, or type directly in the prompt:
<lora:filename:weight>
filename— the LoRA file name without extensionweight— strength from 0.0 to 1.0+ (0.7–1.0 typical)
Example:
a portrait of a woman, studio lighting <lora:add_detail:0.8>
Multiple LoRAs can be combined:
landscape photo <lora:add_detail:0.6> <lora:more_lighting:0.4>
Note
LoRA compatibility depends on the base model. A LoRA trained on SD 1.5 will not work with SDXL checkpoints and vice versa. Check the LoRA's documentation for the intended base model.
Textual Inversion Embeddings
Embeddings are small files that encode a learned concept as a prompt token.
Setup: Place .pt or .safetensors files in embeddings/.
Usage: Use the embedding's filename directly in your prompt or negative prompt. The Extra Networks panel shows available embeddings with preview thumbnails.
Hypernetworks
Hypernetworks modify the cross-attention layers. Place files in models/hypernetworks/ and select from the Settings tab or Extra Networks panel.
4.6 Prompt Styles
Styles let you save and reuse prompt/negative-prompt combinations.
Saving a Style
- Write your prompt and negative prompt
- Click the save style button (floppy disk icon near the prompt fields)
- Name the style
Applying a Style
Select one or more styles from the dropdown below the prompt fields. The style's prompt and negative prompt are appended to your current inputs.
Template Syntax
Styles support a {prompt} placeholder. If a style's prompt is:
{prompt}, masterpiece, best quality, highly detailed
Then your typed prompt replaces {prompt}, and the rest is appended.
4.7 Image Interrogation (CLIP / DeepDanbooru)
The Interrogate buttons on the img2img tab reverse-engineer a text prompt from an uploaded image.
- CLIP Interrogate (the "clipboard" button) — produces a natural-language description
- DeepDanbooru — produces anime/booru-style tags
Upload an image to img2img, then click the interrogate button. The generated prompt appears in the prompt field, ready for editing or use.
4.8 Extensions
Extensions add features without modifying the core codebase.
Installing from URL
- Go to Extensions → Install from URL
- Paste the git repository URL
- Click Install
- Go to Installed tab and click Apply and restart UI
Installing from Index
- Go to Extensions → Available
- Click Load from to fetch the extension index
- Browse or search for extensions
- Click Install on the desired extension
Managing Extensions
- Enable/Disable: toggle checkboxes on the Installed tab
- Update: click Check for updates then Apply and restart UI
- Remove: delete the extension folder from
extensions/
Built-in Extensions
These ship with the webui and can be enabled/disabled:
| Extension | Purpose |
|---|---|
| Canvas Zoom and Pan | Zoom/pan controls on img2img canvas |
| Prompt Bracket Checker | Warns about unmatched parentheses/brackets |
| Soft Inpainting | Smooth mask blending for inpainting |
| Extra Options Section | Additional UI options in the interface |
| SwinIR | SwinIR upscaler support |
| LDSR | LDSR upscaler support |
| ScuNET | ScuNET upscaler support |
| Lora | LoRA/LyCORIS network support |
| Mobile UI | Responsive layout for mobile browsers |
| Postprocessing for Training | Auto-crop, caption, flip, focal crop, split oversized |
| HyperTile | HyperTile optimization for faster generation |
Important
Extensions run arbitrary code on your system. Only install extensions from sources you trust. Review an extension's repository and community feedback before installing.
5. Common Tasks
5.1 Generate Your First Image
- Launch the webui and navigate to
http://127.0.0.1:7860 - Select a checkpoint from the top dropdown (e.g.,
v1-5-pruned.safetensors) - In the prompt field, type:
a fluffy orange cat sitting on a windowsill, sunlight, soft focus - Set Steps to
25, CFG Scale to7, Size to512x512 - Click Generate or press Ctrl+Enter
- The output appears in the gallery on the right; click to view full-size
5.2 Use LoRA for Style or Character
- Download a LoRA
.safetensorsfile and place it inmodels/Lora/ - Click the Extra Networks card button (below Generate)
- Navigate to the Lora tab
- Click the LoRA card to insert it into your prompt
- Adjust the weight:
<lora:my_lora:0.8> - Add your subject prompt before the LoRA tag
- Generate
5.3 Upscale a Generated Image
- Generate an image or go to the Extras tab
- Upload the image (or send it from txt2img using the "Send to Extras" button)
- Select Upscaler 1:
RealESRGAN_x4plus(good general choice) - Set Resize to
2(doubles dimensions) - Click Generate
5.4 Fix Faces in a Photo
- Go to Extras tab
- Upload the image with faces to fix
- Enable CodeFormer under face restoration
- Set CodeFormer weight to
0.5(balance between restoration and fidelity) - Click Generate
5.5 Inpaint Part of an Image
- Go to img2img → Inpaint sub-tab
- Upload the image
- Use the brush to paint over the area to regenerate
- In the prompt, describe what should appear:
a red rose - Set Denoising strength to
0.75 - Set Masked content to
fill - Click Generate
5.6 Create Variations with Seed
- Generate an image you like
- Note the Seed value shown below the output image
- Lock the seed by clicking the recycle icon (or enter it manually)
- Make small prompt or parameter changes
- Generate again — the composition stays similar while details change
For slight variations, use Variation seed with a small Variation strength (0.05–0.15).
5.7 Use X/Y/Z Plot for Parameter Comparison
- In txt2img or img2img, open the Script dropdown at the bottom
- Select X/Y/Z plot
- Choose axis types (e.g., X =
Sampler, Y =Steps, Z =CFG Scale) - Enter values:
- Sampler:
Euler a, DPM++ 2M Karras, DDIM - Steps:
10, 20, 30, 50 - CFG:
5, 7, 10
- Sampler:
- Click Generate — produces a grid comparing every combination
Tip
X/Y/Z plots are the fastest way to find optimal parameters for a new model or LoRA. Start with a sampler comparison, then narrow down steps and CFG scale.
5.8 Run the API Alongside the Web UI
- Add
--apito yourCOMMANDLINE_ARGS:
export COMMANDLINE_ARGS="--api"
- Launch the webui normally
- Access the API docs at
http://127.0.0.1:7860/docs(Swagger UI) - Make requests programmatically:
import requests
import base64
payload = {
"prompt": "a beautiful sunset over mountains",
"steps": 25,
"width": 512,
"height": 512
}
response = requests.post("http://127.0.0.1:7860/sdapi/v1/txt2img", json=payload)
image_data = response.json()["images"][0]
with open("output.png", "wb") as f:
f.write(base64.b64decode(image_data))
5.9 Generate from a List of Prompts
- Create a text file with one prompt per line:
a red sports car on a mountain road
a blue sailboat on calm waters
a green forest with morning fog
- In txt2img, select the Prompts from file or textbox script
- Either paste prompts into the text box or load the file
- Set your generation parameters
- Click Generate — each prompt produces one or more images
5.10 Use Outpainting to Extend an Image
- Go to img2img → Inpaint sub-tab
- Upload your image
- Select the Outpainting mk2 script from the Script dropdown
- Configure the number of pixels to extend on each side
- Set denoising strength to
0.8–0.9 - Write a prompt matching the image's subject/style
- Click Generate — the model fills in the new area coherently
5.11 SD Upscale (Tiled Upscaling)
For upscaling with Stable Diffusion refinement (better quality than plain upscalers):
- Go to img2img
- Upload the image to upscale
- Select the SD upscale script
- Choose a tile overlap (e.g., 64 pixels)
- Choose an upscaler (e.g.,
RealESRGAN_x4plus) - Set scale factor to
2 - Set denoising strength to
0.2–0.4(lower = closer to original) - Generate
5.12 Checkpoint Merging
Merge two or three models to combine their strengths:
- Go to the Checkpoint Merger tab
- Select Primary model (A) and Secondary model (B)
- Optionally select a Tertiary model (C)
- Choose interpolation method: Weighted sum or Add difference
- Set the Multiplier (0 = all A, 1 = all B)
- Choose output format (safetensors recommended)
- Click Merge
The merged checkpoint appears in models/Stable-diffusion/ and can be selected like any other model.
6. Troubleshooting
Keyboard Shortcuts
Before diving into issues, know these shortcuts for controlling generation:
| Shortcut | Action |
|---|---|
| Ctrl+Enter | Start generation / restart |
| Alt+Enter | Skip current image in batch |
| Esc | Interrupt generation entirely |
Error: RuntimeError: Torch is not able to use GPU
Cause: PyTorch was installed without CUDA support, or NVIDIA drivers are outdated.
Solution:
- Check your NVIDIA driver version:
nvidia-smi - Ensure you have CUDA-compatible drivers (525+ for CUDA 12.x)
- Reinstall PyTorch with CUDA support by setting in
webui-user.sh/webui-user.bat:
export TORCH_COMMAND="pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121"
- Delete the
venvfolder and relaunch to force reinstall
Prevention: Always install NVIDIA drivers before the webui.
Error: Cannot import setuptools.build_meta
Cause: Python 3.12+ removed distutils, which some dependencies still require.
Solution:
- Install Python 3.10.6 alongside your current version
- Update
webui-user.sh/webui-user.batto pointpython_cmdto Python 3.10 - Delete the
venvfolder and relaunch
Prevention: Use Python 3.10.x for this project.
Error: No module named pip
Cause: The Python installation is missing pip, or the venv was corrupted.
Solution:
- Ensure pip is installed:
python -m ensurepip - If the venv is corrupted, delete the
venvfolder and relaunch - On Linux, you may need:
sudo apt install python3-pip python3-venv
Prevention: Use the official Python installer with pip included.
Error: Python version is too recent
Cause: Dependencies (especially torch, xformers) don't support Python 3.12+.
Solution:
- Install Python 3.10.6
- Set
python_cmd=python3.10inwebui-user.sh - Delete
venvand relaunch
Prevention: Stick to Python 3.10.x.
Error: CLIP loading errors
Cause: Corrupted model download or HuggingFace connectivity issue.
Solution:
- Delete the cached CLIP model (usually in
~/.cache/huggingface/) - If behind a firewall, set
HF_ENDPOINTto a mirror - Relaunch to re-download
Prevention: Ensure stable internet during first launch.
Error: AttributeError: 'ImageDraw' object has no attribute 'multiline_textsize'
Cause: Pillow 10+ removed the deprecated multiline_textsize method.
Solution:
- Pin Pillow to a compatible version:
pip install Pillow==9.5.0
- Or update the webui to a version that supports Pillow 10+
Prevention: Let the webui manage its own dependencies via requirements_versions.txt.
Error: RuntimeError: Cannot add middleware after app started
Cause: Extension or API configuration conflict during startup.
Solution:
- Disable all extensions (rename
extensionsfolder temporarily) - If it works, re-enable extensions one by one to find the conflict
- Update the problematic extension or remove it
Prevention: Keep extensions updated.
Warning
When disabling extensions by renaming the folder, make sure to note the original name. Some extensions create configuration files that reference the folder name.
Out of Memory Errors
Cause: Insufficient GPU VRAM for the requested operation.
Solution:
- Add
--medvramtoCOMMANDLINE_ARGS(moderate savings) - If still OOM, use
--lowvram(significant savings, slower) - Reduce image dimensions (512x512 instead of 1024x1024)
- Reduce batch size to 1
- Add
--xformersor--opt-sdp-attentionfor memory-efficient attention - Close other GPU-using applications
Prevention: Monitor VRAM with nvidia-smi and know your GPU's limits.
NaN Images / Black Images
Cause: Numerical instability during generation, often with certain VAEs or half-precision mode.
Solution:
- Add
--no-half-vaetoCOMMANDLINE_ARGS(most common fix) - If still occurring, add
--no-half(uses more VRAM) - Try a different VAE
- Try
--upcast-sampling
Prevention: Use --no-half-vae by default if you encounter this even once.
Slow Generation Speed
Cause: Missing optimizations or sub-optimal configuration.
Solution:
- Enable
--xformers(NVIDIA GPUs, best speedup) - Or use
--opt-sdp-attention(PyTorch 2.0+, no extra install) - Ensure you're not in
--lowvrammode unnecessarily - Check that no other processes are using the GPU
- Use appropriate resolution for your model (512px for SD 1.x, 1024px for SDXL)
Prevention: Always use --xformers or --opt-sdp-attention.
Extensions Won't Install
Cause: Git connectivity issues, Python dependency conflicts, or permissions.
Solution:
- Check internet connectivity
- Try installing manually:
cd extensions
git clone <extension-url>
- Check the console for specific pip errors
- Some extensions need specific Python packages — install them manually
Prevention: Keep git updated and check extension compatibility before installing.
Model Loading Failures
Cause: Corrupted download, incompatible format, or wrong config.
Solution:
- Re-download the model file (check file size matches the source)
- Prefer
.safetensorsformat (safer and faster than.ckpt) - Ensure the correct config YAML exists for the model architecture
- Check console output for specific error messages
Prevention: Always verify file integrity after downloading large models.
Caution
The
.ckptformat uses Python pickle, which can execute arbitrary code during loading. Always prefer.safetensorsfiles, which are safe by design. If you must use.ckptfiles, do not disable--disable-safe-unpickle.
AMD GPU Issues
Cause: AMD GPUs require ROCm on Linux; Windows support is limited.
Solution:
- Linux: install ROCm and use
--use-cpufor unsupported operations - Set
TORCH_COMMANDto install the ROCm version of PyTorch:
export TORCH_COMMAND="pip install torch torchvision --index-url https://download.pytorch.org/whl/rocm5.6"
- Some features (xformers) are NVIDIA-only; use
--opt-sdp-attentioninstead - Check the webui wiki for AMD-specific guidance
Prevention: Verify your AMD GPU and ROCm version are in the PyTorch compatibility matrix.
WebUI Won't Start
Cause: Various — dependency issues, port conflicts, corrupted venv.
Solution:
- Read the console output carefully for the first error
- Check if port 7860 is already in use: change with
--port 7861 - Delete
venvfolder and relaunch for a clean install - Ensure Python 3.10.x and git are on PATH
- On Windows, run
webui-user.batfrom a terminal (not double-click) to see errors
Prevention: Keep a working venv backup before major updates.
7. FAQ
Q: What GPUs are supported?
NVIDIA GPUs with CUDA support are the primary target. Minimum 4 GB VRAM (GTX 1050 Ti class), recommended 8 GB+ (RTX 3060/4060 class). AMD GPUs work on Linux via ROCm. Intel Arc GPUs have experimental support. Apple Silicon (M1/M2/M3) works via MPS backend with the macOS launch script.
Q: How much VRAM do I need?
For SD 1.5 at 512x512: 4 GB minimum (with --medvram), 6 GB comfortable, 8 GB+ for batches and hires fix. For SDXL at 1024x1024: 8 GB minimum, 12 GB+ recommended. The --medvram and --lowvram flags reduce requirements at the cost of speed.
Q: Can I use CPU only?
Yes, add --skip-torch-cuda-test --use-cpu all to COMMANDLINE_ARGS. Generation will be extremely slow (minutes per image instead of seconds), but it works for testing or if you have no compatible GPU.
Q: How do I update the webui?
cd stable-diffusion-webui
git pull
Then relaunch. The startup script handles dependency updates automatically. For a clean update, delete the venv folder before relaunching.
Q: Where are generated images saved?
By default:
- txt2img:
outputs/txt2img-images/ - img2img:
outputs/img2img-images/ - Extras:
outputs/extras-images/ - Grids:
outputs/txt2img-grids/andoutputs/img2img-grids/
These paths are configurable in Settings → Saving paths.
Q: How do I add custom models?
Place model files in the appropriate directory:
- Checkpoints (
.safetensors,.ckpt):models/Stable-diffusion/ - VAEs:
models/VAE/ - LoRAs:
models/Lora/ - Embeddings:
embeddings/ - Upscalers (ESRGAN etc.):
models/ESRGAN/
Click the refresh button next to the model dropdown to detect new files without restarting.
Q: What's the difference between samplers?
Samplers control the denoising algorithm. Key distinctions:
- Euler / Euler a: fast, good baseline. "a" = ancestral (adds randomness each step)
- DPM++ 2M Karras: excellent quality-to-speed ratio, widely recommended
- DPM++ SDE Karras: good for detailed images, slightly slower
- DDIM: deterministic, good for img2img and low step counts
- UniPC: fast convergence, good results in fewer steps
- LCM: designed for LCM-LoRA, produces results in 4–8 steps
Ancestral samplers (marked with "a") never fully converge — increasing steps continues changing the image. Non-ancestral samplers converge to a final result.
Q: How do I use SDXL?
- Download an SDXL checkpoint (e.g.,
sd_xl_base_1.0.safetensors) and place it inmodels/Stable-diffusion/ - Optionally download the SDXL refiner model
- Select the SDXL checkpoint from the dropdown
- Set resolution to 1024x1024 (SDXL's native resolution)
- Generate as usual — the webui automatically detects the model architecture
SDXL requires more VRAM than SD 1.5 (8 GB+ recommended).
Q: Can I run it on a server or cloud?
Yes. Use --listen to bind to all interfaces and --port to set the port. For security, add --gradio-auth user:password. For public access, use --share (Gradio tunnel) or --ngrok with a token. For API-only access, use --nowebui --api.
Q: How do I use the API?
Launch with --api flag. The API is documented at http://127.0.0.1:7860/docs. Key endpoints:
POST /sdapi/v1/txt2img— text-to-imagePOST /sdapi/v1/img2img— image-to-imageGET /sdapi/v1/sd-models— list modelsPOST /sdapi/v1/options— change settingsGET /sdapi/v1/progress— check generation progress
Use --api-auth user:pass for API authentication.
Q: What is --xformers?
The --xformers flag enables the xformers library for memory-efficient cross-attention. It reduces VRAM usage and increases speed on NVIDIA GPUs. If xformers fails to install, use --opt-sdp-attention as an alternative (requires PyTorch 2.0+).
Q: How do I disable the NSFW safety checker?
The webui does not include a built-in NSFW filter by default. If an extension adds one, disable it from the Extensions tab. The --disable-safe-unpickle flag is unrelated — it controls pickle file safety checks, not content filtering.
Q: Can I use multiple GPUs?
The webui does not natively support multi-GPU generation. Each instance uses one GPU. To use a specific GPU, set the CUDA_VISIBLE_DEVICES environment variable:
export CUDA_VISIBLE_DEVICES=1 # use second GPU
For parallel processing, run multiple instances on different ports and GPUs.
Q: How do I roll back to an older version?
cd stable-diffusion-webui
git log --oneline -20 # find the commit you want
git checkout <commit-hash>
Delete the venv folder and relaunch to ensure dependencies match the older version. Back up your config.json and ui-config.json before rolling back.
Q: What is the config.json file?
config.json in the webui root stores all settings configured through the UI's Settings tab. It is created automatically on first settings save. You can edit it directly (with the webui stopped) or back it up before making changes. ui-config.json stores UI element defaults (dropdown selections, slider ranges).
Appendix: Reference Tables
Available Samplers
K-diffusion samplers: Euler, Euler a, LMS, Heun, DPM2, DPM2 a, DPM++ 2S a, DPM++ 2M, DPM++ SDE, DPM++ 2M SDE, DPM++ 3M SDE, DPM fast, DPM adaptive, LMS Karras, DPM2 Karras, DPM2 a Karras, DPM++ 2S a Karras, DPM++ 2M Karras, DPM++ SDE Karras, DPM++ 2M SDE Karras, DPM++ 3M SDE Karras, DPM++ 2M SDE Exponential, DPM++ 3M SDE Exponential, Restart
CompVis samplers: DDIM, PLMS, UniPC
LCM sampler: LCM
Supported Model Architectures
| Architecture | Config File | Native Resolution |
|---|---|---|
| SD 1.x | v1-inference.yaml |
512x512 |
| SD 1.x Inpainting | v1-inpainting-inference.yaml |
512x512 |
| SD 2.x | v2-inference.yaml / v2-inference-v.yaml |
768x768 |
| SDXL | sd_xl_base.yaml / sd_xl_inpaint.yaml |
1024x1024 |
| SD3 | sd3-inference.yaml |
1024x1024 |
| Alt-Diffusion | alt-diffusion-inference.yaml |
512x512 |
| InstructPix2Pix | instruct-pix2pix.yaml |
512x512 |
Built-in Scripts
| Script | Tab | Purpose |
|---|---|---|
| Prompts from file or textbox | txt2img, img2img | Batch generate from a list of prompts |
| Prompt matrix | txt2img, img2img | Generate combinations of prompt segments |
| X/Y/Z plot | txt2img, img2img | Parameter comparison grid |
| SD upscale | img2img | Tiled upscaling with SD refinement |
| Outpainting mk2 | img2img | Extend image borders |
| Poor man's outpainting | img2img | Simpler outpainting method |
| Loopback | img2img | Iterative img2img (feed output back) |
| img2img alternative test | img2img | Alternative img2img processing |
| Run custom code | txt2img, img2img | Execute arbitrary Python code |