Skip to content

geminik23/generative_models

Repository files navigation

Generative Models

This toy project is for the study of various generative models applied to small digit images. The goal of this project is to gain a better understanding of different generative model types.

Dataset

For simplicity, this project focuses on small digit images (resized 12x12) from the MNIST dataset. Some models uses a flattened version of the digit images for linear layers or 1D domain applications.

Instructions

Each generative model has its own directory. The main file for each model is located in its respective directory. You can select model types, as well as mode like train or inference, using arguments. Replace [model], [modes], and [submodels] with the appropriate values as described in each model section.

python . [model] [mode] --model [submodels]

Model files are saved in the result directory and default file name is model. You can change the file name for saving or loading models using the --save_file and --load_file arguments:

python . [model] [mode] --model [submodels] --save_file [file_name] --load_file [file_name]

Models

The following generative models have been implemented considering various concepts such as autoregressive, flow-based, diffusion, etc. Each model is designed with either linear or convolutional layers to suit the application domain, whether it is one or two dimension representations.

Autoregressive Model

Autoregressive models generate data sequentially by learning the probability distribution of each element based on the preceding elements.

  • model: arm
  • modes: train or inference
  • submodels: cnn1d, pixelcnn

Original

Dilated 1D Convolution Model Result

PixelCNN Model Result

References

Flow-based Model

Flow-based models learn an invertible transformation between the data distribution and a simple prior distribution, enabling efficient sampling and density estimation.

  • model: flow
  • modes: train or inference
  • submodels: realnvp

Original

RealNVP Model Result

References

Generative Adversarial Networks (GAN)

GANs consist of a generator and a discriminator that are trained together in a two-player adversarial game.

  • model: gan
  • modes: train or inference
  • submodels: lingan

Original

GAN Model with linear layers Result

References

Variational Autoencoders (VAE)

VAEs are generative models that learn a probabilistic mapping between data and latent spaces by optimizing the ELBO, providing an efficient way to learn complex data distributions.

  • model: vae
  • modes: train or inference
  • submodels: mlp

Original

VAE with linear layers Result

Diffusion Models

Diffusion models generate data using a series of Gaussian diffusion processes, with a forward diffusion process and a reverse denoising process to optimize the ELBO.

  • model: diffusion
  • modes: train or inference
  • submodels: naive-lin or ddm-unet

Original

Naive Diffusion Model with linear layers Result

Deep Denoising Diffusion Model with U-Net Result

References

About

showcases my work on various generative models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published