【发布时间】:2020-01-03 18:18:03
【问题描述】:
我需要为这个深度学习问题写一个检查点。但是那个错误阻止我写文件。 (E:在 tf.summary.FileWriter)
错误: "tensorflow/core/util/events_writer.cc:104] 写入失败,因为文件无法打开。
我试过这个。重装、删除、授权(tensorflow-gpu、tensorflow、tensorboard)
with tf.Session() as sess:
dir = pickledir
dic_0 = pat_level_arr(dir, 0, [0, 1])
dic_1 = pat_level_arr(dir, 1, [1, 0])
seed = 42
abc = range(len(dic_0))
abcd = range(len(dic_1))
dic_0_train, dic_0_test, _, _ = train_test_split(
dic_0, abc, test_size=0.244, random_state=seed)
dic_1_train, dic_1_test, _, _ = train_test_split(
dic_1, abcd, test_size=0.35, random_state=seed)
dic_train = np.concatenate((dic_0_train, dic_1_train), axis=0)
dic_test = np.concatenate((dic_0_test, dic_1_test), axis=0)
summaries_dir = './logs_level'
#here is the problem "tensorflow/core/util/events_writer.cc:104] Write failed because file could not be opened.
======================================================================
print("here is start\n")
train_writer = tf.summary.FileWriter(summaries_dir + '/train', sess.graph)
test_writer = tf.summary.FileWriter(summaries_dir + '/test')
print("here is end\n")
======================================================================
init = tf.global_variables_initializer()
sess.run(init)
# For train
try:
saver.restore(sess, './modelckpt/inception.ckpt')
print('Model restored')
epoch_saved = data_saved['var_epoch_saved'].eval()
except tf.errors.NotFoundError:
print('No saved model found')
epoch_saved = 1
except tf.errors.InvalidArgumentError:
print('Model structure has change. Rebuild model')
epoch_saved = 1
E tensorflow/core/util/events_writer.cc:104] 写入失败,因为文件无法打开。
ValueError : 传递的 save_path 不是有效的检查点:./modelckpt/inception.ckpt
tensorflow-gpu 版本为 1.10.0。 python版本是3.5(我认为)。 我已经安装了张量板。
【问题讨论】:
-
以前从未见过,您的文件系统中是否已有文件夹?
-
您在尝试恢复之前是否先保存/创建了检查点?
-
这里的问题不是作者,而是你加载 Tensorflow 模型的方式。您可以通过此基本教程阅读本教程,并检查您遵循的步骤是否符合本教程。您也可以参考以下How to Answer (github.com/tensorflow/tensorflow/issues/…),如果有帮助请告诉我。
标签: python tensorflow ubuntu