{"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":"python","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,"search_vec":"'1.22.0':88 'access':68 'across':54 'ahead':79 'ai':18,110 'allow':73 'build':7,65 'built':43 'built-in':42 'cadenc':94 'chang':78 'comput':39 'continu':63 'current':85 'data':48 'deep':30,102 'deep-learn':101 'defin':36 'dev20260330':89 'develop':19,96 'earli':67 'ecosystem':16 'enabl':51 'exchang':4,12 'experiment':70 'extens':38 'featur':71 'format':24 'framework':56 'graph':40 'includ':29 'integr':64 'interoper':53,109 'learn':27,31,100,103 'machin':26,99 'machine-learn':98 'ml':34 'model':28,41,52,108 'model-interoper':107 'network':3,11,106 'neural':2,10,105 'neural-network':104 'offer':62 'offici':81 'onnx':5,8,59,111 'onnx-week':58 'open':1,9,15,22 'oper':45 'packag':61 'provid':20,66 'purpos':97 'rapid':92 'reflect':90 'releas':83,93 'stabl':82 'standard':23,47 'test':76 'tradit':33 'type':49 'upcom':77 'user':74 'various':55 'version':86 'week':6,60","created_at":"2026-04-15T18:41:14.095655+00:00","updated_at":"2026-04-16T17:32:34.039154+00:00","problems":[{"fix":"Ensure the correct package is installed using `pip install onnx-weekly` in your active Python environment. If you intended to use the stable release, use `pip install onnx` instead.","cause":"The 'onnx' package (or 'onnx-weekly') is not installed in the active Python environment or there is a typo in the import statement.","error":"ModuleNotFoundError: No module named 'onnx'"},{"fix":"Consult the official ONNX GitHub repository or documentation for the `onnx-weekly` branch to find the latest API, or consider using a stable `onnx` release if the specific experimental feature is not critical.","cause":"The 'onnx-weekly' package, being a development build, may have introduced API changes, or the specific function/attribute has been removed, renamed, or is not yet available in the version you have installed.","error":"AttributeError: module 'onnx' has no attribute 'compose'"},{"fix":"Try installing with `pip install --no-binary :all: onnx-weekly` to force building from source, or explicitly specify compatible versions for dependencies like `numpy>=1.21.5`. Ensure your Python version is compatible (e.g., Python >=3.10 for recent `onnx-weekly` versions).","cause":"Installation fails because the package's metadata (e.g., version declared in `pyproject.toml` or `setup.py`) does not match the version expected by pip, often due to how development builds are packaged, or due to dependency conflicts with other installed packages like NumPy.","error":"onnx-weekly has inconsistent version metadata"},{"fix":"Validate the ONNX model's expected inputs (name, shape, and data type) using `session.get_inputs()` from `onnxruntime`. Adjust your input data (e.g., `numpy.ndarray`) to exactly match these specifications. Ensure the ONNX opset version of your model is compatible with your installed `onnxruntime` version.","cause":"The input data provided to the ONNX model (when running inference with ONNX Runtime) does not match the expected shape, data type, or name defined in the ONNX model's graph. This is a common issue when models are exported with one opset version and run with an incompatible ONNX Runtime version or incorrect input preparation.","error":"[ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Invalid rank for input: ... Got: X Expected: Y"},{"fix":"Verify the opset version of your ONNX model and the opsets supported by your `onnxruntime` version. If possible, re-export the model using an opset version known to be compatible with your `onnxruntime`, or update `onnxruntime` to a version that supports the required opset.","cause":"The ONNX model contains an operator (like `GridSample` or a custom operator) that is not supported by the ONNX operator set (opset) version targeted by the exporter or the installed ONNX Runtime version. This can happen with `onnx-weekly` as new operators or opset versions are frequently introduced and may not be universally supported yet.","error":"RuntimeError: No such operator '...' in domain 'ai.onnx'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.22.0.dev20260608","cli_name":"","cli_version":null,"type":"library","homepage":"https://onnx.ai/","github":"https://github.com/onnx/onnx","docs":null,"changelog":null,"pypi":"https://pypi.org/project/onnx-weekly/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}