{"id":18689704,"url":"https://github.com/mrseanryan/onnx-cli","last_synced_at":"2025-11-08T07:30:30.634Z","repository":{"id":96809935,"uuid":"570490858","full_name":"mrseanryan/onnx-cli","owner":"mrseanryan","description":"Command line tools in Python for working with ONNX files","archived":false,"fork":false,"pushed_at":"2023-02-26T11:32:50.000Z","size":13,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-28T01:49:38.996Z","etag":null,"topics":["file-format","machine-learning","machine-learning-models","machinelearning-python","onnx"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrseanryan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-25T10:15:36.000Z","updated_at":"2022-11-25T11:06:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"b7906be3-e7c9-4bf7-aa1d-61cca288fa44","html_url":"https://github.com/mrseanryan/onnx-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrseanryan%2Fonnx-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrseanryan%2Fonnx-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrseanryan%2Fonnx-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrseanryan%2Fonnx-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrseanryan","download_url":"https://codeload.github.com/mrseanryan/onnx-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239550286,"owners_count":19657541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-format","machine-learning","machine-learning-models","machinelearning-python","onnx"],"created_at":"2024-11-07T10:44:47.458Z","updated_at":"2025-11-08T07:30:30.578Z","avatar_url":"https://github.com/mrseanryan.png","language":"Python","readme":"# onnx-tools README\n\nCommand line tools in Python for working with ONNX files:\n\n- Create a simple ONNX file with given opset version. This can used for testing parsing, consuming and executing a ONNX file.\n- Dump out a summary of the properties of an ONNX file\n\n## Dependencies\n\n`python3 -m pip install onnx==1.12.0`\n\n## Usage\n\n| script | purpose | usage |\n|---|---|---|\n| `create_example_onnx_with_version.py` | Create a simple ONNX file with given opset version. This can used for testing parsing, consuming and executing a ONNX file. | `python3 create_example_onnx_with_version.py \u003coutput file path\u003e \u003cgeneral opset version\u003e` |\n| `describe_onnx.py` | Dump out a summary of the properties of an ONNX file. Properties include: general opset version, IR version, file size, producer, producer version. Output can also be in JSON format. | `python3 describe_onnx.py \u003connx file path\u003e [--json]` |\n| `map_ir_and_opset-ai-onnx_to_onnx_version.py` | Takes an IR version and opset version (for the 'ai.onnx' domain) and maps that to the closest ONNX version. | `python3 map_ir_and_opset-ai-onnx_to_onnx_version \u003cIR version\u003e \u003copset version\u003e` |\n| `update_map_ir-opset_to_onnx-version.py` | Updates the map that is used by `map_ir_and_opset-ai-onnx_to_onnx_version.py` by downloading a small markdown file from the onnx github repository. | `python3 update_map_ir-opset_to_onnx-version.py` |\n\n### Example usage with output\n\n#### create_example_onnx_with_version.py\n\n```\npython3 create_example_onnx_with_version.py ~/temp/my-model_v13.pnnx 13\n```\n\nOUTPUT:\n```\nonnx library version 1.12.0\nSaved new ONNX file to ~/temp/my-model_v13.pnnx with target general opset version 13\n```\n\n#### describe_onnx.py\n\n```\npython3 describe_onnx.py ~/temp/my-model.onnx\n```\n\nOUTPUT:\n```\nONNX file: ./temp/new_onnx_1.onnx\nfile size (KB): 6\ndescribed-with-onnx-library-version: 1.12.0\n\ndomain: \nir_version: 8\nopset_import: [version: 17\n]\n\nproducer_name: onnx-cli\nproducer_version: \nIR_VERSION_FIELD_NUMBER: 1\nOPSET_IMPORT_FIELD_NUMBER: 8\nPRODUCER_VERSION_FIELD_NUMBER: 3\nMODEL_VERSION_FIELD_NUMBER: 5\nmodel_version: 0\n[done]\n ```\n\n\n#### describe_onnx.py with JSON output\n\n```\npython3 describe_onnx.py ~/temp/my-model.onnx --json\n```\n\nOUTPUT:\n```\n{\n  \"properties\": {\n    \"ONNX_file\": \"./temp/new_onnx_1.onnx\",\n    \"file_size_KB\": 6,\n    \"described-with-onnx-library-version\": \"1.12.0\",\n    \"domain\": \"\",\n    \"ir_version\": 8,\n    \"opset_import\": \"[version: 17\\n]\",\n    \"producer_name\": \"onnx-cli\",\n    \"producer_version\": \"\",\n    \"IR_VERSION_FIELD_NUMBER\": 1,\n    \"OPSET_IMPORT_FIELD_NUMBER\": 8,\n    \"PRODUCER_VERSION_FIELD_NUMBER\": 3,\n    \"MODEL_VERSION_FIELD_NUMBER\": 5,\n    \"model_version\": 0\n  }\n}\n```\n\n#### update_map_ir-opset_to_onnx-version.py\n\n```\npython3 update_map_ir-opset_to_onnx-version.py\n```\n\nOUTPUT:\n```\nDownloading file from https://raw.githubusercontent.com/onnx/onnx/main/docs/Versioning.md...\n[done]\nWriting 19 ONNX versions to data/onnx-versions.json ...\n[done]\n```\n\n#### map_ir_and_opset-ai-onnx_to_onnx_version.py\n\n```\npython3 map_ir_and_opset-ai-onnx_to_onnx_version.py 7 13\n```\n\nOUTPUT:\n```\nONNX version 1.8.0\n```\n\nExample of looser match, by IR version and an opset version that is lower than the max supported for that ONNX version:\n```\npython3 map_ir_and_opset-ai-onnx_to_onnx_version.py 8 11\n```\n\nOUTPUT:\n```\nONNX version 1.10.0\n```\n\n## References\n\n- [ONNX versions - official spec](https://github.com/onnx/onnx/blob/main/docs/Versioning.md)\n- [Blog post - with more tools](https://antipatterns.blogspot.com/2022/11/versions-and-properties-of-onnx-machine.html)\n\n## Licence\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrseanryan%2Fonnx-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrseanryan%2Fonnx-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrseanryan%2Fonnx-cli/lists"}