Giter Club home page Giter Club logo

split-diffusion's Introduction

Accelerating Guided Diffusion Sampling with Splitting Numerical Methods

The Official implementation for

Accelerating Guided Diffusion Sampling with Splitting Numerical Methods (2023)

by Suttisak Wizadwongsa and Supasorn Suwajanakorn.

ArXiv, OpenReview

Abstrace: Guided diffusion is a technique for conditioning the output of a diffusion model at sampling time without retraining the network for each specific task. One drawback of diffusion models, however, is their slow sampling process. Recent techniques can accelerate unguided sampling by applying high-order numerical methods to the sampling process when viewed as differential equations. On the contrary, we discover that the same techniques do not work for guided sampling, and little has been explored about its acceleration. This paper explores the culprit of this problem and provides a solution based on operator splitting methods, motivated by our key finding that classical high-order numerical methods are unsuitable for the conditional function. Our proposed method can re-utilize the high-order methods for guided sampling and can generate images with the same quality as a 250-step DDIM baseline using 32-58% less sampling time on ImageNet256. We also demonstrate usage on a wide variety of conditional generation tasks, such as text-to-image generation, colorization, inpainting, and super-resolution.

Teaser image

This repository is based on openai/improved-diffusion and crowsonkb/guided-diffusion, with modifications on sampling method.

Installation

Clone this repository and run:

pip install -e .

This should install the python package that the scripts depend on.

Download pre-trained models

All checkpoints of diffusion and classifier models are provided in this.

Split classifier-guided diffusion.

For this code version, user need to download pretrain models and change the models' location in config.py. The output directly can be cange in scripts/classifier_sample.py

python scripts/classifier_sample.py --model=u256 --method=stps4 --timestep_rp=20

Some example of --method options are stsp4, stsp2, ltsp4, ltsp2, plms4, plms2, ddim

  • 128x128 model: --model=c128
  • 256x256 model: --model=c256
  • 256x256 model (unconditional): --model=u256
  • 512x512 model: --model=c512

Other tasks

For detailed usage example, see the notebooks directory. img

  • CLIP-guided Stable Diffusion: This notebook shows how to use Splitting Numerical Methods with CLIP-guided Stable Diffusion.

  • DreamBooth Stable Diffusion: This notebook shows how to use Splitting Numerical Methods with fine-tuned Stable Diffusion.

split-diffusion's People

Contributors

swizad avatar

Stargazers

YJiaaaaa avatar  avatar IDKiro avatar luisarandas avatar Xiao Feng Zhang avatar  avatar Lester Lanteigne avatar Brian Goodwin avatar Siddharth Shrivastava avatar LeeHX avatar  avatar L avatar Lévy飞鸟 avatar uco_physics avatar Aleks Kamko avatar Bin Truong avatar Yongsheng Yu avatar Yuan-Man avatar aaronchen avatar Akihiro Nitta avatar Tenvi avatar Sandalots avatar Nathan Raw avatar  avatar Parshant Loungani avatar  avatar Akinori Nakajima avatar Nikita avatar Kevin Turner avatar universe avatar 爱可可-爱生活 avatar David Marx avatar Verb avatar  avatar Slava Elizarov avatar  avatar Seungjong Yoon avatar Peter Baylies avatar  avatar Ethan Smith avatar UglyStupidHonest avatar Snek avatar Masanori Ogino avatar  avatar  avatar Sauradip Nag avatar  avatar Serbipunk avatar

Watchers

Kevin Turner avatar apolinário avatar Kostas Georgiou avatar  avatar Snek avatar

split-diffusion's Issues

Reproduction issue

In Figure 1 of your paper, you show the problem of PLMS. However, I cannot use your code to reproduce this problem. Here are some 10-step PLMS4 results using c128, which look much better than those in the paper.
img-24img-25img-22img-23

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.