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.
- 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
- 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.
- Create a new Conda environment Open the Anaconda Prompt terminal and run:
conda create --name diffusers python=3.10
This will create a new Conda environment called “diffusers” with Python 3.10 installed.
- Activate the environment Activate the new environment by running:
conda activate diffusers
- InstallStable Diffusion dependencies With the diffusers environment activated, run:
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.
- Install Stable Diffusion Clone the Stable Diffusion repository:
git clone https://github.com/CompVis/stable-diffusion.git
Navigate into the repository folder and install it:
cd stable-diffusion pip install -e .
This installs Stable Diffusion in editable mode.
- 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.
- Test it out You can now test Stable Diffusion by running:
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.