使用seq2seq和注意模型时恢复tensorflow模型和元图的错误。

时间:2018-03-31 00:20:42

标签: python-3.x tensorflow

我正在使用seq2seq模型和link中给出的聊天机器人的注意机制,我能够训练模型并保存它但是当我尝试恢复模型时,我收到错误:

加载模型的代码:

  with tf.Session() as sess:
        #try:
        saver = tf.train.import_meta_graph('/media/saurabh/New Volume/nlp_ucf/project/model/model_0.ckpt.meta')
        saver.restore(sess, '/media/saurabh/New Volume/nlp_ucf/project/model/model_0.ckpt.data-00000-of-00001')

我得到的错误是

I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1060, pci bus id: 0000:01:00.0)
Traceback (most recent call last):
  File "start_something.py", line 254, in <module>
    saver = tf.train.import_meta_graph('/media/saurabh/New Volume/nlp_ucf/project/model/model_0.ckpt.meta')
  File "/home/saurabh/tfenv3/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1577, in import_meta_graph
    **kwargs)
  File "/home/saurabh/tfenv3/lib/python3.5/site-packages/tensorflow/python/framework/meta_graph.py", line 498, in import_scoped_meta_graph
    producer_op_list=producer_op_list)
  File "/home/saurabh/tfenv3/lib/python3.5/site-packages/tensorflow/python/framework/importer.py", line 259, in import_graph_def
    raise ValueError('No op named %s in defined operations.' % node.op)
ValueError: No op named attn_add_fun_f32f32f32 in defined operations.

我甚至无法理解错误。有没有人对此有任何线索?我能够在StackOverflow上找到另外一个有类似问题的人,但无法理解究竟是什么解决方案?

0 个答案:

没有答案