Skip to content
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

use compat.v1 in examples #1486

Open
wants to merge 3 commits into
base: master
from

Conversation

@michaelschiff
Copy link

michaelschiff commented Nov 12, 2019

Following the example per (https://www.tensorflow.org/tfx/serving/serving_basic) results in the following error:

-> % rm -rf /tmp/mnist
-> % tools/run_in_docker.sh python tensorflow_serving/example/mnist_saved_model.py /tmp/mnist
== Pulling docker image: tensorflow/serving:nightly-devel
nightly-devel: Pulling from tensorflow/serving
7ddbc47eeb70: Pull complete
c1bbdc448b72: Pull complete
8c3b70e39044: Pull complete
45d437916d57: Pull complete
761eda96e661: Pull complete
a1b3c36f2fa2: Pull complete
6d8d8654b44d: Pull complete
62d7bd5ff8df: Pull complete
976fdd344e03: Pull complete
b7f28967e9bf: Pull complete
4a092ac5dea5: Pull complete
10546539adb2: Pull complete
22829b62ad91: Pull complete
Digest: sha256:6d46002d44521303961d988bfc92eeeaea9a69f3c1892f8b5d9a426dbcb44c9d
Status: Downloaded newer image for tensorflow/serving:nightly-devel
== Running cmd: sh -c 'cd /Users/schiff/Documents/tensorflow-serving; python tensorflow_serving/example/mnist_saved_model.py /tmp/mnist'
Traceback (most recent call last):
  File "tensorflow_serving/example/mnist_saved_model.py", line 39, in <module>
    tf.app.flags.DEFINE_integer('training_iteration', 1000,
AttributeError: 'module' object has no attribute 'app'
@googlebot googlebot added the cla: yes label Nov 12, 2019
@michaelschiff

This comment has been minimized.

Copy link
Author

michaelschiff commented Nov 12, 2019

after updating training and client code, mnist example works without issues:

-> % tools/run_in_docker.sh python tensorflow_serving/example/mnist_saved_model.py \
  /tmp/mnist
== Pulling docker image: tensorflow/serving:nightly-devel
nightly-devel: Pulling from tensorflow/serving
Digest: sha256:6d46002d44521303961d988bfc92eeeaea9a69f3c1892f8b5d9a426dbcb44c9d
Status: Image is up to date for tensorflow/serving:nightly-devel
== Running cmd: sh -c 'cd /Users/schiff/Documents/tensorflow-serving; python tensorflow_serving/example/mnist_saved_model.py /tmp/mnist'
Training model...
Extracting /tmp/train-images-idx3-ubyte.gz
Extracting /tmp/train-labels-idx1-ubyte.gz
Extracting /tmp/t10k-images-idx3-ubyte.gz
Extracting /tmp/t10k-labels-idx1-ubyte.gz
2019-11-12 20:24:21.148476: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-11-12 20:24:21.164037: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 483735000 Hz
2019-11-12 20:24:21.165761: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55a6e9869af0 executing computations on platform Host. Devices:
2019-11-12 20:24:21.165890: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): Host, Default Version
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling __init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
W1112 20:24:21.248850 140492612204352 deprecation.py:506] From /usr/local/lib/python2.7/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling __init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
training accuracy 0.9092
Done training!
Exporting trained model to /tmp/mnist/1
WARNING:tensorflow:From tensorflow_serving/example/mnist_saved_model.py:103: build_tensor_info (from tensorflow.python.saved_model.utils_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.utils.build_tensor_info or tf.compat.v1.saved_model.build_tensor_info.
W1112 20:24:24.244277 140492612204352 deprecation.py:323] From tensorflow_serving/example/mnist_saved_model.py:103: build_tensor_info (from tensorflow.python.saved_model.utils_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.utils.build_tensor_info or tf.compat.v1.saved_model.build_tensor_info.
INFO:tensorflow:No assets to save.
I1112 20:24:24.251677 140492612204352 builder_impl.py:637] No assets to save.
INFO:tensorflow:No assets to write.
I1112 20:24:24.252953 140492612204352 builder_impl.py:457] No assets to write.
INFO:tensorflow:SavedModel written to: /tmp/mnist/1/saved_model.pb
I1112 20:24:24.467704 140492612204352 builder_impl.py:422] SavedModel written to: /tmp/mnist/1/saved_model.pb
Done exporting!
-> % tools/run_in_docker.sh python tensorflow_serving/example/mnist_client.py \
  --num_tests=1000 --server=127.0.0.1:8500
== Pulling docker image: tensorflow/serving:nightly-devel
nightly-devel: Pulling from tensorflow/serving
Digest: sha256:6d46002d44521303961d988bfc92eeeaea9a69f3c1892f8b5d9a426dbcb44c9d
Status: Image is up to date for tensorflow/serving:nightly-devel
== Running cmd: sh -c 'cd /Users/schiff/Documents/tensorflow-serving; python tensorflow_serving/example/mnist_client.py --num_tests=1000 --server=127.0.0.1:8500'
Extracting /tmp/train-images-idx3-ubyte.gz
Extracting /tmp/train-labels-idx1-ubyte.gz
Extracting /tmp/t10k-images-idx3-ubyte.gz
Extracting /tmp/t10k-labels-idx1-ubyte.gz
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Inference error rate: 10.4%
@peter-mourfield

This comment has been minimized.

Copy link

peter-mourfield commented Nov 12, 2019

This works for me! I closed #1470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.