karpathy / char-rnn

Multi-layer Recurrent Neural Networks (LSTM, GRU, RNN) for character-level language models in Torch
11.53k stars 2.58k forks source link

How to use a trained char-based RNN language model? #161

Closed coodoo closed 8 years ago

coodoo commented 8 years ago

A dumb question, after training a char-based RNN language model with large data set (say millions of words), how could one utilize the model for different tasks like sentiment analysis?

Most of the exampels I've seen so far combined model training and sentiment analysis in one go (normally a LookupTable as the first layer for word embeddings then two LSTM layers after it...etc), I was wondering wouldn't it be more efficient to reuse a pre-trained RNN model and repurpose it for classification tasks?

Is it possible and how? Thanks!

Here are some sentiment analysis examples: https://github.com/Element-Research/rnn/blob/master/examples/sequence-to-one.lua https://github.com/fchollet/keras/blob/master/examples/imdb_lstm.py

coodoo commented 8 years ago

Solved