Estimator - Loading previous checkpoint model

When using Estimator API to create and train a model in tensorflow, you can load the checkpoint models automatically by passing model_dir parameter while instantiating learn.Estimator.

For example,

import tensorflow as tf
learn = tf.contrib.learn
..
..
def rnn_model(features, target):
""" Custom rnn model code returning ModelFnOps(mode, predictions, loss, train_op, eval_metric_ops)"""
...
...
classifier = learn.Estimator(model_fn=model_fn,model_dir='./run/checkpoints/')
..
classifier.fit(x_train, y_train, steps=10000)

Estimator API will automatically find the latest model in directory "./run/checkpoints/" and load it.

If model_dir parameter is skipped then it creates a temporary directory to store new checkpoints.

results for ""

    No results matching ""