Recurrent Neural Network Tutorial, Part 2 - Implementing a RNN in Python and Theano
Jupyter Notebook Python
Latest commit 387f6dc Jun 8, 2016 @dennybritz Merge pull request #6 from darksnakezero/master
Apache License

Please read the blog post that goes with this code!

Jupyter Notebook Setup

System Requirements:

To start the Jupyter Notebook:

# Clone the repo
git clone
cd rnn-tutorial-rnnlm

# Create a new virtual environment (optional, but recommended)
virtualenv venv
source venv/bin/activate

# Install requirements
pip install -r requirements.txt
# Start the notebook server
jupyter notebook

Setting up a CUDA-enabled GPU instance on EC2:

# Install build tools
sudo apt-get update
sudo apt-get install -y build-essential git python-pip libfreetype6-dev libxft-dev libncurses-dev libopenblas-dev  gfortran python-matplotlib libblas-dev liblapack-dev libatlas-base-dev python-dev python-pydot linux-headers-generic linux-image-extra-virtual
sudo pip install -U pip

# Install CUDA 7
sudo dpkg -i cuda-repo-ubuntu1410_7.0-28_amd64.deb
sudo apt-get update
sudo apt-get install -y cuda
sudo reboot

# Clone the repo and install requirements
git clone
cd nn-theano
sudo pip install -r requirements.txt

# Set Environment variables
export CUDA_ROOT=/usr/local/cuda-7.0
export PATH=$PATH:$CUDA_ROOT/bin
export THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32
# For profiling only

# Startup jupyter noteboook
jupyter notebook

To start a public notebook server that is accessible over the network you can follow the official instructions.