Generate AI images on your own hardware
Running Stable Diffusion locally means unlimited image generation, no censorship, and complete privacy. This guide covers setting up ComfyUI - the most powerful and flexible SD interface.
ComfyUI is a node-based interface that gives you complete control over the generation process.
# Clone ComfyUI
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
# Install dependencies
pip install -r requirements.txtđĄ Requires Python 3.10+ and NVIDIA GPU with CUDA.
Download Stable Diffusion checkpoints and place them in the models folder.
# Download SDXL (recommended)
# From: https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0
# Place in: ComfyUI/models/checkpoints/
# Or use wget:
wget -P models/checkpoints/ https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensorsStart the ComfyUI server and access it in your browser.
python main.py
# Open http://127.0.0.1:8188 in your browserđĄ First launch compiles CUDA kernels (takes a few minutes).
Load the default workflow and enter a prompt to generate your first image!
Prompt: "a photo of an astronaut riding a horse on mars, highly detailed, 8k"
Settings: Steps: 20, CFG: 7, Sampler: euler_ancestralâ CUDA out of memory
â Enable --lowvram flag: python main.py --lowvram. This trades speed for VRAM usage.
â Black or corrupted images
â Try a different VAE or update your GPU drivers. SDXL needs the SDXL VAE.
â Generation is slow
â Install xformers for faster attention: pip install xformers. Check GPU utilization with nvidia-smi.