How To Install The Stable Diffusion AI On PC

Stable Diffusion is an open-source AI system created by Stability AI that can generate realistic images and art from text prompts. It requires a modern GPU to run locally on your computer. This guide will walk you through installing Stable Diffusion on a Windows PC.

Prerequisites

  • A PC running Windows 10 or 11
  • An NVIDIA GPU with at least 8GB of VRAM. RTX 2000 series or newer is recommended.
  • At least 10GB of free disk space
  • Anaconda or Miniconda Python distribution
  • Basic knowledge of using the command prompt

Steps

  1. Install Anaconda or Miniconda Download and install Anaconda or Miniconda for Python 3.x from their official website. Make sure to download the latest version.
  2. Create a new Conda environment Open the Anaconda Prompt terminal and run:

 

 

Copy code

conda create --name diffusers python=3.10

This will create a new Conda environment called “diffusers” with Python 3.10 installed.

  1. Activate the environment Activate the new environment by running:

 

 

Copy code

conda activate diffusers
  1. InstallStable Diffusion dependencies With the diffusers environment activated, run:

 

 

Copy code

pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu pip install -r requirements.txt

This will install PyTorch and the required dependencies for Stable Diffusion.

  1. Install Stable Diffusion Clone the Stable Diffusion repository:

 

 

Copy code

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

Navigate into the repository folder and install it:

 

 

Copy code

cd stable-diffusion pip install -e .

This installs Stable Diffusion in editable mode.

  1. Download model checkpoint Go to https://huggingface.co/CompVis/stable-diffusion-v-1-4 and download the model checkpoint (around 1.8GB) into the stable-diffusion folder.
  2. Test it out You can now test Stable Diffusion by running:

 

 

Copy code

python scripts/txt2img.py --prompt "a painting of a fox in the forest"

This will use the model to generate an image based on your prompt.

You have now successfully installed Stable Diffusion! You can start using it to generate AI images.

By Bamdad

Leave a Reply

Your email address will not be published. Required fields are marked *