practical_seq2seq icon indicating copy to clipboard operation
practical_seq2seq copied to clipboard

cannot serialize '_io.TextIOWrapper' object

Open jdebec opened this issue 7 years ago • 7 comments

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!

jdebec avatar May 10 '17 03:05 jdebec

I am also getting the same error

SamirMatkar avatar May 10 '17 07:05 SamirMatkar

same here

AdaZhao1211 avatar Jun 08 '17 22:06 AdaZhao1211

I am getting this error as well. The previous errors I was receiving were AttributeError: '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)

camdirigo avatar Jul 01 '17 19:07 camdirigo

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

tangyudi avatar Jul 14 '17 04:07 tangyudi

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

DataTerminatorX avatar Aug 24 '17 14:08 DataTerminatorX

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

Pankajchandan avatar Nov 10 '17 04:11 Pankajchandan

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.

NoushNabi avatar Dec 18 '17 19:12 NoushNabi