All Projects → openai → Iaf

openai / Iaf

Licence: mit
Code for reproducing key results in the paper "Improving Variational Inference with Inverse Autoregressive Flow"

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Iaf

Bestofml
The best resources around Machine Learning
Stars: ✭ 349 (-25.43%)
Mutual labels:  paper
Slimefun4
Slimefun 4 - A unique Spigot/Paper plugin that looks and feels like a modpack. We've been giving you backpacks, jetpacks, reactors and much more since 2013.
Stars: ✭ 369 (-21.15%)
Mutual labels:  paper
Paper For Mac
🖥 Unofficial Dropbox Paper client for macOS
Stars: ✭ 427 (-8.76%)
Mutual labels:  paper
Inception V4
Inception-v4, Inception - Resnet-v1 and v2 Architectures in Keras
Stars: ✭ 350 (-25.21%)
Mutual labels:  paper
Vsepp
PyTorch Code for the paper "VSE++: Improving Visual-Semantic Embeddings with Hard Negatives"
Stars: ✭ 354 (-24.36%)
Mutual labels:  paper
Ipfs
Peer-to-peer hypermedia protocol
Stars: ✭ 20,128 (+4200.85%)
Mutual labels:  paper
Cyclegan
Tensorflow implementation of CycleGAN
Stars: ✭ 348 (-25.64%)
Mutual labels:  paper
Jukebox
Code for the paper "Jukebox: A Generative Model for Music"
Stars: ✭ 4,863 (+939.1%)
Mutual labels:  paper
Optnet
OptNet: Differentiable Optimization as a Layer in Neural Networks
Stars: ✭ 361 (-22.86%)
Mutual labels:  paper
Knowledge Distillation Papers
knowledge distillation papers
Stars: ✭ 422 (-9.83%)
Mutual labels:  paper
Tg Reading List
A text generation reading list maintained by Tsinghua Natural Language Processing Group.
Stars: ✭ 352 (-24.79%)
Mutual labels:  paper
Benchmark results
Visual Tracking Paper List
Stars: ✭ 3,672 (+684.62%)
Mutual labels:  paper
Learning Deep Learning
Paper reading notes on Deep Learning and Machine Learning
Stars: ✭ 388 (-17.09%)
Mutual labels:  paper
Action Recognition Visual Attention
Action recognition using soft attention based deep recurrent neural networks
Stars: ✭ 350 (-25.21%)
Mutual labels:  paper
Research Method
论文写作与资料分享
Stars: ✭ 436 (-6.84%)
Mutual labels:  paper
Weightnorm
Example code for Weight Normalization, from "Weight Normalization: A Simple Reparameterization to Accelerate Training of Deep Neural Networks"
Stars: ✭ 347 (-25.85%)
Mutual labels:  paper
Musicgenreclassification
Classify music genre from a 10 second sound stream using a Neural Network.
Stars: ✭ 377 (-19.44%)
Mutual labels:  paper
Awsome Deep Learning For Video Analysis
Papers, code and datasets about deep learning and multi-modal learning for video analysis
Stars: ✭ 452 (-3.42%)
Mutual labels:  paper
Cvpr2021 Papers With Code
CVPR 2021 论文和开源项目合集
Stars: ✭ 7,138 (+1425.21%)
Mutual labels:  paper
Yatopia
The Most Powerful and Feature Rich Minecraft Server Software!
Stars: ✭ 408 (-12.82%)
Mutual labels:  paper

Status: Archive (code is provided as-is, no updates expected)

Improve Variational Inference with Inverse Autoregressive Flow

Code for reproducing key results in the paper Improving Variational Inference with Inverse Autoregressive Flow by Diederik P. Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling.

Prerequisites

  1. Make sure that recent versions installed of:

    • Python (version 2.7 or higher)
    • Numpy (e.g. pip install numpy)
    • Theano (e.g. pip install Theano)
  2. Set floatX = float32 in the [global] section of Theano config (usually ~/.theanorc). Alternatively you could prepend THEANO_FLAGS=floatX=float32 to the python commands below.

  3. Clone this repository, e.g.:

git clone https://github.com/openai/iaf.git
  1. Download the CIFAR-10 dataset (get the Python version) and create an environment variable CIFAR10_PATH that points to the subdirectory with CIFAR-10 data. For example:
export CIFAR10_PATH="$HOME/cifar-10"

Syntax of train.py

Example:

python train.py with problem=cifar10 n_z=32 n_h=64 depths=[2,2,2] margs.depth_ar=1 margs.posterior=down_iaf2_NL margs.kl_min=0.25

problem is the problem (dataset) to train on. I only tested cifar10 for this release.

n_z is the number of stochastic featuremaps in each layer.

n_h is the number of deterministic featuremaps used throughout the model.

depths is an array of integers that denotes the depths of the levels in the model. Each level is a sequence of layers. Each subsequent level operates over spatially smaller featuremaps. In case of CIFAR-10, the first level operates over 16x16 featuremaps, the second over 8x8 featuremaps, etc.

Some possible choices for margs.posterior are:

  • up_diag: bottom-up factorized Gaussian
  • up_iaf1_nl: bottom-up IAF, mean-only perturbation
  • up_iaf2_nl: bottom-up IAF
  • down_diag: top-down factorized Gaussian
  • down_iaf1_nl: top-down IAF, mean-only perturbation
  • down_iaf2_nl: top-down IAF

margs.depth_ar is the number of hidden layers within IAF, and can be any non-negative integer.

margs.kl_min: the minimum information constraint. Should be a non-negative float (where 0 is no constraint).

Results of Table 3

(3.28 bits/dim)

python train.py with problem=cifar10 n_h=160 depths=[10,10] margs.depth_ar=2 margs.posterior=down_iaf2_nl margs.prior=diag margs.kl_min=0.25

More instructions will follow.

Multi-GPU TensorFlow implementation

Prerequisites

Make sure that recent versions installed of:

  • Python (version 2.7 or higher)
  • TensorFlow
  • tqdm

CIFAR10_PATH environment variable should point to the dataset location.

Syntax of tf_train.py

Training script:

python tf_train.py --logdir <logdir> --hpconfig depth=1,num_blocks=20,kl_min=0.1,learning_rate=0.002,batch_size=32 --num_gpus 8 --mode train

It will run the training procedure on a given number of GPUs. Model checkpoints will be stored in <logdir>/train directory along with TensorBoard summaries that are useful for monitoring and debugging issues.

Evaluation script:

python tf_train.py --logdir <logdir> --hpconfig depth=1,num_blocks=20,kl_min=0.1,learning_rate=0.002,batch_size=32 --num_gpus 1 --mode eval_test

It will run the evaluation on the test set using a single GPU and will produce TensorBoard summary with the results and generated samples.

To start TensorBoard:

tensorboard --logdir <logdir>

For the description of hyper-parameters, take a look at get_default_hparams function in tf_train.py.

Loading from the checkpoint

The best IAF model trained on CIFAR-10 reached 3.15 bits/dim when evaluated with a single sample. With 10,000 samples, the estimation of log likelihood is 3.111 bits/dim. The checkpoint is available at link. Steps to use it:

  • download the file
  • create directory <logdir>/train/ and copy the checkpoint there
  • run the following command:
python tf_train.py --logdir <logdir> --hpconfig depth=1,num_blocks=20,kl_min=0.1,learning_rate=0.002,batch_size=32 --num_gpus 1 --mode eval_test

The script will run the evaluation on the test set and generate samples stored in TensorFlow events file that can be accessed using TensorBoard.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].