skillfed

onnx-tool

A tool for parsing, editing, optimizing, and profiling ONNX models.

onnx-tool v1.0.1 110.9K downloads/30d#12,439 on PyPI491
Permissive license MIT Active released

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-tool

uv

uv add onnx-tool

poetry

poetry add onnx-tool

Installing 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

Programming Language :: Python :: 3

Tags

onnx model analysis and optimizationneural network profiling toolsllm model compression and quantizationonnx graph transformationmodel memory optimizationonnx shape inferencedeep learning model toolkit
model-optimizationonnx-ecosystemllm-tools

More Artificial Intelligence packages