/vae

Auto-Encoding Variational Bayes Implementation

Primary LanguageJupyter Notebook

Auto-Encoding Variational Bayes

Original Paper: link

Installation

  • Recommend using an virtual environment to run
pip install -r requirements.txt

Run

Data set

Go to Kaggle MNIST Dataset and download Extract data file to get mnist.matdata file.

For Linux Shell
unzip archive.zip 

Start to train the encoder and decoder

usage: python train.py [-h] -d DATA [-hd HIDDEN] [-ld LATENT] [-lr LEARNING] [-e EPOCHS] [-b BATCH_SIZE] [-m MODEL]

optional arguments:
  -h, --help            show this help message and exit
  -d DATA, --data DATA  path/to/train/data
  -hd HIDDEN, --hidden HIDDEN
                        number of hidden unit
  -ld LATENT, --latent LATENT
                        number of latent unit
  -lr LEARNING, --learning LEARNING
                        learning rate
  -e EPOCHS, --epochs EPOCHS
                        epochs
  -b BATCH_SIZE, --batch_size BATCH_SIZE
                        Batch size
  -m MODEL, --model MODEL
                        path/to/model/saving/location

After training

# Model class must be defined somewhere
model = torch.load("path/to/model/file/located")
model.eval()