TypeError: can't pickle _thread.lock objects in Seq2Seq

时光总嘲笑我的痴心妄想 提交于 2019-11-28 00:56:25

The problem is with latest changes in seq2seq.py. Add this to your script and it will avoid deep-coping of the cells:

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)

This solution does not work for me. Any new solution?

These two solutions work for me:

change seq2seq.py under /yourpath/tensorflow/contrib/legacy_seq2seq/python/ops/

#encoder_cell = copy.deepcopy(cell)
encoder_cell = core_rnn_cell.EmbeddingWrapper(
    cell, #encoder_cell,

or

for nextBatch in tqdm(batches, desc="Training"):
    _, step_loss = model.step(...)

fed one bucket at a step

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!