相关疑难解决方法(0)

TypeError:无法在Seq2Seq中pickle _thread.lock对象

我在Tensorflow模型中使用存储桶时遇到问题.当我运行它时buckets = [(100, 100)],它工作正常.当我用buckets = [(100, 100), (200, 200)]它运行它根本不起作用(底部的堆栈跟踪).

有趣的是,运行Tensorflow的Seq2Seq教程会产生相同类型的问题,几乎相同的堆栈跟踪.出于测试目的,此处链接到存储库.

我不确定问题是什么,但是有多个桶总是会触发它.

这段代码不能单独运行,但这是崩溃的功能 - 记住buckets从更改[(100, 100)][(100, 100), (200, 200)]触发崩溃.

class MySeq2Seq(object):
    def __init__(self, source_vocab_size, target_vocab_size, buckets, size, num_layers, batch_size, learning_rate):
        self.source_vocab_size = source_vocab_size
        self.target_vocab_size = target_vocab_size
        self.buckets = buckets
        self.batch_size = batch_size

        cell = single_cell = tf.nn.rnn_cell.GRUCell(size)
        if num_layers > 1:
            cell = tf.nn.rnn_cell.MultiRNNCell([single_cell] * num_layers)

        # The seq2seq function: we use embedding for the input and attention
        def …
Run Code Online (Sandbox Code Playgroud)

nlp python-3.x lstm tensorflow sequence-to-sequence

11
推荐指数
1
解决办法
2万
查看次数

标签 统计

lstm ×1

nlp ×1

python-3.x ×1

sequence-to-sequence ×1

tensorflow ×1