Skip to content

Text Generation using basic RNN from scratch using Python and Numpy.

Notifications You must be signed in to change notification settings

anujdutt9/Language-Model-using-RNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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
Anyway, to the city scene you’re an idiot teenager.
What ? ! ! ! ! ignore!
Screw fitness, you’re saying: https
Thanks for the advice to keep my thoughts around girls.
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

About

Text Generation using basic RNN from scratch using Python and Numpy.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages