All Projects → google → Vae Seq

google / Vae Seq

Licence: apache-2.0
Variational Auto-Encoders in a Sequential Setting.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Vae Seq

A Hierarchical Latent Structure For Variational Conversation Modeling
PyTorch Implementation of "A Hierarchical Latent Structure for Variational Conversation Modeling" (NAACL 2018 Oral)
Stars: ✭ 153 (+5.52%)
Mutual labels:  rnn, vae
char-VAE
Inspired by the neural style algorithm in the computer vision field, we propose a high-level language model with the aim of adapting the linguistic style.
Stars: ✭ 18 (-87.59%)
Mutual labels:  rnn, vae
Attend infer repeat
A Tensorfflow implementation of Attend, Infer, Repeat
Stars: ✭ 82 (-43.45%)
Mutual labels:  rnn, vae
Torchsketch
Stars: ✭ 113 (-22.07%)
Mutual labels:  rnn
Char Rnn Pytorch
使用PyTorch实现Char RNN生成古诗和周杰伦的歌词
Stars: ✭ 114 (-21.38%)
Mutual labels:  rnn
Srl Zoo
State Representation Learning (SRL) zoo with PyTorch - Part of S-RL Toolbox
Stars: ✭ 125 (-13.79%)
Mutual labels:  vae
Vmf vae nlp
Code for EMNLP18 paper "Spherical Latent Spaces for Stable Variational Autoencoders"
Stars: ✭ 140 (-3.45%)
Mutual labels:  vae
Lstms.pth
PyTorch implementations of LSTM Variants (Dropout + Layer Norm)
Stars: ✭ 111 (-23.45%)
Mutual labels:  rnn
Rnn recsys
Our implementation of the paper "Embedding-based News Recommendation for Millions of Users"
Stars: ✭ 135 (-6.9%)
Mutual labels:  rnn
Kaggle Web Traffic
1st place solution
Stars: ✭ 1,641 (+1031.72%)
Mutual labels:  rnn
Rnn From Scratch
Use tensorflow's tf.scan to build vanilla, GRU and LSTM RNNs
Stars: ✭ 123 (-15.17%)
Mutual labels:  rnn
O Gan
O-GAN: Extremely Concise Approach for Auto-Encoding Generative Adversarial Networks
Stars: ✭ 117 (-19.31%)
Mutual labels:  vae
Chinese Chatbot
中文聊天机器人,基于10万组对白训练而成,采用注意力机制,对一般问题都会生成一个有意义的答复。已上传模型,可直接运行,跑不起来直播吃键盘。
Stars: ✭ 124 (-14.48%)
Mutual labels:  rnn
Pytorch cpp
Deep Learning sample programs using PyTorch in C++
Stars: ✭ 114 (-21.38%)
Mutual labels:  vae
Qrn
Query-Reduction Networks (QRN)
Stars: ✭ 137 (-5.52%)
Mutual labels:  rnn
Pytorch Rnn Text Classification
Word Embedding + LSTM + FC
Stars: ✭ 112 (-22.76%)
Mutual labels:  rnn
Lstm Crypto Price Prediction
Predicting price trends in cryptomarkets using an lstm-RNN for the use of a trading bot
Stars: ✭ 136 (-6.21%)
Mutual labels:  rnn
A Convolutional Recurrent Neural Network For Real Time Speech Enhancement
A minimum unofficial implementation of the "A Convolutional Recurrent Neural Network for Real-Time Speech Enhancement" (CRN) using PyTorch
Stars: ✭ 123 (-15.17%)
Mutual labels:  rnn
Linear Attention Recurrent Neural Network
A recurrent attention module consisting of an LSTM cell which can query its own past cell states by the means of windowed multi-head attention. The formulas are derived from the BN-LSTM and the Transformer Network. The LARNN cell with attention can be easily used inside a loop on the cell state, just like any other RNN. (LARNN)
Stars: ✭ 119 (-17.93%)
Mutual labels:  rnn
Midi Rnn
Generate monophonic melodies with machine learning using a basic LSTM RNN
Stars: ✭ 124 (-14.48%)
Mutual labels:  rnn

VAE-Seq

VAE-Seq is a library for modeling sequences of observations.

