All Projects → Chung-I → Variational Recurrent Autoencoder Tensorflow

Chung-I / Variational Recurrent Autoencoder Tensorflow

A tensorflow implementation of "Generating Sentences from a Continuous Space"

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Variational Recurrent Autoencoder Tensorflow

Pytorch Vae
A CNN Variational Autoencoder (CNN-VAE) implemented in PyTorch
Stars: ✭ 181 (-20.61%)
Mutual labels:  vae, variational-autoencoder
Vae For Image Generation
Implemented Variational Autoencoder generative model in Keras for image generation and its latent space visualization on MNIST and CIFAR10 datasets
Stars: ✭ 87 (-61.84%)
Mutual labels:  vae, variational-autoencoder
Variational Autoencoder
Variational autoencoder implemented in tensorflow and pytorch (including inverse autoregressive flow)
Stars: ✭ 807 (+253.95%)
Mutual labels:  vae, variational-autoencoder
Tensorflow Mnist Vae
Tensorflow implementation of variational auto-encoder for MNIST
Stars: ✭ 422 (+85.09%)
Mutual labels:  vae, variational-autoencoder
Vae Tensorflow
A Tensorflow implementation of a Variational Autoencoder for the deep learning course at the University of Southern California (USC).
Stars: ✭ 117 (-48.68%)
Mutual labels:  vae, variational-autoencoder
Tensorflow Vae Gan Draw
A collection of generative methods implemented with TensorFlow (Deep Convolutional Generative Adversarial Networks (DCGAN), Variational Autoencoder (VAE) and DRAW: A Recurrent Neural Network For Image Generation).
Stars: ✭ 577 (+153.07%)
Mutual labels:  recurrent-neural-networks, vae
Vae protein function
Protein function prediction using a variational autoencoder
Stars: ✭ 57 (-75%)
Mutual labels:  vae, variational-autoencoder
Tensorflow Generative Model Collections
Collection of generative models in Tensorflow
Stars: ✭ 3,785 (+1560.09%)
Mutual labels:  vae, variational-autoencoder
Mojitalk
Code for "MojiTalk: Generating Emotional Responses at Scale" https://arxiv.org/abs/1711.04090
Stars: ✭ 107 (-53.07%)
Mutual labels:  vae, variational-autoencoder
Smrt
Handle class imbalance intelligently by using variational auto-encoders to generate synthetic observations of your minority class.
Stars: ✭ 102 (-55.26%)
Mutual labels:  vae, variational-autoencoder
Awesome Vaes
A curated list of awesome work on VAEs, disentanglement, representation learning, and generative models.
Stars: ✭ 418 (+83.33%)
Mutual labels:  vae, variational-autoencoder
Tensorflow Mnist Cvae
Tensorflow implementation of conditional variational auto-encoder for MNIST
Stars: ✭ 139 (-39.04%)
Mutual labels:  vae, variational-autoencoder
Disentangling Vae
Experiments for understanding disentanglement in VAE latent representations
Stars: ✭ 398 (+74.56%)
Mutual labels:  vae, variational-autoencoder
Cada Vae Pytorch
Official implementation of the paper "Generalized Zero- and Few-Shot Learning via Aligned Variational Autoencoders" (CVPR 2019)
Stars: ✭ 198 (-13.16%)
Mutual labels:  vae, variational-autoencoder
Pytorch Rl
This repository contains model-free deep reinforcement learning algorithms implemented in Pytorch
Stars: ✭ 394 (+72.81%)
Mutual labels:  vae, variational-autoencoder
Variational Autoencoder
PyTorch implementation of "Auto-Encoding Variational Bayes"
Stars: ✭ 25 (-89.04%)
Mutual labels:  vae, variational-autoencoder
classifying-vae-lstm
music generation with a classifying variational autoencoder (VAE) and LSTM
Stars: ✭ 27 (-88.16%)
Mutual labels:  vae, variational-autoencoder
S Vae Pytorch
Pytorch implementation of Hyperspherical Variational Auto-Encoders
Stars: ✭ 255 (+11.84%)
Mutual labels:  vae, variational-autoencoder
Python World
Stars: ✭ 98 (-57.02%)
Mutual labels:  vae, variational-autoencoder
Deep Learning With Python
Example projects I completed to understand Deep Learning techniques with Tensorflow. Please note that I do no longer maintain this repository.
Stars: ✭ 134 (-41.23%)
Mutual labels:  vae, variational-autoencoder

