saver.save 및 FileWriter 함수를 사용하여 검사 점 파일과 이벤트 로그를 직접 hdfs에 쓸 수 있습니까?파일 "test_hdfs.py", save_path = saver.save (sess, hdfs_path + "save_net.ckpt") "{}의 상위 디렉토리가 없으므로 저장할 수 없습니다."(형식 (save_path))
W = tf.Variable([[1,2,3],[3,4,5]], dtype=tf.float32, name='weights')
b = tf.Variable([[1,2,3]], dtype=tf.float32, name='biases')
init = tf.global_variables_initializer()
saver = tf.train.Saver()
with tf.Session() as sess:
sess.run(init)
save_path = saver.save(sess, hdfs_path+"save_net.ckpt")
print("Save to path: ", hdfs_path)
내가 로컬 경로에 hdfs_path를 교체 할 때, 그것은 확인을 실행합니다
나는 내 코드를 실행합니다. 그러나 hdfs_path를 실행할 때 :
File "test_hdfs.py", line 73, in <module>
save_path = saver.save(sess, hdfs_path+"save_net.ckpt")
File "/data/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1354, in save
"Parent directory of {} doesn't exist, can't save.".format(save_path))
tf.summary.FileWriter 기능을 사용할 때도 마찬가지입니다. hdfs_path를 사용할 때 프로그램이 멈추었습니다. local_path를 사용하면 ok가 실행됩니다.
내 전체 코드는 다음과 같다 :
hdfs_path="hdfs://*"
local_path = "./"
with tf.Session(graph=tf.get_default_graph()) as sess:
W = tf.Variable([[1,2,3],[3,4,5]], dtype=tf.float32, name='weights')
b = tf.Variable([[1,2,3]], dtype=tf.float32, name='biases')
init = tf.group(tf.global_variables_initializer(),tf.local_variables_initializer())
saver = tf.train.Saver()
sess.run(init)
summary_writer = tf.summary.FileWriter(hdfs_path,graph_def=sess.graph_def)
saver.save(sess,save_path=hdfs_path+"save_net.ckpt")
나는 내 환경을 테스트했고, Popen을 사용하여 파이썬 코드를 통해 파일을 hdfs에 쓸 수있다. https://github.com/tensorflow/tensorflow/issues/5112의 다른 질문은 tensorflow 0.11을 사용할 때이 문제를 해결했습니다. 따라서 tensorflow 1.0이 hdfs를 직접 작성할 수 있다고 생각합니다. –
덧글을 게시하는 대신 해당 정보를 질문에 편집 할 수 있습니다. – WhatsThePoint
코드를 변경하여 질문에 맞게 편집하면 형식을 올바르게 지정할 수 있습니다. – WhatsThePoint