Giter Site home page Giter Site logo

pytorch-ddpm's Introduction

Denoising Diffusion Probabilistic Models

Unofficial PyTorch implementation of Denoising Diffusion Probabilistic Models [1].

This implementation follows the most of details in official TensorFlow implementation [2]. I use PyTorch coding style to port [2] to PyTorch and hope that anyone who is familiar with PyTorch can easily understand every implementation details.

TODO

  • Datasets
    • Support CIFAR10
    • Support LSUN
    • Support CelebA-HQ
  • Featurex
    • Gradient accumulation
    • Multi-GPU training
  • Reproducing Experiment
    • CIFAR10

Requirements

  • Python 3.6

  • Packages Upgrade pip for installing latest tensorboard

    pip install -U pip setuptools
    pip install -r requirements.txt
    
  • Download precalculated statistic for dataset:

    cifar10.train.npz

    Create folder stats for cifar10.train.npz.

    stats
    └── cifar10.train.npz
    

Train From Scratch

  • Take CIFAR10 for example:
    python main.py --train \
        --flagfile ./config/CIFAR10.txt
    
  • [Optional] Overwrite arguments
    python main.py --train \
        --flagfile ./config/CIFAR10.txt \
        --batch_size 64 \
        --logdir ./path/to/logdir
    
  • [Optional] Select GPU IDs
    CUDA_VISIBLE_DEVICES=1 python main.py --train \
        --flagfile ./config/CIFAR10.txt
    
  • [Optional] Multi-GPU training
    CUDA_VISIBLE_DEVICES=0,1,2,3 python main.py --train \
        --flagfile ./config/CIFAR10.txt \
        --parallel
    

Evaluate

  • A flagfile.txt is autosaved to your log directory. The default logdir for config/CIFAR10.txt is ./logs/DDPM_CIFAR10_EPS
  • Start evaluation
    python main.py \
        --flagfile ./logs/DDPM_CIFAR10_EPS/flagfile.txt \
        --notrain \
        --eval
    
  • [Optional] Multi-GPU evaluation
    CUDA_VISIBLE_DEVICES=0,1,2,3 python main.py \
        --flagfile ./logs/DDPM_CIFAR10_EPS/flagfile.txt \
        --notrain \
        --eval \
        --parallel
    

Reproducing Experiment

CIFAR10

  • FID: 3.249, Inception Score: 9.475(0.174)

The checkpoint can be downloaded from my drive.

Reference

[1] Denoising Diffusion Probabilistic Models

[2] Official TensorFlow implementation

pytorch-ddpm's People

Contributors

zjuyzj avatar w86763777 avatar js5t3r avatar

Watchers

 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.