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

Get error when running cog build for resnet example #12

Open
xiaoyu-work opened this issue Jun 1, 2022 · 2 comments
Open

Get error when running cog build for resnet example #12

xiaoyu-work opened this issue Jun 1, 2022 · 2 comments

Comments

@xiaoyu-work
Copy link

I made this change locally to bypass paramspec error, but got another protobuf error:

Building Docker image from environment in cog.yaml as cog-resnet...
[+] Building 3.0s (14/14) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 622B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => resolve image config for docker.io/docker/dockerfile:1.2                                                       0.1s
 => CACHED docker-image://docker.io/docker/dockerfile:1.2@sha256:e2a8561e419ab1ba6b2fe6cbdf49fd92b95912df1cf7d313  0.0s
 => [internal] load metadata for docker.io/library/python:3.8                                                      0.1s
 => [internal] load build context                                                                                  0.0s
 => => transferring context: 29.32kB                                                                               0.0s
 => [stage-0 1/6] FROM docker.io/library/python:3.8@sha256:f8dd6cc493bb667f693293f69927ae7c5ebf430a88b9d384c0c3ee  0.0s
 => CACHED [stage-0 2/6] COPY .cog/tmp/build3752096533/cog-0.0.1.dev-py3-none-any.whl /tmp/cog-0.0.1.dev-py3-none  0.0s
 => CACHED [stage-0 3/6] RUN --mount=type=cache,target=/root/.cache/pip pip install /tmp/cog-0.0.1.dev-py3-none-a  0.0s
 => CACHED [stage-0 4/6] RUN --mount=type=cache,target=/root/.cache/pip pip install   pillow==9.1.0 tensorflow==2  0.0s
 => CACHED [stage-0 5/6] WORKDIR /src                                                                              0.0s
 => [stage-0 6/6] COPY . /src                                                                                      0.1s
 => exporting to image                                                                                             0.0s
 => => exporting layers                                                                                            0.0s
 => => writing image sha256:034e64239bd4618f4272e0b719fd4263366a34a9a37eacdaf77139887c179680                       0.0s
 => => naming to docker.io/library/cog-resnet                                                                      0.0s
 => exporting cache                                                                                                0.0s
 => => preparing build cache for export                                                                            0.0s
Adding labels to image...

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/site-packages/cog/command/openapi_schema.py", line 18, in <module>
    predictor = load_predictor()
  File "/usr/local/lib/python3.8/site-packages/cog/predictor.py", line 76, in load_predictor
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "predict.py", line 5, in <module>
    from tensorflow.keras.applications.resnet50 import (
  File "/usr/local/lib/python3.8/site-packages/tensorflow/__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 37, in <module>
    from tensorflow.python.eager import context
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/eager/context.py", line 29, in <module>
    from tensorflow.core.framework import function_pb2
  File "/usr/local/lib/python3.8/site-packages/tensorflow/core/framework/function_pb2.py", line 16, in <module>
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
  File "/usr/local/lib/python3.8/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
  File "/usr/local/lib/python3.8/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
    from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
  File "/usr/local/lib/python3.8/site-packages/tensorflow/core/framework/resource_handle_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
  File "/usr/local/lib/python3.8/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 36, in <module>
    _descriptor.FieldDescriptor(
  File "/usr/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

ⅹ Failed to get type signature: exit status 1

I tried different versions of protobuf like 3.17, 3.20 or 4.21, and none of them worked. I also tried to set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python, still didn't work.

@mcam10
Copy link

mcam10 commented Dec 20, 2024

any luck here @xiaoyu-work ? Im seeing the same

@xiaoyu-work
Copy link
Author

@mcam10 No i did not use cog anymore.

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

No branches or pull requests

2 participants