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

'Graph' object has no attribute 'SerializeToString' when run 'sudo python cifar10_train.py' #1690

Closed
NicholasYuan opened this issue Mar 29, 2016 · 8 comments

Comments

@NicholasYuan
Copy link

Environment info

Operating System:
Mac os 10.10.5

I install the Tensorflow with sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.7.1-cp27-none-any.whl

and run
sudo python cifar10_train.py

I got an error.

ERROR in shell

$ sudo python cifar10_train.py 
Filling queue with 20000 CIFAR images before starting to train. This will take a few minutes.
Traceback (most recent call last):
  File "cifar10_train.py", line 134, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/platform/default/_app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "cifar10_train.py", line 130, in main
    train()
  File "cifar10_train.py", line 96, in train
    summary_writer = tf.train.SummaryWriter(FLAGS.train_dir, sess.graph)
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/training/summary_io.py", line 104, in __init__
    self.add_graph(graph_def)
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/training/summary_io.py", line 168, in add_graph
    graph_bytes = graph_def.SerializeToString()
AttributeError: 'Graph' object has no attribute 'SerializeToString'

Please help.

@vrv
Copy link

vrv commented Mar 29, 2016

Check out the github repo at the r0.7 branch if you want to run code using 0.7.1 -- github master may introduce incompatibilities with the pip installs until we reach 1.0

@vrv vrv closed this as completed Mar 29, 2016
@kYroL01
Copy link

kYroL01 commented Apr 13, 2016

@vrv well this dont solve the question.
If we follow the instruction here get this error because you say that version 0.7.1 make some incompatibilities for pip.
So I try to follow your advice cloning from 0.7 branch, but there are the problem of ImportError: No module named tensorflow.

@evankozliner
Copy link

evankozliner commented Apr 17, 2016

Has anyone resolved this issue?

I've tried changing my version to 7.1 using:

sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl

As well as changing the branch of tensorflow to the r0.7 branch:
the output of git branch

* (HEAD detached at origin/r0.7) master
However I still receive AttributeError: 'Graph' object has no attribute 'SerializeToString' upon running sudo python cifar10_train.py

@vrv Is there anything I'm missing to run the old version of the example here?

EDIT
I'm running ubuntu 14.04

@vrv
Copy link

vrv commented Apr 17, 2016

I would try upgrading to 0.8 now, there might have been some fixes since then.

If not, can you paste the entire stack trace, so we can see where this might be coming from?

@evankozliner
Copy link

Thanks for your timely response @vrv ! :) Upgrading to 8.0 did the trick.

Just in case anyone doesn't feel like going to the site, here's the command to upgrade:
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0rc0-cp27-none-linux_x86_64.whl

@NicholasYuan
Copy link
Author

This problem has been solved by upgrading to 8.0. Thanks for everyone.

@liusida
Copy link

liusida commented Sep 19, 2016

File "cifar10_train.py", line 96, in train
summary_writer = tf.train.SummaryWriter(FLAGS.train_dir, sess.graph)
this should be

summary_writer = tf.train.SummaryWriter(FLAGS.train_dir, sess.graph.as_graph_def())
It should solve the problem without upgrading Tensorflow.

@richardsun-voyager
Copy link

Thanks, updating tensorflow to 0.8 could solve the problem indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants