onnx-tool
A tool for parsing, editing, optimizing, and profiling ONNX models.
What it is and what it does
onnx-tool is a comprehensive toolkit for working with ONNX neural network models. It provides parsing and editing capabilities through an intuitive API, allowing you to load ONNX files, access computation graphs, modify operators and tensor data, and save changes. The package excels at analyzing model structure and performance characteristics through rapid shape inference and detailed profiling that computes MACs, parameter counts, and memory footprint with sparsity awareness.
Beyond analysis, the toolkit offers optimization and transformation features including constant folding, operator fusion, weight quantization (FP16, INT8/INT4 with multiple schemes), and activation memory compression. It includes specialized support for large language models with KV cache analysis, diffusion models, and computer vision architectures. The compute graph engine removes shape-calculation overhead for efficient inference integration, making it useful for both model development and deployment preparation.
Use it for:
- Profile LLM architectures (BERT, GPT, LLaMa, Qwen) to estimate MACs, parameters, and KV cache requirements before deployment
- Optimize Stable Diffusion and other diffusion models by analyzing and compressing activation memory across encoder, decoder, and UNet components
- Prepare quantized models for edge deployment by analyzing weight compression ratios and memory footprint reduction across INT8/INT4 schemes
- Integrate ONNX models into custom inference engines by extracting compute graphs with minimal shape-calculation overhead
- Validate model transformations through shape regression testing after applying constant folding or operator fusion optimizations
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parse, analyze, optimize, and profile ONNX neural network models with support for shape inference, quantization analysis, memory compression, and LLM-specific workloads.
Yes. The package fills a genuine need for ONNX model analysis and optimization with low install friction, active maintenance, permissive licensing, and no known vulnerabilities. It is most valuable for developers working with LLMs, diffusion models, or deploying neural networks to resource-constrained environments where profiling and compression are critical.
Install
onnx-tool on PyPI
pip
pip install onnx-tooluv
uv add onnx-toolpoetry
poetry add onnx-toolInstalling onnx-tool
Before you install
Low friction install with three straightforward runtime dependencies (onnx, numpy, tabulate). Active maintenance with recent commits and steady development since 2022.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal legal friction.
Quickstart
pip install onnx-tool
from onnx_tool import Model
model = Model('model.onnx')
graph = model.graph
node = graph.nodemap['Conv_0']
model.save_model('modified.onnx')
Verify before relying
- Whether shape inference handles all dynamic dimension scenarios in production models
- Performance characteristics of the compute graph engine on very large models
- Compatibility with ONNX opset versions beyond those explicitly documented
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — onnx, numpy, tabulate |
| Maintenance | actively maintained — 117 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 110,862/month — #12,439 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: onnx_tool-1.0.1-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
onnxoptimizerApplies graph-level optimizations to ONNX…
permissive · top 15,000 on PyPI
qonnxQONNX provides Python utilities to work with…
permissive · top 15,000 on PyPI
nncfNNCF provides post-training and training-time…
permissive · top 5,000 on PyPI
onnxsimSimplifies ONNX neural network models by…
permissive · top 15,000 on PyPI
nvidia-modeloptApplies state-of-the-art model optimization…
permissive · top 15,000 on PyPI
optimum-onnxExports Hugging Face transformer models to ONNX…
permissive · top 15,000 on PyPI
polygraphyPolygraphy is a toolkit for running inference…
permissive · top 15,000 on PyPI
onnx-weeklyonnx-weekly provides a Python package for…
permissive · top 15,000 on PyPI
tensorflow-model-optimizationProvides quantization, pruning, and clustering…
permissive · top 15,000 on PyPI
ssi4onnxInfers and fills missing tensor shape…
permissive · top 15,000 on PyPI