Giter VIP home page Giter VIP logo

stable-diffusion-from-scratch's Introduction

Creating a Stable Diffusion Model from Scratch

Learning how to create stable diffusion from the ground up beginning with Variational Autoencoders, CLIP, Denoising UNet, DDPM scheduler, etc. The inspiration here was so I could understand what is happening under the hood when I implement it myself for future projects.

Results

NOTE: Currently, only text-to-image and image-to-image works. Inpainting is a work in progress.

Text-to-Image Result

Prompt: "calico cat, loafing, large watermelon bed, cartoon"

cat

Image-to-Image Result

Input Image: Using the text-to-image result above.
Noise Strength: 0.6
Prompt: "Calico cat wearing a tuxedo, cartoon"

cat-tuxedo

Installation Guide

  1. Clone this repository:

    git clone https://github.com/SupaxInc/stable-diffusion-from-scratch.git
    cd stable-diffusion-from-scratch
    
  2. Download the v1-5-pruned-emaonly checkpoint:

    • Visit RunwayML's Stable Diffusion v1.5 model page
    • Download the v1-5-pruned-emaonly.ckpt file
    • Create a folder named saved_checkpoints in the project root
    • Move the downloaded checkpoint into the saved_checkpoints folder
  3. Set up the environment and run the demo notebook:

    pip install -r requirements.txt
    
    • Open the demo.ipynb notebook
    • Follow the cells in the notebook to generate images
  4. Learn about Stable Diffusion:

    • Open the resources/StableDiffusion.md file
    • Read through the document to understand how the Stable Diffusion model works
  5. Customize the demo notebook:

    • Modify the prompts, input images, or parameters in the notebook cells
    • Experiment with different settings to create your own unique examples
    • Save your results and share your creations!



Citations

I'd like to thank Umar Jamil youtube channel for the amazing break-downs and guides on Transformers and Diffusion models. A lot of the content here was inspired from his videos and all I've done was just simplify it further so I can understand it better in my own words along with diving deeper with my own research. Check him out at Umar Jamil.

https://github.com/CompVis/stable-diffusion/

@InProceedings{Rombach_2022_CVPR,
    author    = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
    title     = {High-Resolution Image Synthesis With Latent Diffusion Models},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2022},
    pages     = {10684-10695}
}

stable-diffusion-from-scratch's People

Contributors

supaxinc avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.