Giter Club home page Giter Club logo

keras-rnn-demo's Introduction

keras-rnn-demo

A brief tutorial that uses Keras to build a basic Recurrent Neural Network Language Model and uses it generate new sentences in stories.

You'll need IPython/Jupyter to run the notebook (keras_rnn_generation.ipynb) or alternatively the regular Python file is provided. To run the code you'll need Keras, as well as either TensorFlow or Theano as the backend for Keras (the most recent version of Keras uses TensorFlow by default so you'll need to configure it if you want to use Theano). The other requirements are Numpy and h5py.

The dataset used in this tutorial is the ROCStories corpus. You'll just need to complete a form to get access to the full dataset, but a sample of it is contained in example_train_stories.csv and example_test_stories.csv. The tutorial loads these files so just swap them out with the ROC dataset files when you download them (you'll need to do just a few lines of pre-processing to remove the header and IDs).

In given code with the example datasets, the tokenizer and trained model weights are saved to 'example_tokenizer.pkl' and 'example_rnn_weights.h5', respectively. However, for demonstrating generation, I load the weights from an already trained model (too large to fit on Github), rnn_weights_96000.h5, that was trained on 96,0000 stories in the ROCStories corpus. The accompanying tokenizer for pre-processing is tokenizer_96000.pkl. You should be able to download these files and run the generation code as is, or of course just swap them out with your own trained model files.

keras-rnn-demo's People

Contributors

roemmele avatar

Watchers

James Cloos avatar  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.