Code Monkey home page Code Monkey logo

practical_seq2seq's Introduction

Seq2Seq Wrapper for Tensorflow

To make life easier for beginners looking to experiment with seq2seq model. Read the article I wrote on seq2seq - Practical seq2seq, for more details.

Datasets


Update

After tweaking the dataset to bring down the overall % of unknown tokens to 3%, increasing vocabulary to 8000, the results are promising.

Query Reply
donald trump won last nights presidential debate according to snap online polls thought he was a joke
trump campaign please never delete this he was a joke
s new scoop is unk the castro connection how trumps company violated the us embargo against cuba trump is a disgrace to the debate and the media is not a liar
who won the first presidential debate trump will be a better time for a man
just wanna live in unk everything is 10x better there i was just on the same side and i was like it was a good time
the lil girl i forgot her name scares the shit out of me n probably always will lmaooo she was so cute and she was so cute and she was a bitch
question of the day who do you think won last nights debate weigh in using hillary is a trump supporter and a woman who has a better job than a woman
trump is a total embarrassment hes like a unk child who happens to be a professional liar and con man trump is a lot of money to get a great country
chill the fuck out thats what i said
so fun to see what the special effects team created for wow that is the best thing ive ever seen
she was fine too unk voice she is a good guy
the important ones are still here i dont think so
been drinking pumpkin spice protein shake every morning for a week and now i literally cannot even me too i just got it
lmao i just lost my job and i cant even leave early to be in the unk video today literally the same thing
hey happy birthday have a nice day thank you

~4% unknown tokens in dataset; vocabulary of 8000.

Query Reply
when are you going to let the police know you dont know what youre talking about
you can do it yeah i think so
wait are you saying that i dont appreciate i know you know what i mean
youre terrible yeah but im not
nah i dont think so why not
hes pissing in our faces again and were just taking it i cant
im sorry i dont know what else to say except im sorry why would you like to be
nobodys gonna get you now get inside i cant go back
shall i leave of course
well i really think hes got a chance i know
youd better be quiet sandy shut up
jesus christ you scared the shit out of me whats going on
well im sorry im really sorry ellie its okay
my lady this play will end badly i will tell lets get out of here
im going to miss you no youre not
what do you mean i dont know i dont know what i mean
my god these people are insane we dont know what they are
this isnt a date no what is it
you ought to go home and take care of that i cant do that
is something wrong no no no

Credits

practical_seq2seq's People

Contributors

ronanki avatar suriyadeepan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

practical_seq2seq's Issues

what specific version of python 3? AttributeError: module 'tensorflow.contrib.rnn' has no attribute 'core_rnn_cell'

Hi all,

I am noticing an error which I am pretty sure has to do with version compatibility in tensorflow, when I try to execute

model = seq2seq_wrapper.Seq2Seq(xseq_len=xseq_len,
yseq_len=yseq_len,
xvocab_size=xvocab_size,
yvocab_size=yvocab_size,
ckpt_path='ckpt/twitter/',
emb_dim=emb_dim,
num_layers=3
)

I get the message, AttributeError: module 'tensorflow.contrib.rnn' has no attribute 'core_rnn_cell'.

But I have installed tensorflow 0.12.0, my python version is 3.5.2. Is there a specific py3 version I need as well?

Thank You,

Kuhan

ImportError: No module named datasets.cornell_corpus

This seems like it's a noob error, but after a bit of googling still couldn't get it to work.
So I cloned the repo and tried running 04-Cornell-Movie-Dialog-Bot.py
and I get the error: "ImportError: No module named datasets.cornell_corpus"
I guess it's an issue with my path, I tried to add:
export PYTHONPATH="${PYTHONPATH}:~/seq2seq/datasets/"
to .bashrc but no luck
This seemed to be the recommended action after reading many stackoverflow threads.
Any advice?

mini-batch loss, how low is low enough?

Hi all,

I have been trying to duplicate the level of quality seen on the example page for the Cornell Movie dialogue and I am wondering how low have you guys driven the min-batch loss to get that type of replies? I am having trouble getting my decoder inference output to that level of comprehension.

I am also wondering for the CornellMovieDialogue corpus. Is the input going into the model as is? When I read the dialogue some of it doesn't even seem to make sense:

('Not the hacking and gagging and spitting part. Please.',
"Okay... then how 'bout we try out some French cuisine. Saturday? Night?")

('Can we make this quick? Roxanne Korrine and Andrew Barrett are having an incredibly horrendous public break- up on the quad. Again.',
"Well, I thought we'd start with pronunciation, if that's okay with you.")

as in, the answer is not referencing any information in the question.

As an additional note, I am also not exactly using the tutorials shown here, I have been piecing together tutorial scripts on seq2seq from our git for my own understanding so its always possible I have a bug in my code. Nonetheless, I do wonder about my question above.

Cheers,

Kuhan

about padding

Hi, thanks to your project.
In your code, i haven't seen any code for processing the padding in the data. Does that make sense? I see in many other work they will call a function that map the pad index to zero embedding and throw away the loss value for padding sequences.

TypeError: can't pickle _thread.lock objects in phonemes to words example?

I am checking the notebooks and while I was running:

model = seq2seq_wrapper.Seq2Seq(xseq_len=xseq_len,
                               yseq_len=yseq_len,
                               xvocab_size=xvocab_size,
                               yvocab_size=yvocab_size,
                               ckpt_path='ckpt/cmudict/',
                               emb_dim=emb_dim,
                               num_layers=3
                               )

