Is it possible to restore a tensorflow estimator from saved model?
Maybe you can try tf.estimator.WarmStartSettings: https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/estimator/WarmStartSettings
It can load weights in pb file and continue training, which worked on my project.
You can set warm-start as follows:
ws = WarmStartSettings(ckpt_to_initialize_from="/[model_dir]/export/best-exporter/[timestamp]/variables/variables")
And then everythring will be Ok
Based on the resolution to @SumNeuron's Github issue tf.contrib.estimator.SavedModelEstimator
is the way to load from a saved model to an Estimator
.
The following works for me:
estimator = tf.contrib.estimator.SavedModelEstimator(saved_model_dir)
prediction_results = estimator.predict(input_fn)
Baffling that this is essentially completely undocumented.