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.

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.