DiffusionFromScratch
# Diffusion From Scratch Binxu Wang ([email protected]) Tutorial on Stable Diffusion Models at ML from Scratch seminar series at Harvard.  * [Homepage](https://scholar.harvard.edu/binxuw/classes/machine-learning-scratch/materials/stable-diffusion-scratch) * [Tutorial Slides](https://scholar.harvard.edu/files/binxuw/files/stable_diffusion_a_tutorial.pdf) This tiny self-contained code base allows you to * Rebuild the Stable Diffusion Model in a single Python script. * Train your toy version of stable diffusion on classic datasets like MNIST, CelebA  ## Colab notebooks * Playing with Stable Diffusion and inspecting the internal architecture of the models. [Open in Colab](https://colab.research.google.com/drive/1TvOlX2_l4pCBOKjDI672JcMm4q68sKrA?usp=sharing) * Build your own Stable Diffusion UNet model from scratch in a notebook. (with < 300 lines of codes!) [Open in Colab](https://colab.research.google.com/drive/1mm67_irYu3qU3hnfzqK5yQC38Fd5UFam?usp=sharing) * [Self contained script](https://github.com/Animadversio/DiffusionFromScratch/blob/master/StableDiff_UNet_model.py) * [Unit tests](https://github.com/Animadversio/DiffusionFromScratch/blob/master/StableDiff_UNet_unittest.py) * Build a Diffusion model (with UNet + cross attention) and train it to generate MNIST images based on the "text prompt". [Open in Colab (exercise)](https://colab.research.google.com/drive/1Y5wr91g5jmpCDiX-RLfWL1eSBWoSuLqO?usp=sharing) [Open in Colab (answer)](https://colab.research.google.com/drive/1_MEFfBdOI06GAuANrs1b8L-BBLn3x-ZJ?usp=sharing) ## Demo Outputs [](https://www.youtube.com/watch?v=SmY7vMNen2w) [Music video](https://github.com/nateraw/stable-diffusion-videos) generated from Stable Diffusion. ## Star History <a href="https://star-history.com/#Animadversio/DiffusionFromScratch&Date"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Animadversio/DiffusionFromScratch&type=Date&theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Animadversio/DiffusionFromScratch&type=Date" /> <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Animadversio/DiffusionFromScratch&type=Date" /> </picture> </a>