Easy CPU-only stable diffusion without littering too much your GNU/Linux system

requirements:
-16Gb of RAM + at least 4 of swap

  • docker installed

performance on Ryzen 5 5600 using default settings from retards guide:
-10 minutes for 2 512x512 images
-5 minutes for 2 384x384 images

  • memory usage will spike to 10G during loading and then hover between 6-8 during processing

installation:

  • Download the pre-patched repository https://github.com/loadletter/stable-diffusion
  • Download the model data torrent
  • Go into the repo you downloaded and go to stable-diffusion-main/models/ldm. Create a folder called "stable-diffusion-v1". Rename the .ckpt file to "model.ckpt", and copy it into that folder you've made
  • Setup the docker thing, a bind mount is used to share the repo data at /sd
    docker pull continuumio/miniconda3
    docker run -i --name stable_diffusion -v /sd/:/YOUR_DOWNLOADED_REPO_PATH_HERE -t continuumio/miniconda3 /bin/bash
    
  • In the new container cd to /sd/
  • Download dependencies and activate the ambient
    conda env create -f environment.yaml
    conda activate ldm
    
  • You should be able to now issue the command to generate images
    "python scripts/txt2img.py --prompt "sexy anime babes" --H 512 --W 512 --seed 27 --n_iter 2 --ddim_steps 50".
    
  • The first time its run more dependencies will be downloaded and then should be fine and generate the image
  • Once exited, the container can later be recalled with
    1
    2
    3
    sudo docker start -i stable_diffusion
    cd /sd/
    conda activate ldm
    

Optionally /opt/conda and /root/.cache can be moved to /sd and symlinked for more persistence of the downloaded data

credits:

Edit
Pub: 22 Aug 2022 22:19 UTC
Views: 8190