Skip to docs navigation
On this page

Stable Diffusion is an AI deep learning model that can generate images from text descriptions. It is based on diffusion techniques, which involve gradually adding noise to an image until it is completely random, and then reversing the process to generate a new image.

Stable Diffusion was developed by Stability AI and is an open source model, which means that anyone can use it to generate images.

git lfs install
git clone

// clone the repository

Fix pyenv

This fixed my zsh setup:


export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"


eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)" link

Activate Environment Automatically

As long as you followed the installation instructions and included the eval "$(pyenv virtualenv-init -)" line in your ~/.bash_profilepyenv-virtualenv has the ability to automatically activate/deactivate your environment for you.

Anytime you change directories, pyenv looks for a .python-version file and uses the specified Python version or virtual environment!

cd into your project directory and run:

pyenv local django-3.2

Notice that you now have a .python-version file in your project. The next time you cd into the project, pyenv will read this file and activate the django-3.2 virtual environment for you!

# install brew (and Xcode command line tools):
/bin/bash -c "$(curl -fsSL"

# Now there are two different routes to get the Python (miniconda) environment up and running:
# 1. Alongside pyenv
# 2. No pyenv
# If you don't know what we are talking about, choose 2.
# 1. Installing alongside pyenv

brew install pyenv-virtualenv # you might have this from before, no problem
pyenv install anaconda3-2022.05
pyenv virtualenv anaconda3-2022.05
eval "$(pyenv init -)"
pyenv activate anaconda3-2022.05

# OR,
# 2. Installing standalone
# install python 3, git, cmake, protobuf:
brew install cmake protobuf rust

# install miniconda (M1 arm64 version):
curl -o

# continue from here

# clone the repo
git clone
cd stable-diffusion

# wait until the checkpoint file has downloaded, then proceed

# create symlink to checkpoint
mkdir -p models/ldm/stable-diffusion-v1/

PATH_TO_CKPT="$HOME/Downloads"  # or wherever you saved sd-v1-4.ckpt

ln -s "$PATH_TO_CKPT/sd-v1-4.ckpt" models/ldm/stable-diffusion-v1/model.ckpt

# install packages
PIP_EXISTS_ACTION=w CONDA_SUBDIR=osx-arm64 conda env create -f environment-mac.yaml
conda activate ldm

# only need to do this once
python scripts/

# run SD!
python scripts/ --full_precision  # half-precision requires autocast and won't work