tobegit3hub / simple_tensorflow_serving

Generic and easy-to-use serving service for machine learning models
https://stfs.readthedocs.io
Apache License 2.0
757 stars 195 forks source link

tf.GPUOptions bug for Python3.7 #81

Closed dkawashima closed 3 years ago

dkawashima commented 4 years ago

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1945, in full_dispatch_request self.try_trigger_before_first_request_functions() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1993, in try_trigger_before_first_request_functions func() File "/usr/local/lib/python3.7/site-packages/simple_tensorflow_serving-0.8.1.1-py3.7.egg/simple_tensorflow_serving/./manager.py", line 89, in init self.args.custom_op_paths, session_config) File "/usr/local/lib/python3.7/site-packages/simple_tensorflow_serving-0.8.1.1-py3.7.egg/simple_tensorflow_serving/./tensorflow_inference_service.py", line 87, in init self.load_saved_model_version(model_version) File "/usr/local/lib/python3.7/site-packages/simple_tensorflow_serving-0.8.1.1-py3.7.egg/simple_tensorflow_serving/./tensorflow_inference_service.py", line 172, in load_saved_model_version gpu_options = tf.GPUOptions(allow_growth=True) AttributeError: module 'tensorflow' has no attribute 'GPUOptions'

Trying to launch simple-tensorflow-serving as Kubernetes service, and running into issues.

ozlerhakan commented 4 years ago

you need to use tf.compat.v1.GPUOptions(allow_growth=True) if you run the service with TF 2.x @dkawashima

tobegit3hub commented 3 years ago

It's the issue of compatibility for TF 2 and I will fix for the tf.compat.v1.GPUOptions(allow_growth=True) API.

tobegit3hub commented 3 years ago

It seems that 0.8.2 has been fixed this.

    if tf.__version__.startswith("1"):
      gpu_options = tf.GPUOptions(allow_growth=True)
      config = tf.ConfigProto(gpu_options=gpu_options)
    else:
      gpu_options = tf.compat.v1.GPUOptions(allow_growth=True)
      config = tf.compat.v1.ConfigProto(gpu_options=gpu_options)

Please upgrade to test by `pip install -U simple_tensorflow_serving>=0.8.2".