我想在tensorflow中加载两个模型,但我似乎一直都有这个错误 我只能在一个代码中加载一个模型,错误如下:
Traceback (most recent call last):
File "X:/fffan/NLP/Classify/TextMix/pred_back.py", line 92, in <module>
textrcnn = TextRCNN_pred(vocab_dir="../data/cnews_vocab.txt")
File "X:/fffan/NLP/Classify/TextMix/pred_back.py", line 54, in __init__
saver.restore(sess=self.session, save_path=model_path)
File "D:\Anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 1302, in restore err, "a Variable name or other graph key that is missing")
tensorflow.python.framework.errors_impl.NotFoundError: Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:
2 root error(s) found.
(0) Not found: Key W_projection_cnn not found in checkpoint
[[node save_1/RestoreV2 (defined at X:/fffan/NLP/Classify/TextMix/pred_back.py:46) ]]
(1) Not found: Key W_projection_cnn not found in checkpoint
[[node save_1/RestoreV2 (defined at X:/fffan/NLP/Classify/TextMix/pred_back.py:46) ]]
[[save_1/RestoreV2/_57]]
0 successful operations.
0 derived errors ignored.
Original stack trace for 'save_1/RestoreV2':
File "X:/fffan/NLP/Classify/TextMix/pred_back.py", line 92, in <module>
textrcnn = TextRCNN_pred(vocab_dir="../data/cnews_vocab.txt")
File "X:/fffan/NLP/Classify/TextMix/pred_back.py", line 46, in __init__
saver = tf.train.Saver()
我的代码在这里:
^{pr2}$PS:当我单独运行时,每个模型都可以。例如“运行”代码文本RCNN.text(test_X)“仅”或运行“logit_CNN=文本cnn.text(test_X)“仅此,它是可以的。在
有人告诉我如何调试这些代码吗?谢谢您!在
目前没有回答
相关问题 更多 >
编程相关推荐