Skip to content

A numpy Denoising Diffusion Probabilistic Model (DDPM) implementation

Notifications You must be signed in to change notification settings

AkiRusProd/numpy-diffusion

Repository files navigation

numpy-diffusion

Note

This model was implemented in numpy-nn-model repository; therefore, this repository is no longer supported.

What is this?

This is a numpy implementation of the Denoising Diffusion Probabilistic Model (DDPM), that runs at CPU with numpy or GPU with cupy (but it's better to train it on a GPU if you don't want to wait indefinitely)

Datasets

As examples on which the model can be trained, the following datasets are selected:

  • MNIST - consists of 70,000 single channel images of digits
  • CIFAR-10 - consists of 60,000 different colour images in 10 classes
  • UTKFace - consists of 20,000 colour images of faces

Project Structure

Diffusion model trainer:

Model training on the datasets:

Architectures:

Functional components:

  • activations.py - list of activation functions for the model
  • losses.py - list of loss functions for the model. But used only MSE Loss
  • optimizers.py - list of gradient optimizers for the model
  • schedules.py - beta schedules for the DDPM
  • layers - neural network layers like Dense, Conv2D, etc

Special utils:

Samples

At the moment, implemented DDPM and DDIM samplers. The results were obtained using the DDPM sampler

Samples of a model trained on 1-3 epochs on the MNIST dataset:

Samples of a model trained on 1-3 epochs on the CIFAR-10 dataset:

Samples of a model trained on 18-20 epochs on the UTKFace dataset:

References:

Additional literature:

Releases

No releases published

Packages

No packages published

Languages