Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saver errors in 0.7.0 #1135

Closed
aymericdamien opened this issue Feb 17, 2016 · 4 comments
Closed

Saver errors in 0.7.0 #1135

aymericdamien opened this issue Feb 17, 2016 · 4 comments
Assignees
Labels

Comments

@aymericdamien
Copy link
Contributor

In 0.7, there are different errors about Saver, first Warnings in serialization, such as moving averages, or dictionaries:

WARNING:tensorflow:Error encountered when serializing moving_average_variables.
Type is unsupported, or the types of the items don't match field type in CollectionDef.
unbound method to_proto() must be called with Variable instance as first argument (got Tensor instance instead)
WARNING:tensorflow:Error encountered when serializing summary_tags.
Type is unsupported, or the types of the items don't match field type in CollectionDef.
'dict' object has no attribute 'name'

and then, it throws an OS Error:

  File "/Users/aymeric/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 970, in save
    self.export_meta_graph(meta_graph_file_name)
  File "/Users/aymeric/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 990, in export_meta_graph
    as_text=as_text)
  File "/Users/aymeric/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1315, in export_meta_graph
    os.path.basename(filename), as_text=as_text)
  File "/Users/aymeric/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/training_util.py", line 70, in write_graph
    gfile.MakeDirs(logdir)
  File "/Users/aymeric/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/default/_gfile.py", line 295, in MakeDirs
    os.makedirs(path, mode)
  File "/Users/aymeric/anaconda2/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 2] No such file or directory: ''

But this is working well in 0.6.0, so Saver might have some issues in 0.7.0

@vrv vrv added the bug label Feb 17, 2016
@mrry mrry assigned mrry and unassigned sherrym Feb 17, 2016
@mrry
Copy link
Contributor

mrry commented Feb 17, 2016

Thanks for reporting this bug! You can safely ignore the warnings, which are related to the new MetaGraphDef support. If you want to be able to serialize your collections and avoid this warning, you can call the tf.register_proto_function() function for your collection.

The OSError is a bigger problem, and is caused by an incompatibility between our internal and external tf.gfile.MakeDirs() functions. As a temporary workaround, prepend "./" to the save_path argument when calling Saver.save(). I have a change in the pipeline that will fix this error.

@vrv vrv closed this as completed in 42f06d8 Feb 17, 2016
vrv pushed a commit that referenced this issue Feb 17, 2016
1. The cifar10_train.py example model was emitting warnings, because of
   non-Variable objects in the `tf.moving_average_variables()`
   collection. This change fixes that by only adding `Variable`-typed
   objects to that collection in `moving_averages.py` (which better
   agrees with the definition in `tf.GraphKeys.MOVING_AVERAGES_VARIABLES`).

2. Saver.save() now calls `tf.gfile.MakeDirs(os.path.dirname(save_path))`,
   which fails if `save_path` does not contain a directory component.
   This change fixes the implementation of `tf.gfile.MakeDirs('')` to be a
   no-op (which better matches the internal library that it is shadowing).

Fixes #1123. Fixes #1135.
Change: 114895020
@vrv
Copy link

vrv commented Feb 17, 2016

If someone can validate that the above commit fixes the problem with Saver, that would be appreciated!

@vrv
Copy link

vrv commented Feb 18, 2016

(I was able to run cifar10_train.py with no problems after the above commit).

@aymericdamien
Copy link
Contributor Author

It is working fine now, thanks!

lene added a commit to lene/nn-wtf that referenced this issue Feb 21, 2016
work around TensorFlow bug #1135 <tensorflow/tensorflow#1135> which makes it necessary for a train_dir string to be suffixed with a "/"
@aselle aselle added type:bug Bug and removed bug labels Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants