测试模型时报错
来源:10-5 第一种模型训练(5)

慕姐7282977
2019-04-22
F:\Anaconda\envs\nlp\python.exe F:/tensorflow_workspace/chatbot/test.py
你 接 到 这 封 信 的 时 候
畹 华 吾 侄 , 你 接 到 这 封 信 的 时 候
就 一 直 小 心 翼 翼 地 唱 戏
就 一 直 小 心 翼 翼 地 唱 戏
侍 奉 宫 廷 侍 奉 百 姓
2019-04-22 21:09:07.190014: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-04-22 21:09:07.918969: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1392] Found device 0 with properties:
name: GeForce MX150 major: 6 minor: 1 memoryClockRate(GHz): 1.341
pciBusID: 0000:01:00.0
totalMemory: 2.00GiB freeMemory: 1.62GiB
2019-04-22 21:09:07.919357: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1471] Adding visible gpu devices: 0
2019-04-22 21:09:09.812820: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-04-22 21:09:09.813064: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:958] 0
2019-04-22 21:09:09.813220: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0: N
2019-04-22 21:09:09.813549: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1084] Created TensorFlow device (/device:GPU:0 with 1384 MB memory) -> physical GPU (device: 0, name: GeForce MX150, pci bus id: 0000:01:00.0, compute capability: 6.1)
WARNING:tensorflow:From F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\ops\rnn.py:417: calling reverse_sequence (from tensorflow.python.ops.array_ops) with seq_dim is deprecated and will be removed in a future version.
Instructions for updating:
seq_dim is deprecated, use seq_axis instead
WARNING:tensorflow:From F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\util\deprecation.py:432: calling reverse_sequence (from tensorflow.python.ops.array_ops) with batch_dim is deprecated and will be removed in a future version.
Instructions for updating:
batch_dim is deprecated, use batch_axis instead
2019-04-22 21:09:10.315977: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1471] Adding visible gpu devices: 0
2019-04-22 21:09:10.316262: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-04-22 21:09:10.316541: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:958] 0
2019-04-22 21:09:10.316700: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0: N
2019-04-22 21:09:10.316915: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1084] Created TensorFlow device (/device:GPU:0 with 1384 MB memory) -> physical GPU (device: 0, name: GeForce MX150, pci bus id: 0000:01:00.0, compute capability: 6.1)
2019-04-22 21:09:10.563789: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1471] Adding visible gpu devices: 0
2019-04-22 21:09:10.564005: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-04-22 21:09:10.564243: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:958] 0
2019-04-22 21:09:10.564400: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0: N
try load model from ./model/s2ss_chatbot.ckpt
2019-04-22 21:09:10.682842: W T:\src\github\tensorflow\tensorflow\core\framework\op_kernel.cc:1318] OP_REQUIRES failed at save_restore_tensor.cc:170 : Not found: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ./model/s2ss_chatbot.ckpt
Traceback (most recent call last):
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\client\session.py”, line 1322, in _do_call
return fn(*args)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\client\session.py”, line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\client\session.py”, line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ./model/s2ss_chatbot.ckpt
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, …, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “F:/tensorflow_workspace/chatbot/test.py”, line 69, in
main()
File “F:/tensorflow_workspace/chatbot/test.py”, line 66, in main
test(json.load(open(‘params.json’)))
File “F:/tensorflow_workspace/chatbot/test.py”, line 38, in test
model_pred.load(sess,save_path)
File “F:\tensorflow_workspace\chatbot\seqence_to_sequence.py”, line 759, in load
self.saver.restore(sess, save_path)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\training\saver.py”, line 1768, in restore
six.reraise(exception_type, exception_value, exception_traceback)
File “F:\Anaconda\envs\nlp\lib\site-packages\six.py”, line 693, in reraise
raise value
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\training\saver.py”, line 1752, in restore
{self.saver_def.filename_tensor_name: save_path})
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\client\session.py”, line 900, in run
run_metadata_ptr)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\client\session.py”, line 1135, in _run
feed_dict_tensor, options, run_metadata)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\client\session.py”, line 1316, in _do_run
run_metadata)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\client\session.py”, line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ./model/s2ss_chatbot.ckpt
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, …, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
Caused by op ‘save/RestoreV2’, defined at:
File “F:/tensorflow_workspace/chatbot/test.py”, line 69, in
main()
File “F:/tensorflow_workspace/chatbot/test.py”, line 66, in main
test(json.load(open(‘params.json’)))
File “F:/tensorflow_workspace/chatbot/test.py”, line 32, in test
**params
File “F:\tensorflow_workspace\chatbot\seqence_to_sequence.py”, line 195, in init
self.build_model()
File “F:\tensorflow_workspace\chatbot\seqence_to_sequence.py”, line 212, in build_model
self.saver = tf.train.Saver()
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\training\saver.py”, line 1284, in init
self.build()
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\training\saver.py”, line 1296, in build
self._build(self._filename, build_save=True, build_restore=True)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\training\saver.py”, line 1333, in _build
build_save=build_save, build_restore=build_restore)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\training\saver.py”, line 781, in _build_internal
restore_sequentially, reshape)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\training\saver.py”, line 400, in _AddRestoreOps
restore_sequentially)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\training\saver.py”, line 832, in bulk_restore
return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\ops\gen_io_ops.py”, line 1546, in restore_v2
shape_and_slices=shape_and_slices, dtypes=dtypes, name=name)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\framework\op_def_library.py”, line 787, in _apply_op_helper
op_def=op_def)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\framework\ops.py”, line 3414, in create_op
op_def=op_def)
File “F:\Anaconda\envs\nlp\lib\site-packages\tensorflow\python\framework\ops.py”, line 1740, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ./model/s2ss_chatbot.ckpt
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, …, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
Process finished with exit code 1
1回答
-
Mr_Ricky
2019-04-29
应该是模型保存和恢复出了问题,找下这块的代码看看
00
相似问题