Tensorflow Implementation of Neural Conversational Model by Vinyals et.al. - http://arxiv.org/pdf/1506.05869v3.pdf
Includes optimizations like TFRecords, dynamic_rnn implementation and pretrained word-embeddings to speed up training. Trained on the excellently formated Cornell Movie Dialogure corpus available at - http://www.cs.cornell.edu/~cristian/Cornell_Movie-Dialogs_Corpus.html
####PRE-REQUISITES:
-
Tensorflow
-
CUDNN, CUDA
-
Python's NLTK package
-
Stanford's Pretrained GloVe Vectors available here. Code currently only supports 300-dim vectors
-
Cornell's Movie Dialog dataset
####HOW TO RECREATE : Requires a Tensorflow supported GPU. CPU version not supported. With all pre-requisites installed
-
In
loadWordVecs.py
set paths to downloaded GloVe file and output path in functiongenerateWordDict
, -
CUDA_VISIBLE_DEVICES=1 python chatbot.py
####RESUME TRAINING WITH SAVED CHECKPOINT FILE :
CUDA_VISIBLE_DEVICES=1 python chaatbot.py --run-mode 0 --load-chkpt <path to valid checkpoint file>
####TO EVALUATE (Requires a checkpoint file):
NOTE : Currently out of vocabulary words are not supported. So for some inputs (some proper nouns, uncommon words) it will throw an error. Will add support soon.
CUDA_VISIBLE_DEVICES=1 python chaatbot.py --run-mode 1 --load-chkpt <path to valid checkpoint file>
####EXAMPLE CONVERSATIONS AFTER ROUGHLY 8 EPOCHS :
Convo 1:
User : Hi!
Chatty: Hi, Charlie
Convo 2:
User : How are you?
Chatty : I'm not sure.
Convo 3:
User : Are you alive?
Chatty : I'm not going to hurt you.
User : ... (quietly backs out of chat)
NOTE : The example conversations were slightly edited to correct misspellings (ex: "I' m") in the training corpus hence the learnt vocabulary. But otherwise unaltered in any way.