suriyadeepan / practical_seq2seq

A simple, minimal wrapper for tensorflow's seq2seq module, for experimenting with datasets rapidly
http://suriyadeepan.github.io/2016-12-31-practical-seq2seq/
GNU General Public License v3.0
570 stars 270 forks source link

cannot serialize '_io.TextIOWrapper' object #35

Open jdebec opened 7 years ago

jdebec commented 7 years ago

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!

SamirMatkar commented 7 years ago

I am also getting the same error

AdaZhao1211 commented 7 years ago

same here

camdirigo commented 7 years ago

I am getting this error as well. The previous errors I was receiving wereAttributeError: 'NoneType' object has no attribute 'update' and ValueError: ctypes objects containing points cannot be pickled. I resolved these errors by inserting the following within the __init__ function of the Seq2Seq class:

self.num_layers = num_layers self.xvocab_size = xvocab_size self.yvocab_size = yvocab_size self.emb_dim = emb_dim

The error is occurring at line 33 in the 03-Twitter-chatbot.py script (num_layers=3) and leads to line 61 of seq2seq_wrapper.py:

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)

tangyudi commented 7 years ago

@camdirigo the same error AttributeError: 'NoneType' object has no attribute 'update'. Do you know how to fix it?

DataTerminatorX commented 7 years ago

same here. changed many tensorflow versions( from 0.12.0 to 1.3.0) still unsolved

Pankajchandan commented 6 years ago

@suriyadeepan I am getting the same error, any pointers?

NoushNabi commented 6 years ago

I am getting the same error as well. Also these ones: 'NoneType' object has no attribute 'update' and ValueError: ctypes objects containing points cannot be pickled.