项目作者: anujdutt9

项目描述 :
Text Generation using basic RNN from scratch using Python and Numpy.
高级语言: Python
项目地址: git://github.com/anujdutt9/Language-Model-using-RNN.git
创建时间: 2017-04-14T21:35:49Z
项目社区:https://github.com/anujdutt9/Language-Model-using-RNN

开源协议:

下载


RNN Language Model

This repository contains the code for Language Model for Text Generation using RNN from scratch using Python and Numpy.

This code implements a basic Recurrent Neural Network for a Language Model that predicts the next word in a sentence and forms a final sentence using proper punctuations.

Note: Use this code to understand the underlaying concept from scratch that how a Language Model works using a RNN with Back Propagation through Time. Running of this code on the PC/Laptop is not advisable as it might take days or weeks to train and generate the text as the data size is large.

Requirements

  1. Python 3 and above
  2. Numpy

Usage

  1. python3 rnn_lm.py

Result

The following image shows the working of the code. This image shows the running of code on a small data of 1000 words from the main dataset. We can see that the loss decreases with each epoch. This proves that the code works fine and given the time and compute power, it can generate the text.

Output a1

  • Some generated text samples
    1. Anyway, to the city scene youre an idiot teenager.
    2. What ? ! ! ! ! ignore!
    3. Screw fitness, youre saying: https
    4. Thanks for the advice to keep my thoughts around girls.
    5. Yep, please disappear with the terrible generation.

Resources

S.No. Papers / Blogs / Authors Paper Links
1. Andrej Karpathy’s Blog “The Unreasonable Effectiveness of Recurrent Neural Networks” http://karpathy.github.io/2015/05/21/rnn-effectiveness/
2. Denny Britz’s Blog [WILDML] http://www.wildml.com/2015/09/recurrent-neural-networks-tutorial-part-1-introduction-to-rnns/
3. Hugo Larochelle’s Videos on NLP https://www.youtube.com/watch?v=OzZIOiMVUyM&list=PLSaRkipE5TJhNGgRrpRL180SZ1Mg-2jxT