openvinotoolkit / model_server

A scalable inference server for models optimized with OpenVINO™
https://docs.openvino.ai/2024/ovms_what_is_openvino_model_server.html
Apache License 2.0
678 stars 212 forks source link

Tensorflow error while trying to run the real_time_stream_analysis demo #1666

Closed js333031 closed 1 year ago

js333031 commented 1 year ago
user@user-mobl3:~/client2/model_server/demos/real_time_stream_analysis/python$ python real_time_stream_analysis.py --stream_url file:./agitator.mp4 --ovms_url localhost:9000
2023-01-13 09:21:52.818200: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 AVX512F AVX512_VNNI FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-01-13 09:21:53.116746: I tensorflow/core/util/port.cc:104] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2023-01-13 09:21:53.145538: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/user/.local/lib/python3.8/site-packages/cv2/../../lib64:
2023-01-13 09:21:53.145622: I tensorflow/compiler/xla/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "real_time_stream_analysis.py", line 19, in <module>
    from inference_manager import InferenceManager
  File "/home/user/client2/model_server/demos/real_time_stream_analysis/python/inference_manager.py", line 24, in <module>
    from inference_executor import InferenceExecutor
  File "/home/user/client2/model_server/demos/real_time_stream_analysis/python/inference_executor.py", line 18, in <module>
    import ovmsclient
  File "/home/user/.local/lib/python3.8/site-packages/ovmsclient/__init__.py", line 39, in <module>
    from ovmsclient.tfs_compat.grpc.tensors import make_tensor_proto as make_tensor_proto
  File "/home/user/.local/lib/python3.8/site-packages/ovmsclient/tfs_compat/grpc/tensors.py", line 18, in <module>
    from tensorflow.core.framework.tensor_shape_pb2 import TensorShapeProto
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 42, in <module>
    from tensorflow.python import data
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/data/__init__.py", line 21, in <module>
    from tensorflow.python.data import experimental
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/data/experimental/__init__.py", line 96, in <module>
    from tensorflow.python.data.experimental import service
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/data/experimental/service/__init__.py", line 419, in <module>
    from tensorflow.python.data.experimental.ops.data_service_ops import distribute
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/data/experimental/ops/data_service_ops.py", line 22, in <module>
    from tensorflow.python.data.experimental.ops import compression_ops
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/data/experimental/ops/compression_ops.py", line 16, in <module>
    from tensorflow.python.data.util import structure
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/data/util/structure.py", line 22, in <module>
    from tensorflow.python.data.util import nest
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/data/util/nest.py", line 34, in <module>
    from tensorflow.python.framework import sparse_tensor as _sparse_tensor
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/framework/sparse_tensor.py", line 24, in <module>
    from tensorflow.python.framework import constant_op
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/framework/constant_op.py", line 25, in <module>
    from tensorflow.python.eager import execute
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/eager/execute.py", line 21, in <module>
    from tensorflow.python.framework import dtypes
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/framework/dtypes.py", line 42, in <module>
    class DType(
  File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/framework/dtypes.py", line 202, in DType
    def experimental_type_proto(cls) -> Type[types_pb2.SerializedDType]:
AttributeError: module 'tensorflow.core.framework.types_pb2' has no attribute 'SerializedDType'
user@user-mobl3:~/client2/model_server/demos/real_time_stream_analysis/python$ 
js333031 commented 1 year ago

Tensorflow packages installed on the system:

$ pip list | grep -i tensor
tensorboard                  2.11.1
tensorboard-data-server      0.6.1
tensorboard-plugin-wit       1.8.1
tensorflow                   2.11.0
tensorflow-estimator         2.11.0
tensorflow-io-gcs-filesystem 0.29.0
tensorflow-serving-api       2.11.0
js333031 commented 1 year ago

I don't get this error after doing:

pip3 install --upgrade "tensorflow<2.11"

mzegla commented 1 year ago

Currently when you have tensorflow and ovmsclient installed in one environment they might conflict with each other and it seems that for version >= 2.11 that's the case. With the next release of the ovmsclient package this isolation issue will be fixed. Until then, is it possible for you not to install tensorflow in the same environment as ovmsclient? For example by installing it in a separate virtualenv?

mzegla commented 1 year ago

Should no longer be an issue with ovmsclient 2022.3: https://pypi.org/project/ovmsclient/2022.3/