Open bayou3 opened 7 years ago
我重新跑了一遍,问题主要在于TensorFlow的版本问题,我当时写代码的版本是1.1,1.3的部分接口发生改变,这种问题修改调用接口的代码就可以。解决方案:
1.使用TensorFlow1.1版本重新跑。
2.decoding_layer函数里修改代码:
training_decoder_output, _ = tf.contrib.seq2seq.dynamic_decode(training_decoder, impute_finished=True, maximum_iterations=max_target_sequence_length)
为
training_decoder_output, _, _ = tf.contrib.seq2seq.dynamic_decode(training_decoder, impute_finished=True, maximum_iterations=max_target_sequence_length)
修改:
predicting_decoder_output, _ = tf.contrib.seq2seq.dynamic_decode(predicting_decoder, impute_finished=True, maximum_iterations=max_target_sequence_length)
为:
predicting_decoder_output, _, _ = tf.contrib.seq2seq.dynamic_decode(predicting_decoder, impute_finished=True, maximum_iterations=max_target_sequence_length)
1和2方案我都试过了,可以正常运行
首先感谢楼主的分享,对于basic_seq2seq中的代码,运行时产生如下错误,我的tensorflow是最新的1.3.0 gpu版本,执行时所有代码均未改动,想楼主帮看看 Traceback (most recent call last): File "D:\Workspaces\Eclipse\PythonLearn1\src\seq2seq__init__.py", line 227, in
num_layers)
File "D:\Workspaces\Eclipse\PythonLearn1\src\seq2seq__init.py", line 189, in seq2seq_model decoder_input) File "D:\Workspaces\Eclipse\PythonLearn1\src\seq2seq\init__.py", line 146, in decoding_layer maximum_iterations=max_target_sequence_length) ValueError: too many values to unpack (expected 2)