CS689 — 2D Normalizing Flows and DDPM Diffusion Models Graduate Course Homework (UMass Amherst)
This repository contains the full implementation of RealNVP normalizing flows and a DDPM-style diffusion model for 2D data, following the HW5 specifications.
.
├── report_src/ # All figures, logs, analysis outputs for the report
├── code/
│ ├── realnvp.py # RealNVP forward/inverse, coupling layers, training
│ ├── diffusion_model.py# DDPM forward q(x), posterior, ELBO training
│ ├── config.py # Centralized hyperparameters and paths
│ └── run_me.py # Master script: generates ALL results & figures
├── dataset/
│ └── 689_data.csv # Provided 2D dataset
└── README.md
uv venv
source .venv/bin/activate
uv sync
python code/run_me.py
This script will:
-
Q1 — RealNVP
- Load & normalize dataset
- Visualize point cloud
- Build & test coupling layers
- Train a 6-layer RealNVP model
- Run ablations
- Produce:
- q1_1_scatter.png
- q1_6_realnvp_3panel.png
- training loss curves
- ablation latent/sample plots
-
Q2 — DDPM
- Sample forward noise chain q(x*L | x_0)
- Verify posterior q(x_i | x*{i+1}, x_0)
- Train DDPM using ELBO loss
- Run reverse sampling to generate new data
- Produce:
- q2_3_xL_scatter.png
- posterior verification figures
- 3-panel (original / diffused / generated)
- DDPM training loss curve
Everything is written to:
report_src
SEED = 42