tensorflow: NotImplementedError for learn.TensorFlowEstimator.restore

I had saved a model using tensorflow.contrib.learn and am currently trying to restore it. However, I am getting a NotImplementedError.

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-9-2a884c20d327> in <module>()
----> 1 gender_classifier = learn.TensorFlowEstimator.restore('gender_classifier_model/')

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/base.pyc in restore(cls, path, config)
    336       custom_estimator = TensorFlowEstimator(model_fn=None, **model_def)
    337       # pylint: disable=protected-access
--> 338       custom_estimator._restore(path)
    339       return custom_estimator
    340 

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/base.pyc in _restore(self, path)
    295       path: Path to checkpoints and other information.
    296     """
--> 297     raise NotImplementedError
    298 
    299   @classmethod

I realized that this is indeed not implemented in the latest commit.

Until this is implemented, are there any workarounds? I tried pickling the model but was not able to do so, as it is a Module object.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

@rifatmahmud Do you have an example where you got it to work?

@ilblackdragon thanks for your response. I already wrote a tensorflow graph myself and make it work. The Estimator class seems not having a model_type as an argument; i.e., I can’t choose what kind of cell to pass in as my network’s major component. And it does not have predict_proba function either. Thanks!

Please don’t use TensorFlowEstimator it’s deprecated and will be removed in next version. Use Estimator for custom models and then you have model_dir to specify to load from existing saved checkpoint.

I wasn’t able to make it works, so I just started to use original tensowrflow without skflow wrapper. Seems like skflow wrapper is very fresh.