keras-team / keras-io

Keras documentation, hosted live at keras.io
Apache License 2.0
2.76k stars 2.04k forks source link

Stable Diffusion protobuf incompatibility #1097

Closed randyg3000 closed 1 year ago

randyg3000 commented 2 years ago

https://keras.io/guides/keras_cv/generate_images_with_stable_diffusion/

Linux orin1 5.10.65-tegra #1 SMP PREEMPT Mon May 16 20:58:07 PDT 2022 aarch64 aarch64 aarch64 GNU/Linux

After Installing (sudo pip3 install --upgrade keras-cv and sudo pip3 install --upgrade tensorflow) I receive the following error (note I received a different error after downgrading protobuf... see below) ... File "/home/orin/.local/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 560, in new _message.Message._CheckCalledFromGeneratedFile() TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

**orin@orin1:~/keras-cv$ sudo pip3 install protobuf==3.19.***

Collecting protobuf==3.19.* Using cached protobuf-3.19.5-cp38-cp38-manylinux2014_aarch64.whl (913 kB) Installing collected packages: protobuf Attempting uninstall: protobuf Found existing installation: protobuf 3.20.1 Uninstalling protobuf-3.20.1: Successfully uninstalled protobuf-3.20.1 Successfully installed protobuf-3.19.5 orin@orin1:~/keras-cv$ python3 keras-cv-images.py Traceback (most recent call last): File "keras-cv-images.py", line 2, in import keras_cv File "/usr/local/lib/python3.8/dist-packages/keras_cv/init.py", line 16, in from keras_cv import version_check File "/usr/local/lib/python3.8/dist-packages/keras_cv/version_check.py", line 18, in import tensorflow as tf File "/usr/local/lib/python3.8/dist-packages/tensorflow/init.py", line 37, in from tensorflow.python.tools import module_util as _module_util File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/init.py", line 37, in from tensorflow.python.eager import context File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/eager/context.py", line 29, in from tensorflow.core.framework import function_pb2 File "/usr/local/lib/python3.8/dist-packages/tensorflow/core/framework/function_pb2.py", line 16, in from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attrvaluepb2 File "/usr/local/lib/python3.8/dist-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensorpb2 File "/usr/local/lib/python3.8/dist-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resourcehandlepb2 File "/usr/local/lib/python3.8/dist-packages/tensorflow/core/framework/resource_handle_pb2.py", line 16, in from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensorshapepb2 File "/usr/local/lib/python3.8/dist-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 36, in _descriptor.FieldDescriptor( File "/home/orin/.local/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 560, in new__ _message.Message._CheckCalledFromGeneratedFile() TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

sachinprasadhs commented 1 year ago

Hi,

Thanks for reporting the issue. Tensorflow recently upgraded the protobuf version to 4.2, the incompatibility issue should be solved now.

Please find the working Gist here for reference: https://gist.github.com/sachinprasadhs/18df8d404dac2b70f013c692310d8eb5

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.