Created
February 13, 2019 19:33
-
-
Save wronk/01fba42026b336d2400c501f13bc68ed to your computer and use it in GitHub Desktop.
TF Serving blog post: creating and saving TF estimator object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define a place to save your compiled model | |
export_dir = '/path/to/my_exported_models/001' | |
# Define a path to your trained keras model and load it in as a `tf.keras.models.Model` | |
# If you just trained your model, you may already have it in memory and can skip the below 2 lines | |
model_save_fpath = '/path/to/my_model.h5' | |
keras_model = tf.keras.models.load_model(model_save_fpath) | |
# Create an Estimator object | |
estimator_save_dir = '/path/to/save/estimator' | |
estimator = tf.keras.estimator.model_to_estimator(keras_model=keras_model, | |
model_dir=estimator_save_dir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment