← Open Source
nadavbh12

VQ-VAE

Minimalist implementation of VQ-VAE in Pytorch.

Model DevelopmentArchitecturePython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
560
Stars
88
Forks
+0
This week
4
Contributors
Created 2017-12-24 · Updated 2026-09-04 · #17025 today
Top developers
nadavbh12AI-Huangjadore801120
README

CVAE and VQ-VAE

This is an implementation of the VQ-VAE (Vector Quantized Variational Autoencoder) and Convolutional Varational Autoencoder. from Neural Discrete representation learning for compressing MNIST and Cifar10. The code is based upon pytorch/examples/vae.

pip install -r requirements.txt
python main.py

requirements

  • Python 3.6 (maybe 3.5 will work as well)
  • PyTorch 0.4
  • Additional requirements in requirements.txt

Usage

# For example
python3 main.py --dataset=cifar10 --model=vqvae --data-dir=~/.datasets --epochs=3

Results

All images are taken from the test set. Top row is the original image. Bottom row is the reconstruction.

k - number of elements in the dictionary. d - dimension of elements in the dictionary (number of channels in bottleneck).

  • MNIST (k=10, d=64)

  • CIFAR10 (k=128, d=256)

  • Imagenet (k=512, d=128)

TODO:

  • [ ] Implement Continuous Relaxation Training of Discrete Latent Variable Image Models

  • [ ] Sample using PixelCNN prior

  • [ ] Improve results on cifar - nearest neighbor should be performed to 10 dictionaries rather than 1

  • [ ] Improve results on cifar - replace MSE with NLL

  • [ ] Improve results on cifar - measure bits/dim

  • [ ] Compare architecture with the offical one

  • [x] Merge VAE and VQ-VAE for MNIST and Cifar to one script

Acknowledgement

tf-vaevae for a good reference.

Nearby in the ranking
Similar items