Переглянути джерело

ensure output directory exists

The neural programmer model fails the first time it's run, if the output directory folder does not already exist. In this case "../model" does not exist and the function fails because the mkdir function doesn't appear to create parent folders. 
Error: 
tensorflow.python.framework.errors_impl.NotFoundError: ../model//modeltemp/
Henry-E 8 роки тому
батько
коміт
6601008ff2
1 змінених файлів з 3 додано та 0 видалено
  1. 3 0
      neural_programmer/neural_programmer.py

+ 3 - 0
neural_programmer/neural_programmer.py

@@ -195,6 +195,9 @@ def master(train_data, dev_data, utility):
     else:
       ckpt = tf.train.get_checkpoint_state(model_dir)
       print "model dir: ", model_dir
+      if (not (tf.gfile.IsDirectory(utility.FLAGS.output_dir))):
+        print "create dir: ", utility.FLAGS.output_dir
+        tf.gfile.MkDir(utility.FLAGS.output_dir)
       if (not (tf.gfile.IsDirectory(model_dir))):
         print "create dir: ", model_dir
         tf.gfile.MkDir(model_dir)