← Home

How to Run Stable Diffusion Locally

July 15, 2024 by Mandar Wagh
Stable Diffusion

Introduction

Stable Diffusion is a powerful AI model that can generate images from text descriptions. Running it locally on your computer gives you the freedom to experiment with various inputs and even fine-tune the model. This guide will walk you through the process step-by-step.

Important Note: You'll need a GPU (graphics card) in your computer to run Stable Diffusion effectively. The process won't work well without one.

Step 1: Install Python and Git

Python Installation:

Git Installation:

Step 2: Create Necessary Accounts

GitHub Account:

Hugging Face Account:

Step 3: Download Stable Diffusion Web UI

  1. Create a new folder on your computer where you want to store Stable Diffusion.
  2. Open Command Prompt or Terminal and navigate to this folder:
    cd path/to/your/new/folder
  3. Clone the Stable Diffusion Web UI repository:
    git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

Step 4: Download the Stable Diffusion Model

  1. Log in to your Hugging Face account.
  2. Search for "Stable Diffusion" and choose a model version (e.g., v1.5).
  3. Download the model file (it will be large, around 4-7 GB).
  4. Once downloaded, move the file to this location in your Stable Diffusion folder:
    stable-diffusion-webui/models/Stable-diffusion/

Step 5: Set Up the Web UI

  1. Open Command Prompt or Terminal.
  2. Navigate to the stable-diffusion-webui folder:
    cd path/to/stable-diffusion-webui
  3. Run the setup script:
    • On Windows:
      webui-user.bat
    • On Mac/Linux:
      ./webui.sh

Step 6: Run Stable Diffusion

  1. After the setup finishes, you'll see a URL in the Command Prompt/Terminal:
    Running on local URL:  http://127.0.0.1:7860
  2. Copy this URL and paste it into your web browser.
  3. The Stable Diffusion Web UI should now load in your browser.

Using Stable Diffusion

Tips:

Troubleshooting:

Remember, running AI models locally can be resource-intensive. Make sure your computer has adequate cooling, especially during long generation sessions.

Built by Mandar Wagh