Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

run-stable-diffusion-locally-gpu-cpu.md

Stable-Diffusion-for-Dummies

How to Install and Run Stable Diffusion Locally (GPU or CPU) — Step-by-Step Guide

Want to generate AI images on your own PC, for free, without relying on a paid cloud service? This guide walks through the full setup — from a clean machine to your first generated image — using Stability Matrix as the installer/manager and Stable Diffusion WebUI reForge as the actual generation interface. It works whether you're running on a GPU or just a CPU.

What You'll Need

  • A Windows PC (GPU or CPU — either works, GPU is just much faster)
  • A free GitHub account
  • A free Civitai account
  • A free Hugging Face account
  • About 15–20 minutes for setup, plus download time depending on your internet speed

Step 1: Install Python

Download and install the latest version of Python from the official site:

👉 https://www.python.org/downloads/

Just run the installer with default settings — Stability Matrix will handle the rest.


Step 2: Install Stability Matrix

Stability Matrix is a free, open-source package manager for Stable Diffusion UIs. It handles installation, updates, and model management so you don't have to fight with dependencies manually.

  1. Go to the Stability Matrix GitHub repo and download the latest release.
  2. Having a free GitHub account makes this easier (and is useful if you ever want to browse issues/discussions for troubleshooting).
  3. Install and launch Stability Matrix.

Step 3: Install Stable Diffusion WebUI reForge

Inside Stability Matrix:

  1. Go to the Packages tab.
  2. Find and install Stable Diffusion WebUI reForge.
  3. Let it finish downloading and setting up — this can take a few minutes.

Step 4: Connect Civitai and Hugging Face (for downloading models)

To download checkpoints, LoRAs, and VAEs directly inside Stability Matrix, you'll want to connect two free accounts.

Civitai

  1. Create a free account at civitai.com.
  2. Go to your account settings and scroll down to API Keys > Add API key.
  3. Copy the generated key.
  4. In Stability Matrix: Settings > Account > Civitai > Connect, and paste the key in.

Hugging Face

  1. Create a free account at huggingface.co.
  2. Go to Settings > Tokens and create a new token.
  3. Copy the token.
  4. In Stability Matrix: Settings > Account > Hugging Face > Connect, and paste the token in.

Step 5: Download Models (Checkpoint, LoRA, VAE)

In Stability Matrix, open the sidebar and go to Model Manager.

For your first setup, keep things simple:

  • Filter Base Model by: SD 1.5, SD Hyper, SD 1.5 LCM — these tend to run more reliably across a wider range of hardware.
  • Then filter by Model Type to grab a Checkpoint, a LoRA, and a VAE.

Recommended starter checkpoint: EpiCRealism XL — beginner-friendly and produces solid results out of the box.

Once you're comfortable with the basics, feel free to explore other base models and model types — but the above is enough to get your first image generated.


Step 6: Launch the WebUI

  1. Go back to Packages in Stability Matrix.
  2. Before launching, click the gear/cog icon next to the Launch button.
  3. Enable either Force GPU or Force CPU, depending on which you plan to use primarily.
    • GPU: generation typically takes a few seconds per image (depending on your card).
    • CPU: works, but noticeably slower — expect minutes per image.
  4. Click Launch.

If the WebUI doesn't open automatically in your browser, look for this line in the launch console:

Running on local URL:  http://127.0.0.1:7860

Click that link, or manually type http://127.0.0.1:7860 into your browser's address bar.


Step 7: Generate Your First Image

Once the WebUI is open in your browser:

  1. Checkpoint: set to EpiCRealism XL (or whichever you downloaded).
  2. VAE (optional): set to whichever VAE you downloaded (e.g. Voidnoise VAE).
  3. Width / Height: try 512x768 for portrait, or 768x512 for landscape.
  4. Batch count: how many images to generate per run — keep this at 1 for your first test (setting it to 2 generates 2 images from the same prompt).
  5. Sampling method: DPM++ 2M works well as a default. Leave everything else at default settings for now.
  6. Prompt: write a detailed description of what you want to generate.
  7. Negative prompt: describe what you don't want in the image.
  8. Click Generate.

Generation should take a few seconds (GPU) or a couple minutes (CPU). That's it — your first AI-generated image, made entirely on your own PC, for free.

00000-xxx 1 00001-xxx 1

Troubleshooting: Common Errors

Error 1455 — "The paging file is too small"

This means your system's virtual memory (paging file) isn't large enough for the task.

Fix:

  1. Press Win + R, type sysdm.cpl, hit Enter.
  2. Go to the Advanced tab.
  3. Under Performance, click Settings.
  4. In the new window, go to the Advanced tab.
  5. Under Virtual Memory, click Change.
  6. Uncheck "Automatically manage paging file size for all drives."
  7. Select Custom size and enter values in MB — e.g., Initial size: 16384, Maximum size: 32768 (for 16GB/32GB setups).
  8. Click Set, then OK, and restart your computer.

Calculation Errors (NaN errors / crashes mid-generation)

Fix: Add the --disable-nan-check launch argument. This stops the WebUI from crashing on certain number-related errors during generation (note: it can occasionally result in blank/black image output instead of a crash).

  1. Open webui-user.bat in a text editor (Notepad works fine). By default it's located at:
    C:\Stability Matrix\Packages\Stable Diffusion WebUI reForge
    
  2. Find the line starting with set COMMANDLINE_ARGS=.
  3. Add the flag so it looks like:
    set COMMANDLINE_ARGS=--disable-nan-check
    
  4. Save the file and restart the WebUI.

Exit Code 1 / Missing Microsoft Visual C++ Redistributable

The console crashes immediately with a traceback mentioning missing DLLs (e.g. c10.dll).

Cause: Your system is missing runtime components required by PyTorch and its C++ backend.

Fix: Download and install the latest Visual C++ Redistributable from Microsoft: 👉 learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist

Connection Errored Out / Localhost Fails to Load

The terminal starts up fine, but http://127.0.0.1:7860 shows a blank page or times out.

Cause: A local proxy, VPN, or firewall is intercepting traffic to the local address.

Fix:

  • Temporarily disable any active VPNs, proxy tools, or aggressive ad-blocker extensions.
  • Or force a new port by adding --port 7861 to your launch arguments and navigating to http://127.0.0.1:7861 instead.

Final Notes

This setup should get you from zero to your first locally-generated image. If you run into an error not covered here, a search on GitHub Issues (for reForge or Stability Matrix) or the Stable Diffusion subreddit will usually turn up a fix — these are common enough tools that most errors have already been solved by someone else.

Happy generating!

Releases

Packages

Contributors