/pytorch-stable-diffusion

Stable Diffusion implemented from scratch in PyTorch

Primary LanguageJupyter NotebookMIT LicenseMIT

pytorch-stable-diffusion

PyTorch implementation of Stable Diffusion from scratch

Download weights and tokenizer files:

  1. Download vocab.json and merges.txt from https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main/tokenizer and save them in the data folder
  2. Download v1-5-pruned-emaonly.ckpt from https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main and save it in the data folder

Tested fine-tuned models:

Just download the ckpt file from any fine-tuned SD (up to v1.5).

  1. InkPunk Diffusion: https://huggingface.co/Envvi/Inkpunk-Diffusion/tree/main
  2. Illustration Diffusion (Hollie Mengert): https://huggingface.co/Envvi/Inkpunk-Diffusion/tree/main

Special thanks

Special thanks to the following repositories:

  1. https://github.com/CompVis/stable-diffusion/
  2. https://github.com/divamgupta/stable-diffusion-tensorflow
  3. https://github.com/kjsman/stable-diffusion-pytorch
  4. https://github.com/huggingface/diffusers/

Run locally

Install all required modules, then run sd/demo.py. If you have a GPU with > 10 GByte VRAM, set ALLOW_CUDA=True .

Run on Google Colab

Upload sd/demo_colab.ipynb to Google Colab. Enable T4 GPU, set ALLOW_CUDA=True .