Skip to content

Instantly share code, notes, and snippets.

@titipata
Last active December 18, 2015 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save titipata/cd53b3332cf78a832e87 to your computer and use it in GitHub Desktop.
Save titipata/cd53b3332cf78a832e87 to your computer and use it in GitHub Desktop.

#Dowload IMDB data for LSTM example

Here is a snippet to download python code and imdb.pkl

wget http://deeplearning.net/tutorial/code/imdb.py
wget http://deeplearning.net/tutorial/code/lstm.py
wget http://www.iro.umontreal.ca/~lisa/deep/data/imdb.pkl

Then in Python

import imdb
train, valid, test = imdb.load_data(path='imdb.pkl', 
                                    n_words=10000, valid_portion=0.05,
                                    maxlen=100)

Create LSTM model using TensorFlow

import imdb
import numpy as np
import tensorflow as tf
from tensorflow.models.rnn import rnn_cell

lstm_size = 100
lstm = rnn_cell.BasicLSTMCell(lstm_size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment