Stable Diffusion Revision as of Wednesday, 26 June 2024 at 10:57 UTC
Saved some notes from here on how to run this on my Mac (a MacBook Pro 16-inch, 2021, M1 Max, 32GB RAM).
I needed Python 3.10; using the 3.11 (beta) version didn’t work. Got a bunch of OpenBLAS-related compilation errors. I just used pyenv
to create a virtual environment.
brew update
brew install Cmake protobuf rust
pyenv virtualenv stable-diffusion
pyenv activate stable-diffusion
git clone -b apple-silicon-mps-support https://github.com/bfirsh/stable-diffusion.git
cd stable-diffusion
pip install -r requirements.txt
# Download sd-v1-4.ckpt from here
#
# https://huggingface.co/CompVis/stable-diffusion-v-1-4-original
#
# and place it in this folder as
#
# models/ldm/stable-diffusion-v1/model.ckpt
#
mkdir -p models/ldm/stable-diffusion-v1/
# Run!
python scripts/txt2img.py \
--prompt "a red juicy apple floating in outer space, like a planet" \
--n_samples 1 --n_iter 1 --plms
# Results will be here
ls -l outputs/txt2img-samples/
Explanation
Here’s a nice basic overview of diffusion. This video goes a bit more into depth.