JimmyP
JimmyP

Reputation: 21

Not able to run fully_connected_feed.py in Tensorflow

I am following the tutorial of TensorFlow Mechanics 101 (version 0.7.0). As per the document, I download the two files (mnist.py and fully_connected_feed.py) and save them to the same directory on my local machine.

When I run the following command:

$ python /FULL_PATH_TO_fully_connected_feed.py/fully_connected_feed.py

...I get this error: OSError: [Errno 2] No such file or directory: ''. The full output and stack trace are below:

...
...  
Step 800: loss = 0.56 (0.005 sec)
Step 900: loss = 0.51 (0.004 sec)
Traceback (most recent call last):
  File "./fully_connected_feed.py", line 228, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/default/_app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "./fully_connected_feed.py", line 224, in main
    run_training()
  File "./fully_connected_feed.py", line 199, in run_training
    saver.save(sess, FLAGS.train_dir, global_step=step)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 970, in save
    self.export_meta_graph(meta_graph_file_name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 990, in export_meta_graph
    as_text=as_text)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1315, in export_meta_graph
    os.path.basename(filename), as_text=as_text)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/training_util.py", line 70, in write_graph
    gfile.MakeDirs(logdir)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/default/_gfile.py", line 295, in MakeDirs
    os.makedirs(path, mode)
  File "/usr/lib/python2.7/os.py", line 160, in makedirs
    mkdir(name, mode)
OSError: [Errno 2] No such file or directory: ''

Upvotes: 1

Views: 497

Answers (2)

Aaron
Aaron

Reputation: 341

This should be a comment to mrry's post (I'm missing reputation)

Changing line #42 from fully_connected_feed.py to

flags.DEFINE_string('train_dir', './data', 'Directory to put the training data.')

solved the problem for me. I'm also on 0.7.0 and was able to run all other mnist examples.

Upvotes: 0

mrry
mrry

Reputation: 126154

This is a bug in the 0.7.0 release of TensorFlow, which was fixed in a recent commit and will appear in a bugfix release shortly. The issue is caused when the --train_dir flag doesn't contain a directory name component.

In the meantime, you can avoid this issue by passing the flag --train_dir=./ when you run the example.

Upvotes: 1

Related Questions