{"id":6747,"library":"onnx-weekly","title":"Open Neural Network Exchange (ONNX) - Weekly Builds","description":"ONNX (Open Neural Network Exchange) is an open ecosystem for AI developers, providing an open standard format for machine learning models, including deep learning and traditional ML. It defines an extensible computation graph model, built-in operators, and standard data types to enable model interoperability across various frameworks. The `onnx-weekly` package offers continuous integration builds, providing early access to experimental features and allowing users to test upcoming changes ahead of official stable releases. The current version is 1.22.0.dev20260330, reflecting a rapid release cadence for development purposes.","status":"active","version":"1.22.0.dev20260330","language":"en","source_language":"en","source_url":"https://github.com/onnx/onnx","tags":["machine-learning","deep-learning","neural-networks","model-interoperability","ai","onnx"],"install":[{"cmd":"pip install onnx-weekly","lang":"bash","label":"Install latest weekly build"}],"dependencies":[{"reason":"Required Python version","package":"python","minimum_version":"3.10"},{"reason":"Fundamental package for numerical computing, used for tensor operations.","package":"numpy","minimum_version":"1.23.2"},{"reason":"ONNX models are serialized using Google's Protocol Buffers.","package":"protobuf","minimum_version":"4.25.1"},{"reason":"Provides backported and experimental type hints.","package":"typing-extensions","minimum_version":"4.7.1"},{"reason":"Introduced to support additional data types (e.g., float8) in NumPy arrays for the ONNX reference evaluator and helper functions. Required for ONNX versions >= 1.19.0.","package":"ml_dtypes","minimum_version":"0.5.0"}],"imports":[{"symbol":"onnx","correct":"import onnx"},{"symbol":"helper","correct":"from onnx import helper"},{"symbol":"checker","correct":"from onnx import checker"},{"symbol":"TensorProto","correct":"from onnx import TensorProto"},{"note":"Used for parsing ONNX Script models.","symbol":"parser","correct":"import onnx.parser"},{"note":"Provides utilities for shape and type inference in ONNX graphs.","symbol":"shape_inference","correct":"import onnx.shape_inference"}],"quickstart":{"code":"import onnx\nfrom onnx import helper, checker, TensorProto\n\n# Create a simple ONNX graph for Y = X * A + B\n# Define inputs and outputs\nX = helper.make_tensor_value_info('X', TensorProto.FLOAT, [None, 2])\nA = helper.make_tensor_value_info('A', TensorProto.FLOAT, [2, 3])\nB = helper.make_tensor_value_info('B', TensorProto.FLOAT, [3])\nY = helper.make_tensor_value_info('Y', TensorProto.FLOAT, [None, 3])\n\n# Create nodes (operators)\n# MatMul operation: C = X * A\nnode_matmul = helper.make_node(\n    'MatMul',\n    inputs=['X', 'A'],\n    outputs=['C'],\n)\n\n# Add operation: Y = C + B\nnode_add = helper.make_node(\n    'Add',\n    inputs=['C', 'B'],\n    outputs=['Y'],\n)\n\n# Create the graph\ngraph_def = helper.make_graph(\n    [node_matmul, node_add], # Nodes in the graph\n    'simple-linear-regression', # Graph name\n    [X, A, B], # Graph inputs\n    [Y], # Graph outputs\n)\n\n# Create the model\nmodel_def = helper.make_model(graph_def, producer_name='onnx-example')\n\n# Check the model for validity\ntry:\n    checker.check_model(model_def)\n    print(\"Model is valid!\")\nexcept checker.ValidationError as e:\n    print(f\"Model is invalid: {e}\")\n\n# Optionally, save the model\n# onnx.save(model_def, \"simple_model.onnx\")","lang":"python","description":"This quickstart demonstrates how to programmatically construct a simple ONNX model (a linear regression: Y = X * A + B) using the `onnx.helper` module, and then validate it using `onnx.checker`. This illustrates the core functionality of defining and manipulating ONNX graphs."},"warnings":[{"fix":"Remove any dependencies on the defunct model hub integration. Consult ONNX documentation for alternative methods of accessing or managing models.","message":"The `model hub integration` feature was removed in ONNX v1.21.0. If your workflow relied on this integration, you will need to update your code.","severity":"breaking","affected_versions":">=1.21.0"},{"fix":"Ensure `ml_dtypes` is installed in your environment: `pip install ml_dtypes>=0.5.0`.","message":"The `ml_dtypes` package became a direct dependency for ONNX versions >= 1.19.0. Users upgrading to these versions or using tools like `onnxruntime` with older `onnx` installations might encounter `ModuleNotFoundError` if `ml_dtypes` is not explicitly installed. This is particularly relevant when working with extended data types like FLOAT8.","severity":"gotcha","affected_versions":">=1.19.0"},{"fix":"Understand the distinct roles: `onnx` for model definition/manipulation, `onnxruntime` for model execution. Install `onnxruntime` separately (`pip install onnxruntime`) for inference capabilities.","message":"There's a common confusion between the `onnx` package (which defines the model format and provides utilities to build/manipulate ONNX graphs) and `onnxruntime` (which is the inference engine used to execute ONNX models efficiently). The `onnx-weekly` package only provides the `onnx` library.","severity":"gotcha","affected_versions":"All"},{"fix":"Always check the Opset version of your exported ONNX model (`model_def.opset_import`) and confirm it is supported by your chosen ONNX Runtime version. Use `onnx.version_converter` if necessary to convert models to different opset versions.","message":"ONNX models are versioned by IR version and operator set (Opset) versions. Breaking changes to the IR format or operator semantics require version increments. Ensure that the ONNX Runtime or target inference environment you are using supports the specific Opset version of your ONNX model to avoid compatibility issues.","severity":"gotcha","affected_versions":"All"},{"fix":"For models exceeding 2GB, consider splitting the model into smaller subgraphs, using external data fields (which store large tensors separately from the main protobuf file), or exploring alternative serialization methods if available.","message":"ONNX models are serialized using Google's Protocol Buffers, which imposes a 2GB size limit on individual model files. Very large models may fail to serialize or load correctly.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}