2

I tried to run the iris_save_restore.py example from skflow, without changing the code at all.

However, I got an error, and I am unsure how to proceed. It seems that it happened when it restores the model from a saved file.

new_classifier = skflow.TensorFlowEstimator.restore('/tmp/skflow_examples/iris_custom_model')
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
score = metrics.accuracy_score(y_test, new_classifier.predict(X_test))
print('Accuracy: {0:f}'.format(score))  File "/Users/hamayu/.pyenv/versions/anaconda2-2.5.0/lib/python2.7/site-packages/skflow/estimators/base.py", line 463, in restore
    estimator._restore(path)
  File "/Users/hamayu/.pyenv/versions/anaconda2-2.5.0/lib/python2.7/site-packages/skflow/estimators/base.py", line 401, in _restore
    saver_def = tf.python.training.saver_pb2.SaverDef()
AttributeError: 'module' object has no attribute 'saver_pb2'

I use the following versions:

  • anaconda2-2.5.0
  • tensorflow 0.7 CPU-only for Mac OS X
  • skflow 0.1.0

How can I fix it?

mrry
  • 125,488
  • 26
  • 399
  • 400
Hummer
  • 21
  • 1
  • 3

2 Answers2

4

This looks like a bug in skflow: the current version of skflow is not compatible with the latest version of TensorFlow (0.7.0 and up). I submitted a pull request to fix it. (EDIT: The pull request has now been merged, so upgrading to the latest version of skflow will also fix things.)

In the meantime, you can fix it by editing line 401 of "skflow/estimators/base.py" (full path in your stacktrace), and replacing:

saver_def = tf.python.training.saver_pb2.SaverDef()

...with:

saver_def = tf.train.SaverDef()
mrry
  • 125,488
  • 26
  • 399
  • 400
0

The author just fixed this issue today: https://github.com/tensorflow/skflow/issues/144. You'd have to remove and reinstall skflow from github (the most up-to-date release).

Keng
  • 854
  • 10
  • 10