TutorialtutoriaisTier 2 · Getting Started· Medium· PT60M

How to Run Stable Diffusion Locally: Complete Setup Guide for SDXL

Discover how to run Stable Diffusion XL locally with ease. Enjoy unlimited generations and full control over your AI models.

June 02, 2026· Updated June 02, 2026by Redação SWEN.AI

Introduction

Stable Diffusion XL (SDXL) is a cutting-edge AI model that allows users to generate high-quality images directly on their computers. Running SDXL locally provides numerous benefits, including unlimited image generations, no subscription fees, and complete control over your models and settings. This guide will walk you through the process of setting up SDXL on your machine using ComfyUI or Automatic1111, with the option to enhance your experience using ControlNet for pose-guided generation, LoRAs for style customization, and inpainting for image editing.

Step-by-Step Guide

Step 1: Check Your System Requirements

Before diving into the setup, ensure your computer meets the necessary requirements. You'll need an NVIDIA GPU with at least 8GB of VRAM to run Stable Diffusion effectively.

Step 2: Install Python and Git

Download and install Python from the official website. Ensure you add Python to your PATH during installation. Next, install Git from Git's official site.

Step 3: Clone the Repository

Open a terminal or command prompt and clone the Stable Diffusion repository. Use the following command:

git clone https://github.com/CompVis/stable-diffusion

Step 4: Set Up the Environment

Navigate to the cloned directory and create a virtual environment:

cd stable-diffusion
python -m venv venv

Activate the virtual environment:

  • On Windows: venv\Scripts\activate
  • On macOS/Linux: source venv/bin/activate

Install the required dependencies:

pip install -r requirements.txt

Step 5: Download Model Weights

Obtain the model weights for SDXL from the official sources. Place these weights in the appropriate directory within your cloned repository.

Step 6: Run Stable Diffusion

Launch the model using ComfyUI or Automatic1111. For ComfyUI, use:

python scripts/comfyui.py

For Automatic1111, run:

python scripts/automatic1111.py

Use Cases

1. Artistic Creation

Artists can use SDXL to generate unique and inspiring visuals, pushing the boundaries of digital art.

2. Marketing and Advertising

Businesses can create eye-catching graphics for marketing campaigns, tailored to specific themes or styles.

3. Game Development

Game developers can generate assets and concept art quickly, saving time and resources in the creative process.

Pro Tips

Tip 1: Utilize ControlNet

Install ControlNet to guide your image generation with specific poses or compositions, enhancing the precision of your outputs.

Tip 2: Experiment with LoRAs

Leverage LoRAs to customize the style of your images, allowing for a personalized touch in your creations.

Tip 3: Master Inpainting

Use inpainting to edit and refine specific areas of your images, perfecting details without starting from scratch.

By following this guide, you can unlock the full potential of Stable Diffusion XL on your local machine, opening up a world of creative possibilities.

Save your learning progress

Create your free SWEN account to track completed lessons

Save my progress