Purpose: This notebook is used to generate animations with Stable Diffusion 1.4 in Google Colab. It samples using the KLMC2 discretization of underdamped Langevin dynamics and references the Journey to the BAOAB-limit paper by Ajay Jain and Ben Poole. The notebook was written by Katherine Crowson, sponsored by StabilityAI, and the code is released under the MIT License.
Main capabilities: The notebook checks the GPU environment, clones the stablediffusion, stable-diffusion, taming-transformers, and latent-diffusion repositories, and installs dependencies such as ftfy, einops, braceexpand, requests, transformers, clip, open_clip_torch, omegaconf, pytorch-lightning==1.9, kornia, k-diffusion, and ninja. It downloads sd-v1-4.ckpt from CompVis/stable-diffusion-v-1-4-original and the VAE model from stabilityai/sd-vae-ft-mse-original on Hugging Face, loads them onto the GPU, and then defines sampling and video display functions. The code includes NormalizingCFGDenoiser, the KLMC2 sampling loop, DPM-Solver++ refinement steps, and HVP methods such as forward, reverse, kronecker, fake, and zero.
Usage: After opening the notebook in Colab, run the cells in order: check GPU, install dependencies, import libraries, download models, load models, and define functions. The parameter cell provides adjustable items such as prompt, conditioning strength g, number of sampling frames n, noise level sigma, step size h, friction coefficient gamma, and quadratic penalty alpha; then run the sampling cell to generate results, and use show_video to display the video in the notebook.
Applicable scenarios: Suitable for experimenting with Stable Diffusion animation generation in a Colab environment, studying the KLMC2 sampling process, or conductcreative visual exploration.
Limitations: Running depends on Google Colab and a GPU; model downloads require access to Hugging Face and may involve account login or agreeing to the model license; the materials do not provide fees, prices, other platform support, generation effect guarantees, or a standalone application form.