Last active
October 10, 2022 08:51
-
-
Save geerlingguy/f475393bae839e098e46c36230f297fb to your computer and use it in GitHub Desktop.
Install Stable Diffusion on an Nvidia GPU PC running Ubuntu 22.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: This will only work on (which?) GPUs. | |
# Install Conda (latest from https://docs.conda.io/en/latest/miniconda.html#linux-installers) | |
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh | |
bash Miniconda3-py39_4.12.0-Linux-x86_64.sh | |
# follow the prompts, restart your Terminal session, and run `conda` to confirm it installed. | |
# Install git and curl, and clone the stable-diffusion repo | |
sudo apt install -y git curl | |
cd Downloads | |
git clone https://github.com/CompVis/stable-diffusion.git | |
# Install dependencies and activate environment | |
cd stable-diffusion | |
conda env create -f environment.yaml | |
conda activate ldm | |
# Download Stable Diffusion weights | |
curl https://www.googleapis.com/storage/v1/b/aai-blog-files/o/sd-v1-4.ckpt?alt=media > sd-v1-4.ckpt | |
# Symlink the weights into place | |
mkdir -p models/ldm/stable-diffusion-v1/ | |
ln -s -r sd-v1-4.ckpt models/ldm/stable-diffusion-v1/model.ckpt | |
# Generate an image | |
python scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse" --plms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was getting the error:
So I installed
nvitop
withpip3 install nvitop
, and ran it to find the model seemed to be quickly eating all available memory.So I ran it with
--n_samples 1
and that seemed to do a bit better.To just generate one image, you can also add
--n_iter 1
.