![FailedPreconditionError:/home/timucin/Thesis/Tagger-master8/train;是一个目录](https://linux22.com/image/908783/FailedPreconditionError%3A%2Fhome%2Ftimucin%2FThesis%2FTagger-master8%2Ftrain%3B%E6%98%AF%E4%B8%80%E4%B8%AA%E7%9B%AE%E5%BD%95.png)
我收到以下错误:
FailedPreconditionError: /home/timucin/Thesis/Tagger-master8/train; Is a directory
[[{{node input_queues/examples_queue/parallel_read/ReaderReadV2}} = ReaderReadV2[_device="/job:localhost/replica:0/task:0/device:CPU:0"](input_queues/examples_queue/parallel_read/TFRecordReaderV2, input_queues/examples_queue/parallel_read/filenames)]]
在运行语义角色标记的训练会话时。我在 Ubuntu 18.04 上使用 python 2.7 (anaconda) 和 TensorFlow 1.12。
当我第一次运行脚本时,会创建训练目录来存储检查点,并且会话终止且没有错误。
在第二次试验中,由于已经创建了训练目录,脚本会查看检查点以评估在已完成的步骤之上是否有新的步骤,并以上述错误终止。当我删除目录内容时,我会收到相同的错误。但是如果我删除目录,错误就会消失。
我猜想文件 I/O 就是我将其发布到这个论坛的原因。
我很高兴收到您的反馈...提前致谢,Timucin
追溯:
INFO:tensorflow:Total trainable variables size: 8187305
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from train/model.ckpt-10
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.FailedPreconditionError'>, /home/timucin/Thesis/Tagger-master8/train; Is a directory
[[{{node input_queues/examples_queue/parallel_read/ReaderReadV2}} = ReaderReadV2[_device="/job:localhost/replica:0/task:0/device:CPU:0"](input_queues/examples_queue/parallel_read/TFRecordReaderV2, input_queues/examples_queue/parallel_read/filenames)]]
INFO:tensorflow:Saving checkpoints for 10 into train/model.ckpt.
Traceback (most recent call last):
File "<ipython-input-6-5b359d738d7d>", line 1, in <module>
runfile('/home/timucin/Thesis/Tagger-master8/main.py', args='train --model_name deepatt --vocab_path /home/timucin/Thesis/Tagger-master-old/word_dict /home/timucin/Thesis/Tagger-master-old/label_dict --data_path /home/timucin/Thesis/Tagger-master8/ --model_dir train --model_params=feature_size=100,hidden_size=200,filter_size=800,residual_dropout=0.2,num_hidden_layers=10,attention_dropout=0.1,relu_dropout=0.1 --training_params=batch_size=4096,eval_batch_size=1024,optimizer=Adadelta,initializer=orthogonal,use_global_initializer=false,initializer_gain=1.0,train_steps=15,learning_rate_decay=piecewise_constant,learning_rate_values=[1.0,0.5,0.25],learning_rate_boundaries=[400000,500000],device_list=[0],clip_grad_norm=1.0', wdir='/home/timucin/Thesis/Tagger-master8')
File "/home/timucin/anaconda2/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 704, in runfile
execfile(filename, namespace)
File "/home/timucin/anaconda2/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 100, in execfile
builtins.execfile(filename, *where)
File "/home/timucin/Thesis/Tagger-master8/main.py", line 892, in <module>
train(parsed_args)
File "/home/timucin/Thesis/Tagger-master8/main.py", line 540, in train
experiment.train()
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 389, in train
saving_listeners=self._saving_listeners)
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 886, in _call_train
input_fn=input_fn, steps=steps, max_steps=max_steps, monitors=hooks)
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 525, in fit
loss = self._train_model(input_fn=input_fn, hooks=hooks)
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1095, in _train_model
_, loss = mon_sess.run([model_fn_ops.train_op, model_fn_ops.loss])
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 783, in __exit__
self._close_internal(exception_type)
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 821, in _close_internal
self._sess.close()
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 1069, in close
self._sess.close()
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 1229, in close
ignore_live_threads=True)
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/coordinator.py", line 389, in join
six.reraise(*self._exc_info_to_raise)
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/queue_runner_impl.py", line 257, in _run
enqueue_callable()
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1257, in _single_operation_run
self._call_tf_sessionrun(None, {}, [], target_list, None)
File "/home/timucin/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
run_metadata)
FailedPreconditionError: /home/timucin/Thesis/Tagger-master8/train; Is a directory
[[{{node input_queues/examples_queue/parallel_read/ReaderReadV2}} = ReaderReadV2[_device="/job:localhost/replica:0/task:0/device:CPU:0"](input_queues/examples_queue/parallel_read/TFRecordReaderV2, input_queues/examples_queue/parallel_read/filenames)]]
答案1
问题解决了。是由于目录结构组织不当造成的...