I got:


<log> Building Graph 

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-39-01139c0a9bce> in <module>()
      5                                ckpt_path='ckpt/cmudict/',
      6                                emb_dim=emb_dim,
----> 7                                num_layers=3
      8                                )

/Users/user/Downloads/practical_seq2seq-master/seq2seq_wrapper.py in __init__(self, xseq_len, yseq_len, xvocab_size, yvocab_size, emb_dim, num_layers, ckpt_path, lr, epochs, model_name)
     77         sys.stdout.write('<log> Building Graph ')
     78         # build comput graph
---> 79         __graph__()
     80         sys.stdout.write('</log>')
     81 

/Users/user/Downloads/practical_seq2seq-master/seq2seq_wrapper.py in __graph__()
     56                 #  inputs : encoder, decoder inputs, LSTM cell type, vocabulary sizes, embedding dimensions
     57                 self.decode_outputs, self.decode_states = tf.contrib.legacy_seq2seq.embedding_rnn_seq2seq(self.enc_ip,self.dec_ip, stacked_lstm,
---> 58                                                     xvocab_size, yvocab_size, emb_dim)
     59                 # share parameters
     60                 scope.reuse_variables()

/usr/local/lib/python3.6/site-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py in embedding_rnn_seq2seq(encoder_inputs, decoder_inputs, cell, num_encoder_symbols, num_decoder_symbols, embedding_size, output_projection, feed_previous, dtype, scope)
    356 
    357     # Encoder.
--> 358     encoder_cell = copy.deepcopy(cell)
    359     encoder_cell = core_rnn_cell.EmbeddingWrapper(
    360         encoder_cell,

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    178                     y = x
    179                 else:
--> 180                     y = _reconstruct(x, memo, *rv)
    181 
    182     # If is its own copy, don't memoize.

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
    278     if state is not None:
    279         if deep:
--> 280             state = deepcopy(state, memo)
    281         if hasattr(y, '__setstate__'):
    282             y.__setstate__(state)

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    148     copier = _deepcopy_dispatch.get(cls)
    149     if copier:
--> 150         y = copier(x, memo)
    151     else:
    152         try:

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
    238     memo[id(x)] = y
    239     for key, value in x.items():
--> 240         y[deepcopy(key, memo)] = deepcopy(value, memo)
    241     return y
    242 d[dict] = _deepcopy_dict

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    148     copier = _deepcopy_dispatch.get(cls)
    149     if copier:
--> 150         y = copier(x, memo)
    151     else:
    152         try:

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in _deepcopy_list(x, memo, deepcopy)
    213     append = y.append
    214     for a in x:
--> 215         append(deepcopy(a, memo))
    216     return y
    217 d[list] = _deepcopy_list

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    178                     y = x
    179                 else:
--> 180                     y = _reconstruct(x, memo, *rv)
    181 
    182     # If is its own copy, don't memoize.

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
    278     if state is not None:
    279         if deep:
--> 280             state = deepcopy(state, memo)
    281         if hasattr(y, '__setstate__'):
    282             y.__setstate__(state)

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    148     copier = _deepcopy_dispatch.get(cls)
    149     if copier:
--> 150         y = copier(x, memo)
    151     else:
    152         try:

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
    238     memo[id(x)] = y
    239     for key, value in x.items():
--> 240         y[deepcopy(key, memo)] = deepcopy(value, memo)
    241     return y
    242 d[dict] = _deepcopy_dict

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    178                     y = x
    179                 else:
--> 180                     y = _reconstruct(x, memo, *rv)
    181 
    182     # If is its own copy, don't memoize.

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
    278     if state is not None:
    279         if deep:
--> 280             state = deepcopy(state, memo)
    281         if hasattr(y, '__setstate__'):
    282             y.__setstate__(state)

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    148     copier = _deepcopy_dispatch.get(cls)
    149     if copier:
--> 150         y = copier(x, memo)
    151     else:
    152         try:

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
    238     memo[id(x)] = y
    239     for key, value in x.items():
--> 240         y[deepcopy(key, memo)] = deepcopy(value, memo)
    241     return y
    242 d[dict] = _deepcopy_dict

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    178                     y = x
    179                 else:
--> 180                     y = _reconstruct(x, memo, *rv)
    181 
    182     # If is its own copy, don't memoize.

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
    278     if state is not None:
    279         if deep:
--> 280             state = deepcopy(state, memo)
    281         if hasattr(y, '__setstate__'):
    282             y.__setstate__(state)

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    148     copier = _deepcopy_dispatch.get(cls)
    149     if copier:
--> 150         y = copier(x, memo)
    151     else:
    152         try:

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
    238     memo[id(x)] = y
    239     for key, value in x.items():
--> 240         y[deepcopy(key, memo)] = deepcopy(value, memo)
    241     return y
    242 d[dict] = _deepcopy_dict

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    178                     y = x
    179                 else:
--> 180                     y = _reconstruct(x, memo, *rv)
    181 
    182     # If is its own copy, don't memoize.

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
    278     if state is not None:
    279         if deep:
--> 280             state = deepcopy(state, memo)
    281         if hasattr(y, '__setstate__'):
    282             y.__setstate__(state)

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    148     copier = _deepcopy_dispatch.get(cls)
    149     if copier:
--> 150         y = copier(x, memo)
    151     else:
    152         try:

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
    238     memo[id(x)] = y
    239     for key, value in x.items():
--> 240         y[deepcopy(key, memo)] = deepcopy(value, memo)
    241     return y
    242 d[dict] = _deepcopy_dict

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
    167                     reductor = getattr(x, "__reduce_ex__", None)
    168                     if reductor:
--> 169                         rv = reductor(4)
    170                     else:
    171                         reductor = getattr(x, "__reduce__", None)

TypeError: can't pickle _thread.lock objects

Any idea of how to fix it?...

Predict with specific terms

Hi

I was wondering if there's a straight forward way to the trained models to predict answers for specific terms / questions.

Since the model.predict takes encoded data, which is then decoded. Did you work out a method to encode sentences on the fly to get an interactive mode running?

Thx again

pickle issue in python 2.*

unfortunately, if you use python 2.* you will face problem with pickle load:

akangaziz:practical_seq2seq mmdc$ python 03-Twitter-chatbot.py
Traceback (most recent call last): File "03-Twitter-chatbot.py", line 11, in <module> metadata, idx_q, idx_a = data.load_data(PATH='datasets/twitter/') File "/Users/mmdc/tf/practical_seq2seq/datasets/twitter/data.py", line 206, in load_data metadata = pickle.load(f) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1378, in load return Unpickler(file).load() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 858, in load dispatch[key](self) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 886, in load_proto raise ValueError, "unsupported pickle protocol: %d" % proto ValueError: unsupported pickle protocol: 3

as shared here and here , it's because of backward-incompatible.

here is quick workaround for those who face this problem in python (esp python 2.7):
file: practical_seq2seq/datasets/twitter/data.py
line: 206
change this code:
metadata = pickle.load(f)

to this code:

metadata = pickle.dump(pickle.load(sys.stdin), sys.stdout, 2)

and everything will work like a magic :)
good luck, buddy.

'NoneType' object has no attribute 'update'

When I run the code
self.decode_outputs, self.decode_states = tf.contrib.legacy_seq2seq.embedding_rnn_seq2seq(self.enc_ip,self.dec_ip, stacked_lstm,
xvocab_size, yvocab_size, emb_dim)
it occurs 'NoneType' object has no attribute 'update'.
Thanks for help!

Restore training clarification

Hey

Great seq2seq examples!

To clarify, to continue training after an interruption.

sess = model.train(train_batch_gen, val_batch_gen)
# to continue training after interrupting,
#  run model.train with "sess=sess"

means to continue like this?

sess = model.restore_last_session()
sess.train(train_batch_gen, val_batch_gen)

thx!

Checkpoints don't work

Seems like b91c1a3 change is incompatible with current checkpoints. In both "01-Phonemes-to-words" and "03-Twitter-chatbot" on restore_last_session I got error "Adam_1 not found in checkpoint" (unfortunately haven't saved full error message). After I reverted this commit and downgraded tensorflow to 0.12.1 everything worked fine.

How to convert this chat bot to technical bot ?

Hi suriyadeepan,

How can i use this chat bot to query from the database on demand and based on show result.

Basically, I am looking for something like API.AI like feature, where I can add intend and entities and based on that i can query.

Can you please guide me?

Thanks

no attribute 'seq2seq'

I get the following error:
AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'seq2seq'
It should be related to my tensorflow's version. Although I tried with 0.11, 0.12 and 1.0, I cannot get it running. Any idea?

Thanks

Unable to run twitter chatbot.py

Iam getting below Errors regarding paths, but I put correct paths

/usr/bin/python3.5 /home/kusuma/Pictures/seq2seq-master/03-Twitter-chatbot.py
Traceback (most recent call last):
File "/home/kusuma/Pictures/seq2seq-master/03-Twitter-chatbot.py", line 12, in
metadata, idx_q, idx_a = data.load_data(PATH='/home/kusuma/Pictures/seq2seq-master/datasets')
File "/home/kusuma/Pictures/seq2seq-master/datasets/twitter/data.py", line 205, in load_data
with open(PATH + '/home/kusuma/Pictures/seq2seq-master/datasets/twitter/metadata.pkl', 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/kusuma/Pictures/seq2seq-master/datasets/home/kusuma/Pictures/seq2seq-master/datasets/twitter/metadata.pkl'

Process finished with exit code 1

Intent-based chatbot.

suriyadeepan@ I agree with you from my last post but if you look at API.AI, WIT.AI and MicrosoftBot they all have some kind of features to convert chat bot into any tech bot. A limitation is they store data of the customer and in my case, it is not possible to use them.

a chatterbot is another example but chatterbot is not using seq2seq or either tensorflow.

http://chatterbot.readthedocs.io/en/stable/

Thanks

Python3 or Python2

File "03-Twitter-chatbot.py", line 12, in
metadata, idx_q, idx_a = data.load_data(PATH='datasets/twitter/')
File "/opt/data/practical_seq2seq/datasets/twitter/data.py", line 206, in load_data
metadata = pickle.load(f)
File "/usr/lib/python2.7/pickle.py", line 1378, in load
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatchkey
File "/usr/lib/python2.7/pickle.py", line 886, in load_proto
raise ValueError, "unsupported pickle protocol: %d" % proto
ValueError: unsupported pickle protocol: 3

metadata.pkl

Hi,
I am a newbie in using TF. But after reading your examples many things got clear. I also used your previous post easy_seq2seq.
Here i am trying to use the inference for twitterchat bot. However when i downloaded the dataset and now facing problem in running the file python 03-Twitter-chatbot.py

In "datasets/twitter/data.py"
ValueError: unsupported pickle protocol: 3
The metadata.pkl file may be not correct. I am using python 2.7

cannot serialize '_io.TextIOWrapper' object

Hi!
I m trying to run the code, but when i try execute:

model = seq2seq_wrapper.Seq2Seq(xseq_len=xseq_len, 
                                yseq_len=yseq_len, 
                                xvocab_size=xvocab_size, 
                                yvocab_size=yvocab_size, 
                                ckpt_path='ckpt/twitter/', 
                                emb_dim=emb_dim, 
                                num_layers=3)

I got the following error:

TypeError                                 Traceback (most recent call last)
<ipython-input-17-6366d1c05720> in <module>()
      5                                 ckpt_path='ckpt/twitter/',
      6                                 emb_dim=emb_dim,
----> 7                                 num_layers=3)

home/eisti/practical_seq2seq/seq2seq_wrapper.py in __init__(self, xseq_len, yseq_len, xvocab_size, yvocab_size, emb_dim, num_layers, ckpt_path, lr, epochs, model_name)
     77         sys.stdout.write('<log> Building Graph ')
     78         # build comput graph
---> 79         __graph__()
     80         sys.stdout.write('</log>')

....

home/eisti/anaconda3/lib/python3.5/copy.py in deepcopy(x, memo, _nil)
    172                     reductor = getattr(x, "__reduce_ex__", None)
    173                     if reductor:
--> 174                         rv = reductor(4)
    175                     else:
    176                         reductor = getattr(x, "__reduce__", None)

TypeError: cannot serialize '_io.TextIOWrapper' object

I have no idea of what can be the error. My guess is that there is a problem with number of layers (tried different values like 1 without success) ...
As i am really a newbie on tensorflow or seq2seq, i am unable to correct anything

Any help or suggestion would be most welcome!
Thanks in advance!

Attribute error on Tensorflow 1.0 version

I am facing the following problem while executing
Building Graph Traceback (most recent call last):
File "03-Twitter-chatbot.py", line 33, in
num_layers=3
File "/home/testxprt/practical_seq2seq/seq2seq_wrapper.py", line 79, in init
graph()
File "/home/testxprt/practical_seq2seq/seq2seq_wrapper.py", line 45, in graph
basic_cell = tf.nn.rnn_cell.DropoutWrapper(
AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'rnn_cell'

AttributeError

what version of tensorflow are you using ?
While running the code ,I am getting the below mentioned error.

<log> Building Graph </log>Traceback (most recent call last):
  File "train.py", line 55, in <module>
    sess = model.train(train_batch_gen, val_batch_gen)
  File "/home/prakhar/utilities/IOT/PythonUtilPlugin/scripts/chat/mycreation/seq2seq_wrapper.py", line 138, in train
    sess.run(tf.global_variables_initializer())
AttributeError: 'module' object has no attribute 'global_variables_initializer'

Restore last session for training

Hi,

What would be the way to restore session from last training?

I tried the code as below, but it shows the cpkt saving to 1000 instead of the number i have in the cpkt folder.

print('\nRestoring session...')
sess = model.restore_last_session()
print('\nTraining...')
sess = model.train(train_batch_gen, val_batch_gen, sess)

Thanks.
Ken

Model not saving

Hi, the sequence wrapper that you have written, in the main loop iterating over epoch, it is supposed to save the model snapshot every 100 iter. But this behavior seems not to be happening. It is over 350 epoch right now, but nothing got printed, which should have been.

data cannot be downloaded

Hi, it seems that dropbox has prevented the data downloading due to the too much traffic generated by this. Can we get the data elsewhere?
Thanks.

Unable to train the model

I tried training your model for around 20,000 iterations on a GPU but when I tested it on the testing data and the unseen data, it is always printing "I don't know".Can someone please help me out?

error report

Hi:
this is a great work for me to learn seq2seq, but I find error when load your pre-training model.The log as follows:

Traceback (most recent call last):
File "/home/zhang/project/seq2seq/practical_seq2seq_project/03-Twitter-chatbot.py", line 44, in
sess = model.restore_last_session()
File "/home/zhang/project/seq2seq/practical_seq2seq_project/seq2seq_wrapper.py", line 167, in restore_last_session
saver.restore(sess, ckpt.model_checkpoint_path)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/saver.py", line 1388, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 766, in run
run_metadata_ptr)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 964, in _run
feed_dict_string, options, run_metadata)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1014, in _do_run
target_list, options, run_metadata)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1034, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [6002,1024] rhs shape= [8002,1024]
[[Node: save/Assign_2 = Assign[T=DT_FLOAT, _class=["loc:@decoder/embedding_rnn_seq2seq/RNN/EmbeddingWrapper/embedding"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](decoder/embedding_rnn_seq2seq/RNN/EmbeddingWrapper/embedding, save/RestoreV2_2)]]

TypeError: cannot create 'sys.version_info' instances

i am getting TypeError: cannot create 'sys.version_info' instances on executing the "python 03-Twitter-chatbot.py".

File "C:\Users\tmpuser4195\AppData\Local\Programs\Python\Python35\Lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\tmpuser4195\AppData\Local\Programs\Python\Python35\Lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\tmpuser4195\AppData\Local\Programs\Python\Python35\Lib\copy.py", line 292, in _reconstruct
y = callable(*args)
TypeError: cannot create 'sys.version_info' instances

Training Time ?

Hi, I am trying to train a Q/A model on my data, using your sequence wrapper. The checkpoint model that you have given is the result of 45k epoch roughly. How much time did it take to train this model ?
Also, by what heuristics did you reach epoch at this scale ?

ImportError: No module named datasets.twitter

Hello,

getting below error on running "03-Twitter-chatbot.ipynb" in notebook, the file is exists (data.py)

ImportError Traceback (most recent call last)
in ()
3
4 # preprocessed data
----> 5 from datasets.twitter import data
6 import data_utils

ImportError: No module named datasets.twitter

Too many UNK in the output

I trained the network for 5000 iterations; see the loss below

Building Graph
Training started

Model saved to disk at iteration #1000
val loss : 3.290424

Model saved to disk at iteration #2000
val loss : 3.261373

Model saved to disk at iteration #3000
val loss : 3.224990

Model saved to disk at iteration #4000
val loss : 3.151570

Model saved to disk at iteration #5000
val loss : 3.155647

After this I wanted to evaluate the model on the test dataset. Most of the decoder's output is "unk" (see below):

q : [hillary is crazy also evil nothing good about her except that she has a terminal illness]; a : [i unk unk unk unk unk unk unk unk unk unk unk unk unk]
q : [breaking unk unk israeli unk and unk peace prize winner dies at unk]; a : [unk unk unk unk unk unk unk unk unk unk unk unk unk]
q : [because and jason unk are fighting in the cage next week to see who unk into whom]; a : [i unk unk unk unk unk unk unk unk unk unk unk unk unk]
q : [im considering unk a ticket shit looks live ]; a : [i unk unk unk]
q : [unk is a classic but tears in heaven is stupid]; a : [i unk unk unk unk unk unk unk unk unk unk unk unk unk]

Do you think the output is like that because I tested the model's performance too soon or that the model is not learning anything?

OOM when allocating tensor with shape[2048,4096]

When i try to run python 04-Cornell-Movie-Dialog-Bot.py get this error:

I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 000000079CFE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 000000079EFE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007A0FE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007A2FE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007A4FE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007A6FE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007A8FE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007AAFE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007ACFE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007AEFE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007B0FE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007B2FE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007B4FE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007B6FE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007B8FE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007BAFE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007BCFE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007BEFE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007C0FE2100 of size 33554432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:678] Chunk at 00000007C2FE2100 of size 36160768
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000710DC3600 of size 8448
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000710DC5800 of size 5120
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000710DC6D00 of size 512
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000710E03700 of size 256
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000710EE3800 of size 256
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000710F23900 of size 512
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000710F63C00 of size 256
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000711143D00 of size 131072
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 00000007111A3D00 of size 786432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 00000007112C3D00 of size 786432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000073F51C600 of size 131072
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000073F6FC600 of size 131072
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000073F798600 of size 16384
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000073F7BC600 of size 786432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000073F8BC600 of size 131072
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000073F91C600 of size 917504
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000073FA1C600 of size 655360
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000073FB40600 of size 901120
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000073FC3C600 of size 3252480
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000073FF96700 of size 786432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000740076700 of size 131072
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 00000007400B6700 of size 131072
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000740196700 of size 655360
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000074023A700 of size 3236096
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000740570800 of size 786432
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000740634800 of size 1818624
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 00000007407F4800 of size 2449664
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000740A6A900 of size 1179648
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000740BAA900 of size 5480704
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000741104A00 of size 655360
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 00000007411C4A00 of size 3907840
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000074159EB00 of size 655360
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000074165EB00 of size 393216
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 00000007416DEB00 of size 393216
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 000000074175EB00 of size 3121408
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000741A78C00 of size 5480704
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 0000000741FF2D00 of size 1835008
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:687] Free at 00000007421D2D00 of size 4038912
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:693]      Summary of in-use Chunks by size:
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 25 Chunks of size 256 totalling 6.3KiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 1 Chunks of size 1280 totalling 1.3KiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 1 Chunks of size 6400 totalling 6.3KiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 93 Chunks of size 16384 totalling 1.45MiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 5 Chunks of size 32256 totalling 157.5KiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 678 Chunks of size 131072 totalling 84.75MiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 1 Chunks of size 241152 totalling 235.5KiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 1 Chunks of size 257792 totalling 251.8KiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 51 Chunks of size 262144 totalling 12.75MiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 35 Chunks of size 393216 totalling 13.13MiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 1 Chunks of size 638976 totalling 624.0KiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 7 Chunks of size 32776192 totalling 218.80MiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 81 Chunks of size 33554432 totalling 2.53GiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 1 Chunks of size 35646464 totalling 34.00MiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 1 Chunks of size 36160768 totalling 34.49MiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 1 Chunks of size 42034944 totalling 40.09MiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:696] 1 Chunks of size 66330624 totalling 63.26MiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:700] Sum Total of in-use chunks: 3.02GiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:702] Stats:
Limit:                  3292128870
InUse:                  3246350848
MaxInUse:               3249725952
NumAllocs:                    7135
MaxAllocSize:             66330624

W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:274] **************************************************************************
**************************
W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\bfc_allocator.cc:275] Ran out of memory trying to allocate 32.00MiB.  See logs for memory state.
W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:975] Resource exhausted: OOM when allocating tensor with shape[2048,4096]
Traceback (most recent call last):
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\client\session.py", line 1021, in _do_call
    return fn(*args)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\client\session.py", line 1003, in _run_fn
    status, run_metadata)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\contextlib.py", line 66, in __exit__
    next(self.gen)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 469, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[2048,4096]
         [[Node: gradients/decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell_4/Cell0/BasicLSTMCell/Linear/MatMul_grad/MatMul_1 = MatMul[T=DT_FLOAT, transpose_a=true,
 transpose_b=false, _device="/job:localhost/replica:0/task:0/gpu:0"](decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell_4/Cell0/BasicLSTMCell/Linear/concat, gradients
/decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell_4/Cell0/BasicLSTMCell/add_grad/tuple/control_dependency)]]
         [[Node: Adam/update_decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell/Cell0/BasicLSTMCell/Linear/Bias/ApplyAdam/_410 = _Recv[client_terminated=false, recv_d
evice="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_656_Adam/update_decoder/embedding_rnn_seq2seq/e
mbedding_rnn_decoder/rnn_decoder/MultiRNNCell/Cell0/BasicLSTMCell/Linear/Bias/ApplyAdam", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "04-Cornell-Movie-Dialog-Bot.py", line 42, in <module>
    sess = model.train(train_batch_gen, val_batch_gen)
  File "c:\Repositories\practical_seq2seq\seq2seq_wrapper.py", line 144, in train
    self.train_batch(sess, train_set)
  File "c:\Repositories\practical_seq2seq\seq2seq_wrapper.py", line 102, in train_batch
    _, loss_v = sess.run([self.train_op, self.loss], feed_dict)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\client\session.py", line 766, in run
    run_metadata_ptr)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\client\session.py", line 964, in _run
    feed_dict_string, options, run_metadata)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\client\session.py", line 1014, in _do_run
    target_list, options, run_metadata)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\client\session.py", line 1034, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[2048,4096]
         [[Node: gradients/decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell_4/Cell0/BasicLSTMCell/Linear/MatMul_grad/MatMul_1 = MatMul[T=DT_FLOAT, transpose_a=true,
 transpose_b=false, _device="/job:localhost/replica:0/task:0/gpu:0"](decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell_4/Cell0/BasicLSTMCell/Linear/concat, gradients
/decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell_4/Cell0/BasicLSTMCell/add_grad/tuple/control_dependency)]]
         [[Node: Adam/update_decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell/Cell0/BasicLSTMCell/Linear/Bias/ApplyAdam/_410 = _Recv[client_terminated=false, recv_d
evice="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_656_Adam/update_decoder/embedding_rnn_seq2seq/e
mbedding_rnn_decoder/rnn_decoder/MultiRNNCell/Cell0/BasicLSTMCell/Linear/Bias/ApplyAdam", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

Caused by op 'gradients/decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell_4/Cell0/BasicLSTMCell/Linear/MatMul_grad/MatMul_1', defined at:
  File "04-Cornell-Movie-Dialog-Bot.py", line 30, in <module>
    num_layers=3
  File "c:\Repositories\practical_seq2seq\seq2seq_wrapper.py", line 79, in __init__
    __graph__()
  File "c:\Repositories\practical_seq2seq\seq2seq_wrapper.py", line 75, in __graph__
    self.train_op = tf.train.AdamOptimizer(learning_rate=lr).minimize(self.loss)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\training\optimizer.py", line 269, in minimize
    grad_loss=grad_loss)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\training\optimizer.py", line 335, in compute_gradients
    colocate_gradients_with_ops=colocate_gradients_with_ops)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 482, in gradients
    in_grads = grad_fn(op, *out_grads)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\math_grad.py", line 731, in _MatMulGrad
    math_ops.matmul(op.inputs[0], grad, transpose_a=True))
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\math_ops.py", line 1729, in matmul
    a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 1442, in _mat_mul
    transpose_b=transpose_b, name=name)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 759, in apply_op
    op_def=op_def)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 2240, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 1128, in __init__
    self._traceback = _extract_stack()

...which was originally created as op 'decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell_4/Cell0/BasicLSTMCell/Linear/MatMul', defined at:
  File "04-Cornell-Movie-Dialog-Bot.py", line 30, in <module>
    num_layers=3
[elided 0 identical lines from previous traceback]
  File "c:\Repositories\practical_seq2seq\seq2seq_wrapper.py", line 79, in __init__
    __graph__()
  File "c:\Repositories\practical_seq2seq\seq2seq_wrapper.py", line 58, in __graph__
    xvocab_size, yvocab_size, emb_dim)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\seq2seq.py", line 357, in embedding_rnn_seq2seq
    feed_previous=feed_previous)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\seq2seq.py", line 280, in embedding_rnn_decoder
    loop_function=loop_function)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\seq2seq.py", line 146, in rnn_decoder
    output, state = cell(inp, state)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\rnn_cell.py", line 586, in __call__
    output, res_state = self._cell(inputs, state)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\rnn_cell.py", line 815, in __call__
    cur_inp, new_state = cell(cur_inp, cur_state)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\rnn_cell.py", line 684, in __call__
    output, new_state = self._cell(inputs, state, scope)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\rnn_cell.py", line 311, in __call__
    concat = _linear([inputs, h], 4 * self._num_units, True)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\rnn_cell.py", line 909, in _linear
    res = math_ops.matmul(array_ops.concat(1, args), matrix)
  File "C:\Users\felansu\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\math_ops.py", line 1729, in matmul
    a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name)

ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[2048,4096]
         [[Node: gradients/decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell_4/Cell0/BasicLSTMCell/Linear/MatMul_grad/MatMul_1 = MatMul[T=DT_FLOAT, transpose_a=true,
 transpose_b=false, _device="/job:localhost/replica:0/task:0/gpu:0"](decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell_4/Cell0/BasicLSTMCell/Linear/concat, gradients
/decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell_4/Cell0/BasicLSTMCell/add_grad/tuple/control_dependency)]]
         [[Node: Adam/update_decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/MultiRNNCell/Cell0/BasicLSTMCell/Linear/Bias/ApplyAdam/_410 = _Recv[client_terminated=false, recv_d
evice="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_656_Adam/update_decoder/embedding_rnn_seq2seq/e
mbedding_rnn_decoder/rnn_decoder/MultiRNNCell/Cell0/BasicLSTMCell/Linear/Bias/ApplyAdam", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_gpu_executor.cc:652] Deallocating stream with pending work

module' object has no attribute 'core_rnn_cell'

Building Graph Traceback (most recent call last):
File "/home/kusuma/Pictures/seq2seq-master/03-Twitter-chatbot.py", line 32, in
num_layers=3
File "/home/kusuma/Pictures/seq2seq-master/seq2seq_wrapper.py", line 80, in init
graph()
File "/home/kusuma/Pictures/seq2seq-master/seq2seq_wrapper.py", line 46, in graph
basic_cell = tf.nn.rnn_cell.BasicRNNCell.DropoutWrapper(
AttributeError: type object 'BasicRNNCell' has no attribute 'DropoutWrapper'

basic_cell = tf.contrib.rnn.core_rnn_cell.DropoutWrapper(
AttributeError: 'module' object has no attribute 'core_rnn_cell'

Process finished with exit code 1
I used tensorflow0.12.0

Error running the twitter dataset bot after reloading checkpoint.

I am getting the error shown below after I run the model.predict() line in the twitter chatbot ipynb.

After some searching online I found that this happens when the variables are not initialized, but I am just trying to run your pre-trained model to see how it works.

Is there something I should be doing that's different ? Should I train before I run?

---------------------------------------------------------------------------
FailedPreconditionError                   Traceback (most recent call last)
/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
    971     try:
--> 972       return fn(*args)
    973     except errors.OpError as e:

/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/client/session.py in _run_fn(session, feed_dict, fetch_list, target_list, options, run_metadata)
    953                                  feed_dict, fetch_list, target_list,
--> 954                                  status, run_metadata)
    955 

/Users/ybow_93/anaconda/lib/python3.5/contextlib.py in __exit__(self, type, value, traceback)
     65             try:
---> 66                 next(self.gen)
     67             except StopIteration:

/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/errors.py in raise_exception_on_not_ok_status()
    462           compat.as_text(pywrap_tensorflow.TF_Message(status)),
--> 463           pywrap_tensorflow.TF_GetCode(status))
    464   finally:

FailedPreconditionError: Attempting to use uninitialized value decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias
	 [[Node: decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias/read = Identity[T=DT_FLOAT, _class=["loc:@decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias"], _device="/job:localhost/replica:0/task:0/cpu:0"](decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias)]]

During handling of the above exception, another exception occurred:

FailedPreconditionError                   Traceback (most recent call last)
<ipython-input-32-6ce101760870> in <module>()
      1 #sess.run(tf.initialize_all_variables())
      2 input_ = test_batch_gen.__next__()[0]
----> 3 output = model.predict(sess, input_)
      4 print(output.shape)

/Users/ybow_93/Deep and Machine Learning/Retrieval Based Chatbot/practical_seq2seq-master/seq2seq_wrapper.py in predict(self, sess, X)
    173         feed_dict = {self.enc_ip[t]: X[t] for t in range(self.xseq_len)}
    174         feed_dict[self.keep_prob] = 1.
--> 175         dec_op_v = sess.run(self.decode_outputs_test, feed_dict)
    176         # dec_op_v is a list; also need to transpose 0,1 indices
    177         #  (interchange batch_size and timesteps dimensions

/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata)
    715     try:
    716       result = self._run(None, fetches, feed_dict, options_ptr,
--> 717                          run_metadata_ptr)
    718       if run_metadata:
    719         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
    913     if final_fetches or final_targets:
    914       results = self._do_run(handle, final_targets, final_fetches,
--> 915                              feed_dict_string, options, run_metadata)
    916     else:
    917       results = []

/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
    963     if handle is None:
    964       return self._do_call(_run_fn, self._session, feed_dict, fetch_list,
--> 965                            target_list, options, run_metadata)
    966     else:
    967       return self._do_call(_prun_fn, self._session, handle, feed_dict,

/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
    983         except KeyError:
    984           pass
--> 985       raise type(e)(node_def, op, message)
    986 
    987   def _extend_graph(self):

FailedPreconditionError: Attempting to use uninitialized value decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias
	 [[Node: decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias/read = Identity[T=DT_FLOAT, _class=["loc:@decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias"], _device="/job:localhost/replica:0/task:0/cpu:0"](decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias)]]

Caused by op 'decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias/read', defined at:
  File "/Users/ybow_93/anaconda/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/ybow_93/anaconda/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/ipykernel/__main__.py", line 3, in <module>
    app.launch_new_instance()
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/ipykernel/kernelapp.py", line 474, in start
    ioloop.IOLoop.instance().start()
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/zmq/eventloop/ioloop.py", line 177, in start
    super(ZMQIOLoop, self).start()
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tornado/ioloop.py", line 887, in start
    handler_func(fd_obj, events)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events
    self._handle_recv()
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv
    self._run_callback(callback, msg)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback
    callback(*args, **kwargs)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 276, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 228, in dispatch_shell
    handler(stream, idents, msg)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 390, in execute_request
    user_expressions, allow_stdin)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/ipykernel/ipkernel.py", line 196, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/ipykernel/zmqshell.py", line 501, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2717, in run_cell
    interactivity=interactivity, compiler=compiler, result=result)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2821, in run_ast_nodes
    if self.run_code(code, result):
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-29-27a584e39e51>", line 7, in <module>
    num_layers=3
  File "/Users/ybow_93/Deep and Machine Learning/Retrieval Based Chatbot/practical_seq2seq-master/seq2seq_wrapper.py", line 79, in __init__
    __graph__()
  File "/Users/ybow_93/Deep and Machine Learning/Retrieval Based Chatbot/practical_seq2seq-master/seq2seq_wrapper.py", line 58, in __graph__
    xvocab_size, yvocab_size, emb_dim)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/seq2seq.py", line 357, in embedding_rnn_seq2seq
    feed_previous=feed_previous)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/seq2seq.py", line 280, in embedding_rnn_decoder
    loop_function=loop_function)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/seq2seq.py", line 146, in rnn_decoder
    output, state = cell(inp, state)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/rnn_cell.py", line 587, in __call__
    projected = _linear(output, self._output_size, True)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/rnn_cell.py", line 914, in _linear
    bias_start, dtype=dtype))
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 1022, in get_variable
    custom_getter=custom_getter)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 849, in get_variable
    custom_getter=custom_getter)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 345, in get_variable
    validate_shape=validate_shape)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 330, in _true_getter
    caching_device=caching_device, validate_shape=validate_shape)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 676, in _get_single_variable
    validate_shape=validate_shape)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/variables.py", line 215, in __init__
    dtype=dtype)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/variables.py", line 327, in _init_from_args
    self._snapshot = array_ops.identity(self._variable, name="read")
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 1128, in identity
    result = _op_def_lib.apply_op("Identity", input=input, name=name)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 749, in apply_op
    op_def=op_def)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2380, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/Users/ybow_93/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1298, in __init__
    self._traceback = _extract_stack()

FailedPreconditionError (see above for traceback): Attempting to use uninitialized value decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias
	 [ [ Node: decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias/read = Identity[T=DT_FLOAT, _class=[ "loc:@decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias"], _device="/job:localhost/replica:0/task:0/cpu:0" ](decoder/embedding_rnn_seq2seq/embedding_rnn_decoder/rnn_decoder/OutputProjectionWrapper/Linear/Bias ) ] ]

Question

I know it might be a v silly question but i am trying to get my hands on this seq2seq model.
I am trying to run
python 03-Twitter-chatbot.py
It is doing the training again right?
As you already provided a checkpoint. So how should i use it ? Is there a way to validate/test ?

tensorflow 1.0

The codebase is not working with tensorflow 1.0. What is the best way to make it compatible?

Prepare_data.py Issues

Hi @suriyadeepan I'm running the prepare_data.py and it outputs the following message, but doesn't create any encoder or decoder files - any help much appreciated!

Grahams-MacBook-Air:scripts grahamrksmith$ python prepare_data.py

gathered id2line dictionary.

gathered conversations.

['Can we make this quick? Roxanne Korrine and Andrew Barrett are having an incredibly horrendous public break- up on the quad. Again.', 'Not the hacking and gagging and spitting part. Please.']
Grahams-MacBook-Air:scripts grahamrksmith$ python prepare_data.py

