Sfoglia il codice sorgente

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 anni fa
parent
commit
6601008ff2
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  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)