New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix estimator convert from Keras to export_savedmodel() #14284 #14354

Merged
merged 3 commits into from Nov 30, 2017

Conversation

Projects
None yet
7 participants
@yjmade
Contributor

yjmade commented Nov 8, 2017

PR for #14284
[FIX]the estimator generate by tf.keras.model_to_estimator() cannot export saved_model because the model_fn provided by _create_keras_model_fn wasn't set export_outputs in the returned EstimatorSpec. Here I provide a default export_outputs with serve_default key and Predict API, and the result inside is same as predictions

[FIX]_save_first_checkpoint call saver.save with only a path and without filename, that make the saved ckpt files with name like {model_dir}/.meta and {model_dir}/.index, which is not be able to found by latest_checkpoint("{model_dir}"). As state by Saver.save(), save_path should be a path to the checkpoint name. So to fix this, I change the name to {model_dir}/keras_model.ckpt

yjmade added some commits Nov 8, 2017

[FIX]the estimator generate by tf.keras.model_to_estimator() cannot e…
…xport saved_model because the model_fn provided by _create_keras_model_fn wasn't set export_outputs in the returned EstimatorSpec. Here I provide a default export_outputs with serve_default key and Predict API, and the result inside is same as predictions

[FIX]_save_first_checkpoint call saver.save with only a path and without filename, that make the ckpt saved with name like `{model_dir}/.meta` and `{model_dir}/.index`, which can not be found by latest_checkpoint("{model_dir}"). As state by save method of Saver, save_path should be a path to the checkpoint name. So to fix this, I change the name to `{model_dir}/keras_model.ckpt`
@tensorflow-jenkins

This comment has been minimized.

Show comment
Hide comment
@tensorflow-jenkins

tensorflow-jenkins Nov 8, 2017

Collaborator

Can one of the admins verify this patch?

Collaborator

tensorflow-jenkins commented Nov 8, 2017

Can one of the admins verify this patch?

@googlebot googlebot added the cla: yes label Nov 8, 2017

@jhseu jhseu requested a review from fchollet Nov 16, 2017

@jhseu jhseu self-assigned this Nov 16, 2017

@fchollet fchollet requested a review from yifeif Nov 16, 2017

@@ -33,6 +35,9 @@
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.training import saver as saver_lib
from tensorflow.python.training import training_util
from tensorflow.python.saved_model import signature_constants

This comment has been minimized.

@yifeif

yifeif Nov 18, 2017

Member

Add new dependency to tensorflow/python/keras/BUILD.

@yifeif

yifeif Nov 18, 2017

Member

Add new dependency to tensorflow/python/keras/BUILD.

@yjmade

This comment has been minimized.

Show comment
Hide comment
@yjmade

yjmade Nov 22, 2017

Contributor

Thanks @yifeif for the review. The PR has been updated with review comments addressed. Please take a look.

Contributor

yjmade commented Nov 22, 2017

Thanks @yifeif for the review. The PR has been updated with review comments addressed. Please take a look.

@yifeif

yifeif approved these changes Nov 30, 2017

@yifeif

This comment has been minimized.

Show comment
Hide comment
@yifeif

yifeif Nov 30, 2017

Member

Thanks @yjmade!

Member

yifeif commented Nov 30, 2017

Thanks @yjmade!

@yifeif yifeif merged commit b76fad1 into tensorflow:master Nov 30, 2017

14 checks passed

Android Demo App Internal CI build successful
Details
GPU CC Internal CI build successful
Details
GPU Python3 Internal CI build successful
Details
MacOS Contrib Internal CI build successful
Details
MacOS Python2 and CC Internal CI build successful
Details
Sanity Checks SUCCESS
Details
Ubuntu CC Internal CI build successful
Details
Ubuntu Makefile Internal CI build successful
Details
Ubuntu Python2 Internal CI build successful
Details
Ubuntu Python3 Internal CI build successful
Details
Ubuntu Sanity Internal CI build successful
Details
Ubuntu contrib Internal CI build successful
Details
ci.tensorflow.org SUCCESS
Details
cla/google All necessary CLAs are signed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment