Coder Social home page Coder Social logo

diegovalsesia / mmd-ddm Goto Github PK

View Code? Open in Web Editor NEW
15.0 8.0 4.0 1.39 MB

Fast Inference in Denoising Diffusion Models via MMD Finetuning

License: MIT License

Python 100.00%
ddim ddpm diffusion-models image-generation maximum-mean-discrepancy

mmd-ddm's Introduction

arXiv visitor badge

MMD-DDM

Fast Inference in Denoising Diffusion Models via MMD Finetuning


Introduction

Denoising Diffusion Models (DDMs) have become a popular tool for generating high-quality samples from complex data distributions. These models are able to capture sophisticated patterns and structures in the data, and can generate samples that are highly diverse and representative of the underlying distribution. However, one of the main limitations of diffusion models is the complexity of sample generation, since a large number of inference timesteps is required to faithfully capture the data distribution. In this paper, we present MMD-DDM, a novel method for fast sampling of diffusion models. Our approach is based on the idea of using the Maximum Mean Discrepancy (MMD) to finetune the learned distribution with a given budget of timesteps. This allows the finetuned model to significantly improve the speed-quality trade-off, by substantially increasing fidelity in inference regimes with few steps or, equivalently, by reducing the required number of steps to reach a target fidelity, thus paving the way for a more practical adoption of diffusion models in a wide range of applications.

Finetuning a pretrained model

To finetune a pretrained diffusion modelusing our proposed MMD-DDM strategy, download the pretrained models and adjust the path in runners/diffusion.py, or use models present in /function/ckpt_util.py and run the command:

python main.py --config {DATASET}.yml --timesteps {num_timesteps (e.g 5)} --exp {PROJECT_PATH} --train 

Image Sampling for FID evaluation

To sample image generated from the finetuned model adjust the path in test_FID funciton in runners/diffusion.py with your newly trained model and run:

python main.py --config {DATASET}.yml --timesteps {num_timesteps (e.g 5)} --test_FID  

Citation

If you find MMD-DDM helpful in your research, please consider citing:

@article{aiello2023fast,
  title={Fast Inference in Denoising Diffusion Models via MMD Finetuning},
  author={Aiello, Emanuele and Valsesia, Diego and Magli, Enrico},
  journal={arXiv preprint arXiv:2301.07969},
  year={2023}
}

Acknowledgements

This repository is based on DDIM official implementation: https://github.com/ermongroup/ddim

Contact

If you have any questions, feel free to open an issue or contact us at [email protected]



๐Ÿšง โ›๏ธ ๐Ÿ› ๏ธ ๐Ÿ‘ท

pretrained models will be released soon!

mmd-ddm's People

Contributors

diegovalsesia avatar emanuele97x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  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.