2
votes

In Keras you can load a model that you had previously trained by using:

trained_keras_model = tf.keras.models.load_model(model_name)

Is there any equivalent method for doing this using TensorFlow estimator API? According to the documentation, I have to use:

trained_estimator = tf.estimator.Estimator (model_fn,model_dir) I want to get the trained estimator using just the files in the model directory. To be more clear my idea was to load "any" model from disk without having the model_fn source code. Is it possible to do it this way?

This feature is implemented in Keras so I am at a loss to understand why Estimator API cannot do this.

1

1 Answers

2
votes

I'd use Estimator.export_savedmodel(). This will save the weights + graph in a format suitable for serving. You might also check out https://github.com/ajbouh/tfi for a super easy way to use SavedModels from Python (but go with TensorFlow serving for production use-cases).