Background

One tool that's commonly used to model sequential data is the Recurrent Neural Network (RNN), or gated variations of it such as the Long Short-Term Memory cell or the Gated Recurrent Unit cell.

RNNs in general are essentially trainable transition functions: (input, state) -> (output, state'), and by themselves don't specify a complete model. We additionally need to specify a family of distributions that describes our observations; common choices here are Categorical distributions for discrete observations such as text or Normal distributions for real-valued observations.

The output of the RNN specifies the parameters of the observation distribution (e.g. the logits of a Categorical or the mean and variance of a Normal). But the size of the RNN output and the number of parameters that we need don't necessarily match up. To solve this, we project output into the appropriate shape via a Neural Network we'll call a decoder.

And what about the input of the RNN? It can be empty, but we might want to include side information from the environment (e.g. actions when modeling a game or a metronome when modeling music). Additionally, the observation from the previous step(s) is almost always an important feature to include. Here, we'll use another Neural Network we'll call an encoder to summarize the observation into a more digestible form.

Together, these components specify a factored (by time step) probability distribution that we can train in the usual way: by maximizing the probability of the network weights given the observations in your training data and your priors over those weights. Once trained, you can use ancestral sampling to generate new sequences.

Motivation

This library allows you to express the type of model described above. It handles the plumbing for you: you define the encoder, the decoder, and the observation distribution. The resulting model can be trained on a Dataset of observation sequences, queried for the probability of a given sequence, or queried to generate new sequences.

But the model above also has a limitation: the family of observation distributions we pick is the only source of non-determinism in the model. If it can't express the true distribution of observations, the model won't be able to learn or generate the true range of observation sequences. For example, consider a sequence of black/white images. If we pick the observation distribution to be a set of independent Bernoulli distributions over pixel values, the first generated image would always look like a noisy average over images in the training set. Subsequent images might get more creative since they are conditioned on a noisy input, but that depends on how images vary between steps in the training data.

The issue in the example above is that the observation distribution we picked wasn't expressive enough: pixels in an image aren't independent. One way to fix this is to design very expressive observation distributions that can model images. Another way is to condition the simple distribution on a latent variable to produce a hierarchical output distribution. This latter type of model is known as a Variational Auto encoder (VAE).

There are different ways to incorporate latent variables in a sequential model (see the supported architectures below) but the general approach we take here is to view the RNN state as a collection of stochastic and deterministic variables.

Usage

To define a model, subclass ModelBase to define an encoder, a decoder, and the output distribution. The decoder and output distribution are packaged together into a DistModule (see: vaeseq/codec.py).

The following model architectures are currently available (see: vaeseq/vae):

  • An RNN with no latent variables other than a deterministic state.
  • A VAE where the stochastic latent variables are independent across time steps.
  • An implementation of SRNN (https://arxiv.org/abs/1605.07571)

There are lots of hyper-parameters packaged into an HParams object (see: vaeseq/hparams.py). You can select among the architectures above by setting the vae_type parameter.

Examples

When you build and install this library via python setup.py install, the following example programs are installed as well. See: vaeseq/examples.

Text

A character-sequence model that can be used to generate nonsense text or to evaluate the probability that a given piece of text was written by a given author.

To train on Andrej Karpathy's "Tiny Shakespeare" dataset:

$ wget https://github.com/karpathy/char-rnn/raw/master/data/tinyshakespeare/input.txt
$ vaeseq-text train --log-dir /tmp/text --train-corpus input.txt \
    --num-steps 1000000

After training has completed, you can generate text:

$ vaeseq-text generate --log-dir /tmp/text --vocab-corpus input.txt \
    --length 1000
    --num-samples 20

Or you can tell how likely a piece of text is to be Shakespearean:

$ vaeseq-text evaluate --log-dir /tmp/text --vocab-corpus input.txt \
    --eval-corpus foo.txt

MIDI

Similar to the text example above, but now modeling MIDI music (specifically, piano rolls). Installed under vaeseq-midi. Don't expect it to sound great.

Play

An experiment modeling a game environment and using that to train an agent via policy gradient. This example uses the OpenAI Gym module. Installed under vaeseq-play.

Disclaimer

This is not an official Google product.

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