gathered id2line dictionary.

gathered conversations.

['Can we make this quick? Roxanne Korrine and Andrew Barrett are having an incredibly horrendous public break- up on the quad. Again.', 'Not the hacking and gagging and spitting part. Please.']

How to predict sentence?

Hi there, this repo is very helpful for NLP beginners, I currently success trained the model, however I don't know how to predict a given sentence by user. I defined a chat function:

def chat():
    # load data from pickle and npy files
    metadata, idx_q, idx_a = data.load_data(PATH='datasets/twitter/')

    w_2_id = dict(metadata['w2idx'])
    id_2_w = metadata['idx2w']

    sent = 'hello, what is your name?'
    sent_token = nltk.word_tokenize(sent)
    sent_index = np.array([data.pad_seq(sent_token, w_2_id, limit['max_q'])])
    print(sent_index)

    # parameters
    x_seq_len = sent_index.shape[-1]
    emb_dim = 400

    model = seq2seq_wrapper.Seq2Seq(xseq_len=x_seq_len,
                                    yseq_len=None,
                                    xvocab_size=None,
                                    yvocab_size=None,
                                    ckpt_path='ckpt/twitter/',
                                    emb_dim=emb_dim,
                                    num_layers=2
                                    )
    sess = model.restore_last_session()
    predict = model.predict(sess=sess, X=sent_index)

    print(predict)
    response = [id_2_w[i] for i in predict]

But I find that to define model I have to send train data x and y into it, I can't set is None, so basically I can not call predict function, is there any snippet that indicates how to predict on certain sentences?
I am new to NLP and seq2seq model, and don't know how to edit your original model, any help would be appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.