GithubHelp home page GithubHelp logo

sscorpio93 / multiplicative-lstm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pickou/multiplicative-lstm

0.0 1.0 0.0 570.09 MB

Use tensorflow to implement multiplicative lstm, and try this on text generation.

Python 100.00%

multiplicative-lstm's Introduction

An implementation of mLSTM

This code use mlstm to generate text. TF 1.4.0, Python 2.7 and Python 3.5.

1. file desicription

  • MultiplicativeLSTMCell.py

The core is written by tam17aki, https://github.com/tam17aki/multiplicative-lstm-tensorflow

His implementation is based on the following paper:

Ben Krause, Liang Lu, Iain Murray, and Steve Renals, "Multiplicative LSTM for sequence modelling, " in Workshop Track of ICLA 2017, https://openreview.net/forum?id=SJCS5rXFl&noteId=SJCS5rXFl

  • mlstm.py

This is an implementation which uses mLSTM to predict the next character of a sentence.

  • train_gentext.py

Train and generate text with the starting sentence "This morning", the restore process is right after training.

  • load_gentext.py

Load checkpoint and restore parameters, then generate text.

2. result

  • using python2 to run train_gentext.py and load_gentext.py

train_gentext.py result, the text make sense.

('Training epoch: 2/2***', 'Training steps: 500***', 'Training loss: 1.6599***', '0.8138 sec/per batch')
This morning how
so menty there a dingry was not be their conversnon had not been to to hor that they was not had been so would bating the sout. All at her to her some house, bown sacking at the saces and said of
 his
witches of the propission his hand of his husband.

"Well, all which his was as it as answained to and he saw. A drovin and with the money
have to delight.

"Yes, this the simply. That he w

load_gentext.py result, make sense.

This morning what who saw they wife to this. There and allet her tomer as his weatther to stall that the consed and sack that the bagh falt of
this who stept,
were to her ever were a troube, and sack that it was the sawe his heart, and that should
not that I would not see that it was it a to be
done when the counse, and a carting thought he could not
could not her his hadis with the mander of at a still

The code lies a bug in the use of set when encoding a word to int which caused the error that unreasonable results got when restore the graph and generate the next character.

And now everything's fine, and tensorflow has no issues on this.

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.