Skip to content

import sagemaker.tensorflow is broken after upgrading TF serving #139

@zmjjmz

Description

@zmjjmz

Hey there,

So I recently upgraded my local tensorflow serving version to uh, 1.5:

(dataplayground2) zach@wa1okdba002:~/stats/omc/utils$ apt-cache show tensorflow-model-server           
Package: tensorflow-model-server
Version: 1.5.0
Architecture: all
Maintainer: TensorFlow Serving team
Priority: optional
Section: contrib/devel
Filename: pool/tensorflow-model-server/t/tensorflow-model-server/tensorflow-model-server_1.5.0_all.deb
Size: 89631204
SHA256: 4f25bde0f8dad88ec5184d060e5e10d2c15f1241977f72e50d233d5f7ddb6fa6
SHA1: a20e4e9d242cf874b12289ba9a8fb3cc97da7df7
MD5sum: 8867dad0c1258813a8a75b46ef8df536
Description: TensorFlow Serving ModelServer
Description-md5: 9b7e03f5296f318009581d6e285e2f89
Homepage: https://github.com/tensorflow/serving
Built-Using: Bazel

And my tensorflow-serving-api package as well:

tensorflow-serving-api==1.6.0

After this upgrade, I realized I can't run import sagemaker.tensorflow in Python using the latest sagemaker SDK version (1.2.2) (also the version that I had installed before I realized I hadn't updated it and did so in the vain hope of fixing this issue).

The exact issue I get is as follows:

(dataplayground2) zach@wa1okdba002:~/stats/omc/utils$ python -c "import sagemaker.tensorflow"
/home/u1/zach/proj/dataplayground2/local/lib/python2.7/site-packages/h5py/__init__.py:34: FutureWarning: Conversion of the second argum
ent of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/u1/zach/proj/dataplayground2/local/lib/python2.7/site-packages/sagemaker/tensorflow/__init__.py", line 28, in <module>
    from sagemaker.tensorflow.estimator import TensorFlow  # noqa: E402
  File "/home/u1/zach/proj/dataplayground2/local/lib/python2.7/site-packages/sagemaker/tensorflow/estimator.py", line 25, in <module>
    from sagemaker.tensorflow.model import TensorFlowModel
  File "/home/u1/zach/proj/dataplayground2/local/lib/python2.7/site-packages/sagemaker/tensorflow/model.py", line 18, in <module>
    from sagemaker.tensorflow.predictor import tf_json_serializer, tf_json_deserializer
  File "/home/u1/zach/proj/dataplayground2/local/lib/python2.7/site-packages/sagemaker/tensorflow/predictor.py", line 22, in <module>
    from tensorflow_serving.apis import predict_pb2, classification_pb2, inference_pb2, regression_pb2
  File "/home/u1/zach/proj/dataplayground2/local/lib/python2.7/site-packages/sagemaker/tensorflow/tensorflow_serving/apis/inference_pb2
.py", line 16, in <module>
    from tensorflow_serving.apis import classification_pb2 as tensorflow__serving_dot_apis_dot_classification__pb2
  File "/home/u1/zach/proj/dataplayground2/local/lib/python2.7/site-packages/tensorflow_serving/apis/classification_pb2.py", line 26, i
n <module>
    dependencies=[tensorflow__serving_dot_apis_dot_input__pb2.DESCRIPTOR,tensorflow__serving_dot_apis_dot_model__pb2.DESCRIPTOR,])
  File "/home/u1/zach/proj/dataplayground2/local/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 829, in __new__
    return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "tensorflow_serving/apis/classification.proto":
  tensorflow_serving/apis/classification.proto: A file with this name is already in the pool.

It seems to me like somehow it's trying to load that tensorflow_serving/apis/classification.proto twice, which is probably not intentional, although I'll note that I'm able to do this myself with no issues:

(dataplayground2) zach@wa1okdba002:~/stats/omc/utils$ python -c "from tensorflow_serving.apis import classification_pb2; from tensorflow_serving.apis import classification_pb2"
(dataplayground2) zach@wa1okdba002:~/stats/omc/utils$

At the moment this is entirely preventing me from using SageMaker through the Python SDK which is certainly a problem...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions