Skip to content

Update serving example to build with current TF Serving #12

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chapters/07_production/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ py_binary(
"export.py",
],
deps = [
"@tf_serving//tensorflow_serving/session_bundle:exporter",
"@org_tensorflow//tensorflow/contrib/session_bundle:exporter",
"@org_tensorflow//tensorflow:tensorflow_py",
# only needed for inception model export
"@inception_model//inception",
Expand Down
12 changes: 6 additions & 6 deletions chapters/07_production/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ workspace(name = "serving")

local_repository(
name = "tf_serving",
path = __workspace_dir__ + "/tf_serving",
path = "tf_serving",
)

local_repository(
name = "org_tensorflow",
path = __workspace_dir__ + "/tf_serving/tensorflow",
path = "tf_serving/tensorflow",
)

load('//tf_serving/tensorflow/tensorflow:workspace.bzl', 'tf_workspace')
tf_workspace("tf_serving/tensorflow/", "@org_tensorflow")
load('@org_tensorflow//tensorflow:workspace.bzl', 'tf_workspace')
tf_workspace()

bind(
name = "libssl",
actual = "@boringssl_git//:ssl",
actual = "@boringssl//:ssl",
)

bind(
Expand All @@ -27,5 +27,5 @@ bind(

local_repository(
name = "inception_model",
path = __workspace_dir__ + "/tf_serving/tf_models/inception",
path = "tf_serving/tf_models/inception",
)
4 changes: 2 additions & 2 deletions chapters/07_production/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import sys

import tensorflow as tf
from tensorflow_serving.session_bundle import exporter
from tensorflow.contrib.session_bundle import exporter
from inception import inception_model

NUM_CLASSES_TO_RETURN = 10
Expand Down Expand Up @@ -43,7 +43,7 @@ def inference(images):
# Restore variables from training checkpoints.
ckpt = tf.train.get_checkpoint_state(sys.argv[1])
if ckpt and ckpt.model_checkpoint_path:
saver.restore(sess, sys.argv[1] + "/" + ckpt.model_checkpoint_path)
saver.restore(sess, ckpt.model_checkpoint_path)
else:
print("Checkpoint file not found")
raise SystemExit
Expand Down