This project is the codebase for the paper titled "Compositional Abilities Emerge Multiplicatively: Exploring Diffusion Models on a Synthetic Task," presented at NeurIPS 2023. The code implements Denoising Diffusion Probabilistic Models (DDPM) and is built using PyTorch.
- Title: Compositional Abilities Emerge Multiplicatively: Exploring Diffusion Models on a Synthetic Task
- Authors: Maya Okawa, Ekdeep Singh Lubana, Robert P. Dick, Hidenori Tanaka
- Venue: Advances in Neural Information Processing Systems (NeurIPS)
- Published: 2023
- Link: arXiv link
- PyTorch
- torchvision
- numpy
- matplotlib
- tqdm
- einops
You can download the datasets required for this project:
-
Synthetic Data:
The synthetic data for this project can be downloaded from the following link:
Download Synthetic Data -
Real Data:
The preprocessed CelebA data for this project can be downloaded from the following link:
Download Preprocessed Data
First, create an input
directory at the root level of this project. Then, place the data files under the input
directory.
To train the model with the synthetic data, run the train.py
script with the desired parameters. For example:
python3 train.py --dataset single-body_2d_3classes
To train the model using the CelebA dataset:
python3 train.py --dataset celeba-3classes-10000
train.py
: Main script for training the DDPM model.load_dataset.py
: Script for loading and processing datasets.
- The
DDPM
class intrain.py
is based on the implementation found at TeaPearce/Conditional_Diffusion_MNIST. - The
CrossAttention
class intrain.py
is inspired by the code in Animadversio/DiffusionFromScratch/StableDiff_UNet_model.py.