This repository provides a PyTorch implementation of Denoising Diffusion Probabilistic Models (DDPM), based on the paper:
Denoising Diffusion Probabilistic Models
Ho et al., NeurIPS 2020
📄 Read the paper
This implementation trains a DDPM model on the MNIST dataset, converted from CSV format to image format.
----
Create image folders:
mkdir -p data/train/images mkdir -p data/test/images
-
Download the MNIST CSV files from Kaggle - MNIST in CSV and place them inside the
data/directory:data/ ├── mnist_train.csv └── mnist_test.csv -
Extract images using the script:
python utils/extract_mnist_images.py
-
You should now have:
data/ ├── train/ │ └── images/ │ ├── 0/ │ ├── 1/ │ └── ... └── test/ └── images/ ├── 0/ ├── 1/ └── ...
Train the DDPM model using:
python train_ddpm.py --config config/default.yamlThis will save model checkpoints to default/ddpm_ckpt.pth.
To generate samples using the trained model:
python sample_ddpm.py --config config/default.yamlGenerated images will be saved in:
default/samples/x0_*.png
git clone https://github.com/momoth12/Denoising-Diffusion-Probabilistic-Models.git
cd Denoising-Diffusion-Probabilistic-Models
pip install -r requirements.txt.
├── config/
│ └── default.yaml
├── dataset/
│ └── mnist_dataset.py
├── models/
│ └── unet_base.py
├── scheduler/
│ └── linear_noise_scheduler.py
├── scripts/
│ ├── train_ddpm.py
│ └── sample_ddpm.py
├── utils/
│ └── extract_mnist_images.py
├── data/
├── config/ │ └── default.yaml ├── dataset/ │ └── mnist_dataset.py ├── models/ │ └── unet_base.py ├── scheduler/ │ └── linear_noise_scheduler.py ├── utils/ │ └── extract_mnist_images.py ├── data/ ├── default/ │ └── ddpm_ckpt.pth (after training) │ └── samples/ ├── train_ddpm.py ├── sample_ddpm.py ├── README.md └── requirements.txt
│ └── ddpm_ckpt.pth (after training)
│ └── samples/
├── README.md
└── requirements.txt
This repository is a clean reimplementation of the DDPM framework from the original paper by Ho et al. It is designed for educational and research use on small datasets like MNIST.
- Conditional DDPM on digit labels
- Training on CIFAR-10 or CelebA
- Integration with logging tools like TensorBoard or Weights & Biases
