I use tf.estimator.train_and_evaluate()
to train my custom estimator. My dataset is partitioned 8:1:1 for training, evaluation and test. At the end of the training, I would like to restore the best model, and evaluate the model using tf.estimator.Estimator.evaluate()
with the test data. The best model is currently exported using tf.estimator.BestExporter
.
While tf.estimator.Estimator.evaluate()
accepts checkpoint_path
and restores variables, I cannot find any easy way to use the exported model generated by tf.estimator.BestExporter
. I could of course keep all checkpoints during training, and look for the best model by myself, but that seems quite suboptimal.
Could anyone tell me an easy workaround? Maybe it is possible to convert a saved model to a checkpoint?
ws
from the answer intomodel = tf.estimator.Estimator( ... , warm_start_from=ws)
and calling bothmodel.evaluate
andtf.estimator.train_and_evaluate(model, ... )
work AS LONG AS there are no checkpoints in the model dir. So make sure model_dir is empty, and then you can either eval or continue training this way. – Yorick