Giter VIP home page Giter VIP logo

variationalrecurrentneuralnetwork's Introduction

VariationalRecurrentNeuralNetwork

Pytorch implementation of the Variational RNN (VRNN), from A Recurrent Latent Variable Model for Sequential Data.

The paper is available here.

png

Run:

To train: python train.py

To sample with saved model: python sample.py [saves/saved_state_dict_name.pth]

Some samples:

png

variationalrecurrentneuralnetwork's People

Contributors

aniekan-u avatar emited avatar nekki97 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

variationalrecurrentneuralnetwork's Issues

The dim of the data

When load the data from the dataloader, the dim is transposed:
data = Variable(data.squeeze().transpose(0, 1)).to(device)
So in model.py line 82

 for t in range(x.size(0)):

	phi_x_t = self.phi_x(x[t])

the size of phi_x_t is ( batch_size, h_dim ), is that correct ?

i have some question

Error message :

Done!
Traceback (most recent call last):
File "train.py", line 112, in
train(epoch)
File "train.py", line 25, in train
data = (data - data.min().data[0]) / (data.max().data[0] - data.min().data[0])
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

so , I changed the code (as below)

data.min().data[0] -> data.min()

*.data[0] -> *.item() ( * Denotes all variables that use data [0].)

Does this deviate from your intention in your code? @emited

nll loss maybe got nan

the code
def _nll_bernoulli(self, theta, x): return - torch.sum(x*torch.log(theta + EPS) + (1-x)*torch.log(1-theta-EPS)) may got nan loss.
i think it should be
def _nll_bernoulli(self, theta, x): return - torch.sum(x*torch.log(theta + EPS) + (1-x)*torch.log(1-theta+EPS))

loss got nan.

Train Epoch: 3 [0/60000 (0%)] KLD Loss: 2.687659 NLL Loss: 73.599564
Train Epoch: 3 [2800/60000 (21%)] KLD Loss: 2.976363 NLL Loss: 78.757454
Train Epoch: 3 [5600/60000 (43%)] KLD Loss: 2.837864 NLL Loss: 78.958122
Train Epoch: 3 [8400/60000 (64%)] KLD Loss: nan NLL Loss: nan
Train Epoch: 3 [11200/60000 (85%)] KLD Loss: nan NLL Loss: nan
====> Epoch: 3 Average loss: nan
====> Test set loss: KLD Loss = nan, NLL Loss = nan
Train Epoch: 4 [0/60000 (0%)] KLD Loss: nan NLL Loss: nan

License for the code

Hi,

Can you attach a license for the code so it's easier for others to reuse? Thank you very much.

Repackaging of states necessary?

Hi,

in the VRNN class (in model.py), you cut the gradients behind h_{t-1} using the _repackage_state() function.
I've been thinking about this question for a while now and would have said that the correct thing to do is to not cut the gradients because nothing in the paper indicates that one should.

May I ask what your reasoning is? - I'm not very sure about mine.

Thanks!
Best, Max

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.