Code Monkey home page Code Monkey logo

vae-text-generation's Introduction

VAE-Text-Generation

Implementation of "Generating Sentences from a Continuous Space" paper using pytorch and torchtext. Generate sentences based on imdb review dataset

Prerequisites

  • Python 2.7
  • Pytorch 0.4.0
  • Torchtext 0.2.0

Needed

pyenv install 3.6.9 3.7.10 3.8.9 3.9.4 3.10a7 python -m venv .venv . .venv/bin/activate pip install -r requirements.txt

Data

Data can be found at data/imdb where I have splitted imdb review paras into sentences, picked those with word count more than 5 and less than 20, splitted them into train set and test set based on 7:3 ratio. In total, there are around 5.5 lakh training sentences and 2.4 lakh testing sentences

Training

To train the model from the beginning, run:

python main.py

To resume training from a saved model, run:

python main.py --resume_training=True

Testing

To generate samples from a saved model, run:

python main.py --to_train=False

Notice that if you try to generate a sample from model which is not trained enough, it might generate sentences with words greater than 20.

Samples with default configuration and after 120 epochs:

<sos> i highly recommend this movie for horror fans. <eos>
<sos> these are not what kids will always like. <eos>
<sos> but for me alone 3 d enough to make it more excellent effects than the first <unk> <eos>
<sos> they still <unk> young children. <eos>
<sos> so the movie has all those ways home take your parents kids to watch it. <eos>
<sos> better on for the three for good disgusting stuff. <eos>
<sos> there is a lot of things about the film again seem it seem like it drags along. <eos>
<sos> when you need your health watch movies you have just seen in good movies. <eos>
<sos> in fact it a marvel for the city of <unk> of humanity. <eos>
<sos> i loved the surreal sense of music we see in the car still. <eos>
<sos> running from the story takes an interesting and unexpected outcome. <eos>
<sos> i like robert de niro in one of ridley scott semi <unk> movies ever day godzilla vs <unk> . <eos>
<sos> cruise and jolie both capture their into and are very entertaining. <eos>
<sos> the objects have caught me in years. <eos>
<sos> hugh jackman is a cop who ends up there with kingdom to harold and the song <eos>
<sos> why not waste the sorry guys <eos>
<sos> in fact he could not save much of a script it a musical. <eos>
<sos> to the weird parents first impressions <eos>
<sos> this film is not for everybody. <eos>
<sos> actually he is not as witty as he can be a person <unk> a <unk> police <unk> <eos>
<sos> his dialogue was a bit stiff and heavy of the film. <eos>
<sos> there is not much excitement here. <eos>
<sos> it should not be a sequel. <eos>
<sos> controversy is a blockbuster that has gone through and that what a surprise to it. <eos>
<sos> is there those looking united that <unk> missing a <unk> one thing <eos>
<sos> it might be rather confusing when the first marvel movie left to hell looked at. <eos>
<sos> and the <unk> of our penguins play properly giving <unk> cool feeling now that too well. <eos>
<sos> it is an incredible movie. <eos>
<sos> and yet the characters are has a variety of charm with multi <unk> <eos>
<sos> this does not star kurt russell but <unk> allows him what amounts to an extended cameo. <eos>
<sos> but when it fun for what it is. <eos>
<sos> every single theme is the same. <eos>
<sos> right and filled with a <unk> uncomfortable moments. <eos>
<sos> there are always familiar faces in the superman 2004 . <eos>

vae-text-generation's People

Contributors

rohithreddy024 avatar

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.