0

Use tf.contrib.legacy_seq2seq.embedding_rnn_seq2seq with tensorflow 1.5 case 'TypeError: can't pickle _thread.lock objects', this issue is the same as https://github.com/suriyadeepan/practical_seq2seq/issues/31 I use the way someone post: change the code of tf in embedding_rnn_seq2seq function

encoder_cell = copy.deepcopy(cell) => encoder_cell = copy.copy(cell)

Is it the right way to fix this issue? Or is there any other way to fix this. the API of tf make me mess, change so frequently,

tf.nn.rnn_cell, tf.contrib.seq2seq, tf.legacy_seq2seq

kill me!!

eagle A
  • 107
  • 8
  • Possible duplicate of [TypeError: can't pickle \_thread.lock objects in Seq2Seq](https://stackoverflow.com/questions/44855603/typeerror-cant-pickle-thread-lock-objects-in-seq2seq) – Maxim Mar 16 '18 at 15:28
  • @Maxim that way does not work for me, and what i ask is why change deepcopy to copy it works, is it right way? – eagle A Mar 17 '18 at 01:50

1 Answers1

0

Add this to your script. I hope it will work now

    setattr(tf.contrib.rnn.GRUCell, '__deepcopy__', lambda self, _: self)
    setattr(tf.contrib.rnn.BasicLSTMCell, '__deepcopy__', lambda self, _: self)
    setattr(tf.contrib.rnn.MultiRNNCell, '__deepcopy__', lambda self, _: self)