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

[Bug]: OnnxModelHandlerNumpy broken with latest onnx version #32998

Closed
1 of 17 tasks
gariepyalex opened this issue Nov 1, 2024 · 3 comments · Fixed by #33000
Closed
1 of 17 tasks

[Bug]: OnnxModelHandlerNumpy broken with latest onnx version #32998

gariepyalex opened this issue Nov 1, 2024 · 3 comments · Fixed by #33000

Comments

@gariepyalex
Copy link

What happened?

There is a runtime error when loading a ONNX model with OnnxModelHandlerNumpy when using ONNX's latest version:

from apache_beam.ml.inference.onnx_inference import OnnxModelHandlerNumpy

model_handler = OnnxModelHandlerNumpy(
    "/tmp/model.onnx" # Also crashed with a remote model URI gs://...
)

Here is the error, which happens using the DirectRunner:

/3.10.14/lib/python3.10/site-packages/apache_beam/ml/inference/onnx_inference.py", line 119, in load_model
    model_proto_bytes = onnx._serialize(model_proto)
AttributeError: module 'onnx' has no attribute '_serialize' [while running 'RunInference/BeamML_RunInference']
pip freeze | grep onnx       
onnx==1.17.0
onnxruntime==1.19.2

pip freeze | grep beam
apache-beam==2.60.0

Issue Priority

Priority: 1 (data loss / total loss of function)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
@gariepyalex
Copy link
Author

The error goes away by downgrading to ONNX 1.14.1 (Aug 2023).

@damccorm
Copy link
Contributor

damccorm commented Nov 1, 2024

Thanks for calling this out - working on a quick fix here - #33000

@github-actions github-actions bot added this to the 2.61.0 Release milestone Nov 1, 2024
@gariepyalex
Copy link
Author

Wow thanks @damccorm for the fast fix!

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

Successfully merging a pull request may close this issue.

2 participants