qhduan/Seq2Seq_Chatbot_QA

AttributeError

wangejay opened this issue · 3 comments

hi,
說明很清楚了,但在train時,有碰到AttributeError,不知你有沒有碰到同樣的問題。

error log 如下:
write_version=tf.train.SaverDef.V2
File "/usr/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1077, in init
self.build()
File "/usr/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1106, in build
restore_sequentially=self._restore_sequentially)
File "/usr/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 702, in build
save_tensor = self._AddSaveOps(filename_tensor, saveables)
File "/usr/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 309, in _AddSaveOps
save = self.save_op(filename_tensor, saveables)
File "/usr/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 252, in save_op
return io_ops.save_v2(filename_tensor, tensor_names, tensor_slices,
AttributeError: module 'tensorflow.python.ops.io_ops' has no attribute 'save_v2'

应该是tensorflow版本的问题

我用的最新tf 0.11.0 rc1版本的,这个版本开始存储格式用了SaverDef.V2

你可以考虑删掉s2s_model.py文件第106行的
write_version=tf.train.SaverDef.V2
应该就会好

~~或者考虑开个virtualenv装个最新版tf试试

write_version=tf.train.SaverDef.V2 删除以后依然报错,错误信息

File "/ml/Seq2Seq_Chatbot_QA/s2s_model.py", line 166, in init
self.saver = tf.train.Saver(tf.global_variables())
File "/usr/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1040, in init
self.build()
File "/usr/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1070, in build
restore_sequentially=self._restore_sequentially)
File "/usr/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 675, in build
restore_sequentially, reshape)
File "/usr/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 402, in _AddRestoreOps
tensors = self.restore_op(filename_tensor, saveable, preferred_shard)
File "/usr/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 242, in restore_op
[spec.tensor.dtype])[0])
File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/gen_io_ops.py", line 668, in restore_v2
dtypes=dtypes, name=name)
File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
op_def=op_def)
File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2327, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1226, in init
self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to get matching files on ./model/model1/model: Not found: ./model/model1
[[Node: save/RestoreV2_15 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/RestoreV2_15/tensor_names, save/RestoreV2_15/shape_and_slices)]]

请问是什么原因导致的?

也许是不支持2.7导致的吧,作者说的是支持3.5