Git Product home page Git Product logo

text-rnn-keras's Introduction

text-rnn-keras

Tutorial: Multi-layer Recurrent Neural Networks (LSTM) for text models in Python using Keras.

Before going through this tutorial, I suggest to read the very very good blog note from Andrej Karpathy: http://karpathy.github.io/2015/05/21/rnn-effectiveness/

Requirements

Training Tutorial

The project has train.py script.

The script generate and save locally a model and text features.

Just run it using python train.py some items can be modified by editing the script:

  • data_dir = 'data/Artistes_et_Phalanges-David_Campion'# data directory containing input.txt
  • save_dir = 'save' # directory to store models
  • rnn_size = 128 # size of RNN
  • batch_size = 30 # minibatch size
  • seq_length = 15 # sequence length
  • num_epochs = 8 # number of epochs
  • learning_rate = 0.001 #learning rate
  • sequences_step = 1 #step to create sequences

note: 8 epochs is cleraly not enough. Should be above 25.

Text generation Tutorial

The project has a generate,py script.

Just run it using python generate.py some items can be modified by editing the script:

  • save_dir = 'save' # directory where model is stored
  • batch_size = 30 # minibatch size
  • seq_length = 25 # sequence length
  • words_number = 400 #number of words to generate
  • seed_sentences = "Il y a" #sentence for seed generation

additional notes

The project comes with two types of input:

  • data/tinyshakespeare/input.txt:
    • a small condensate of Shakespeare books
  • data/Artistes_et_Phalanges-David_campion/input.txt:
    • The complete text of a french fantasy book "Artistes et Phalanges", by David Campion
    • This file book is under the following licence: Licence Creative Commons CC BY-NC-ND

text-rnn-keras's People

Contributors

nrv avatar campdav 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.