tensorflow / skflow

Simplified interface for TensorFlow (mimicking Scikit Learn) for Deep Learning
Apache License 2.0
3.18k stars 439 forks source link

Error on TensorFlowEstimator.restore (tensorflow.python.pywrap_tensorflow.StatusNotOK: Internal: Unable to get element from the feed.) #43

Closed ycyoon closed 8 years ago

ycyoon commented 8 years ago

There's an error on restoring model when I executing a code below.

import skflow from sklearn import datasets, metrics

iris = datasets.load_iris() classifier = skflow.TensorFlowDNNClassifier(hidden_units=[10, 20, 10], n_classes=3) classifier.fit(iris.data, iris.target) classifier.save('test_model') new_clf = skflow.TensorFlowEstimator.restore('test_model') score = metrics.accuracy_score(new_clf.predict(iris.data), iris.target) print("Accuracy: %f" % score)

Traceback (most recent call last): File "dnn_save.py", line 8, in new_clf = skflow.TensorFlowEstimator.restore('test_model') File "/usr/local/lib/python2.7/dist-packages/skflow/init.py", line 353, in restore estimator._restore(path) File "/usr/local/lib/python2.7/dist-packages/skflow/init.py", line 325, in _restore self._saver.restore(self._session, checkpoint_path) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 864, in restore sess.run([self._restore_op_name], {self._filename_tensor_name: save_path}) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 345, in run results = self._do_run(target_list, unique_fetch_targets, feed_dict_string) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 404, in _do_run target_list) tensorflow.python.pywrap_tensorflow.StatusNotOK: Internal: Unable to get element from the feed.

ilblackdragon commented 8 years ago

Apparently Saver/get_latest_checkpoint doesn't work very well with relative paths: https://github.com/tensorflow/tensorflow/issues/571

For now I'm adding an absolute path override. Note, this may result that when you move folder, you need to change paths inside the checkpoint file (this is also true currently if you provide absolute path).

Hopefully we will fix it in TF to make model state not depend on the absolute path.