我正在尝试运行从GitHub克隆的Speech_Commands示例程序。
我已经完成了程序模型部分的训练(运行train.py代码)。我无法冻结模型。
我运行的代码是:
python "C:\Program Files\python35\Lib\site-packages\tensorflow\examples\speech_commands\freeze.py" \
我得到的结果是:
2018-06-27 11:58:31.251547: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2018-06-27 11:58:31.314516: 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
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1322, in _do_call
return fn(*args)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "C:\Program Files\Python35\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
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _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 "C:\Program Files\python35\Lib\site-packages\tensorflow\examples\speech_commands\freeze.py", line 180, in <module>
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run
_sys.exit(main(argv))
File "C:\Program Files\python35\Lib\site-packages\tensorflow\examples\speech_commands\freeze.py", line 117, in main
models.load_variables_from_checkpoint(sess, FLAGS.start_checkpoint)
File "C:\Program Files\python35\Lib\site-packages\tensorflow\examples\speech_commands\models.py", line 123, in load_variables_from_checkpoint
saver.restore(sess, start_checkpoint)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1802, in restore
{self.saver_def.filename_tensor_name: save_path})
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\client\session.py", line 900, in run
run_metadata_ptr)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1316, in _do_run
run_metadata)
File "C:\Program Files\Python35\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
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _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 "C:\Program Files\python35\Lib\site-packages\tensorflow\examples\speech_commands\freeze.py", line 180, in <module>
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run
_sys.exit(main(argv))
File "C:\Program Files\python35\Lib\site-packages\tensorflow\examples\speech_commands\freeze.py", line 117, in main
models.load_variables_from_checkpoint(sess, FLAGS.start_checkpoint)
File "C:\Program Files\python35\Lib\site-packages\tensorflow\examples\speech_commands\models.py", line 122, in load_variables_from_checkpoint
saver = tf.train.Saver(tf.global_variables())
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1338, in __init__
self.build()
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1347, in build
self._build(self._filename, build_save=True, build_restore=True)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1384, in _build
build_save=build_save, build_restore=build_restore)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 835, in _build_internal
restore_sequentially, reshape)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 472, in _AddRestoreOps
restore_sequentially)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 886, in bulk_restore
return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
File "C:\Program Files\Python35\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 "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 3392, in create_op
op_def=op_def)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1718, 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
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
我尚未对下载的代码进行任何更改。
我发现有人遇到类似的问题here.,但他们没有提到他们是如何解决问题的。如果有人可以帮助,那就太好了。
非常感谢。