Gerating Sentences from a Continuous Space

Tensorflow implementation of Generating Sentences from a Continuous Space.

Prerequisites

  1. Python packages:
    • Python 3.4 or higher
    • Tensorflow r0.12
    • Numpy

Setting up the environment:

  1. Clone this repository:
git clone https://github.com/Chung-I/Variational-Recurrent-Autoencoder-Tensorflow.git
  1. Set up conda environment:
conda create -n vrae python=3.6
conda activate vrae
  1. Install python package requirements:
pip install -r requirements.txt

Usage

Training:

python vrae.py  --model_dir models --do train --new True

Reconstruct:

python vrae.py --model_dir models --do reconstruct --new False --input input.txt --output output.txt

Sample (this script read only the first line of input.txt, generate num_pts samples, and write them into output.txt):

python vrae.py --model_dir models --do sample --new False --input input.txt --output output.txt

Interpolate (this script requires that input.txt consists of only two sentences; it generate num_pts interpolations between them, and write those interpolated sentences into output.txt)::

python vrae.py --model_dir models --do interpolate --new False --input input.txt --output output.txt

model_dir: The location of the config file config.json and the checkpoint file.

do: Accept 4 values: train, encode_decode, sample, or interpolate.

new: create models with fresh parameters if set to True; else read model parameters from checkpoints in model_dir.

config.json

Hyperparameters are not passed from command prompt like that in tensorflow/models/rnn/translate/translate.py. Instead, vrae.py reads hyperparameters from config.json in model_dir.

Below are hyperparameters in config.json:

  • model:

    • size: embedding size, and encoder/decoder state size.
    • latent_dim: latent space size.
    • in_vocab_size: source vocabulary size.
    • out_vocab_size: target vocabulary size.
    • data_dir: path to the corpus.
    • num_layers: number of layers for encoder and decoder.
    • use_lstm: use lstm for encoder and decoder or not. Use BasicLSTMCell if set to True; else GRUCell is used.
    • buckets: A list of pairs of [input size, output size] for each bucket.
    • bidirectional: bidirectional_rnn is used if set to True.
    • probablistic: variance is set to zero if set to False.
    • orthogonal_initializer: orthogonal_initializer is used if set to True; else uniform_unit_scaling_initializer is used.
    • iaf: inverse autoregressive flow is used if set to True.
    • activation: activation for encoder-to-latent layer and latent-to-decoder layer.
      • elu: exponential linear unit.
      • prelu: parametric linear unit. (default)
      • None: linear.
  • train:

    • batch_size
    • beam_size: beam size for decoding. Warning: beam search is still under implementation. NotImplementedError would be raised if beam_size is set to be greater than 1.
    • learning_rate: learning rate parameter passed into AdamOptimizer.
    • steps_per_checkpoint: save checkpoint every steps_per_checkpoint steps.
    • anneal: do KL cost annealing if set to True.
    • kl_rate_rise_factor: KL term weight is increasd by this much every steps_per_checkpoint steps.
    • max_train_data_size: Limit on the size of training data (0: no limit).
    • feed_previous: If True, only the first of decoder_inputs will be used (the "GO" symbol), and all other decoder inputs will be generated by: next = embedding_lookup(embedding, argmax(previous_output)). In effect, this implements a greedy decoder. It can also be used during training to emulate http://arxiv.org/abs/1506.03099. If False, decoder_inputs are used as given (the standard decoder case).
    • kl_min: the minimum information constraint. Should be a non-negative float (where 0 is no constraint).
    • max_gradient_norm: gradients will be clipped to maximally this norm.
    • word_dropout_keep_prob: probability of randomly replacing some fraction of the conditioned-on word tokens with the generic unknown word token UNK. when equal to 0, the decoder sees no input.
  • reconstruct:

    • feed_previous
    • word_dropout_keep_prob
  • sample:

    • feed_previous
    • word_dropout_keep_prob
    • num_pts: sample num_pts points.
  • interpolate:

    • feed_previous
    • word_dropout_keep_prob
    • num_pts: sample num_pts points.

Data

Penn TreeBank corpus is included in the repo. We also provide a Chinese poem corpus, its preprocessed version (set {"model":{"data_dir": "<corpus_dir>"}} in <model_dir>/config.json to it), and its pretrained model (set model_dir to it), all of which can be found here.

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].