A PyTorch implementation of a DDPM (Denoising Diffusion Probabilistic Model) according to the original paper. It is implemented and trained from scratch. In this example, I applied it to learn the spatial distribution of the Lorenz Attractor with specific parameters.
Evolution of the diffusion process from pure gaussian noise to the butterfly structure.
- MLP-based 512-dim hidden layers with SiLU activations and LayerNorm
- Sinusoidal position embeddings (128-dim)
- 200-step DDPM with linear noise schedule
pip install -r requirements.txtRun the training script:
python src/train.pyThis will:
- Generate Lorenz attractor data via ODE integration
- Train the diffusion model for 300 epochs. I found that while the loss doesn't decrease much after a while, it is still useful to train longer to better capture the data distribution.
- Save the trained model to
models/model.pt
Generate samples using the trained model:
python src/generate.pyThis will:
- Load the trained model from
models/model.pt - Generate novel points via 200-step denoising process
- Create an animated GIF showing the evolution from noise to structure
- Save visualizations to
media/
Ho, J., Jain, A., & Abbeel, P. (2020). Denoising Diffusion Probabilistic Models.



