Installing Stable Diffusion Locally: Step-by-Step Guide

Ilustration for Installing Stable Diffusion locally: Step-by-Step

Stable Diffusion is a powerful text-to-image model that allows users to generate high-quality images from textual descriptions. In this guide, we will walk you through the steps of installing and running Stable Diffusion on your local machine.

System Requirements

To ensure a smooth installation, please check the following system requirements:

Step 1: Install Required Software

Before we begin the installation, you'll need to install some required software:

  1. Python: Download and install Python from python.org.
  2. Git: Install Git from git-scm.com.
  3. CUDA: If you have an NVIDIA GPU, install the appropriate version of CUDA from the NVIDIA website.

Step 2: Clone the Stable Diffusion Repository

Open your terminal or command prompt and run the following command:

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

Step 3: Create a Virtual Environment

Navigate to the Stable Diffusion directory and create a virtual environment:

cd stable-diffusion
python -m venv venv
source venv/bin/activate  # On Windows use `venv\Scripts\activate`

Step 4: Install Required Packages

Once your virtual environment is activated, install the necessary dependencies:

pip install -r requirements.txt

Step 5: Download Model Weights

You will need to download pre-trained model weights. Follow these steps:

  1. Go to the Hugging Face model repository.
  2. Accept the model's terms and conditions.
  3. Download the model weights and place them in the appropriate directory.

Step 6: Run Stable Diffusion

Now you're ready to generate images. Use the following command to start the model:

python scripts/txt2img.py --prompt "A fantasy landscape" --plms

Replace "A fantasy landscape" with your desired prompt to generate different images.

Conclusion

Congratulations! You have successfully installed Stable Diffusion on your local machine. Experiment with different prompts and settings to create stunning visuals.

For further exploration, consider joining the community forums or Discord channels dedicated to Stable Diffusion and AI-generated art.

← Back to Blog