skillfed

onnxsim

Simplify your ONNX model

onnxsim v0.7.3 543.0K downloads/30d#6,087 on PyPI4,386
Permissive license MIT AND (Apache-2.0 OR BSD-2-Clause) Active released

What it is and what it does

ONNX Simplifier takes a compiled ONNX neural network model and reduces it by eliminating redundant operations through constant folding, shape inference, and graph optimization. It runs a fixed-point loop of these three techniques until the model stops changing, then optionally validates the result against the original on random inputs to ensure correctness.

The package is used to shrink models exported from frameworks like PyTorch, making them faster to load and run while preserving numerical behavior. It handles both static and dynamic input shapes, supports custom operators (including TensorRT plugins), can inline local functions, simplify subgraphs, and convert between ONNX opset versions. It is available as a Python package with a CLI, a C API, a Rust wrapper, and a zero-install web version.

Use it for:

  • Reduce the size of PyTorch models exported to ONNX before deployment to edge devices or inference servers.
  • Remove redundant reshape, transpose, and constant-computation nodes introduced during framework export.
  • Validate that a simplified ONNX model produces numerically equivalent outputs on random test inputs.
  • Upgrade or downgrade an ONNX model's opset version while cleaning up any redundant nodes the conversion introduces.
  • Simplify models containing custom operators like TensorRT plugins without manually moving them to a custom domain.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Simplifies ONNX neural network models by running constant folding, shape inference, and graph optimization passes to reduce redundant operators and produce smaller, faster models.

Yes. The package is actively maintained, has no known vulnerabilities, uses permissive licenses, and solves a real problem in ONNX model deployment. Medium install friction is acceptable given the precompiled wheels for modern Python versions and multiple platforms. Install if you work with exported ONNX models and need to reduce their size or remove redundant operations.

Install

onnxsim on PyPI

pip

pip install onnxsim

uv

uv add onnxsim

poetry

poetry add onnxsim

Installing onnxsim

Before you install

Medium install friction due to precompiled wheels for multiple Python versions and platforms (cp310–cp314, macOS arm64, Linux x86_64/aarch64, Windows). Active maintenance with a release 2 days ago and 4386 repository stars.

License in practice

Dual-licensed under MIT and (Apache-2.0 OR BSD-2-Clause), both permissive. You may use, modify, and distribute freely under either license's terms.

Quickstart

pip install onnxsim

import onnx
from onnxsim import simplify

model = onnx.load('model.onnx')
model_simp, check = simplify(model)
assert check, "Simplified model validation failed"

Requires Python >=3.10 and the onnx package (a runtime dependency).

Verify before relying

  • Whether onnxruntime is truly optional or recommended for performance; fact sheet notes it falls back to ONNX reference evaluator but does not quantify the performance difference.
  • Whether the web version and Node.js npm package share feature parity with the Python package or have limitations not mentioned in the excerpt.

Package facts

License MIT AND (Apache-2.0 OR BSD-2-Clause) (permissive)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies 2 — onnx, rich
Maintenance actively maintained — 2 days since the last release
Last repo commit
First released
Downloads 542,989/month — #6,087 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: onnxsim-0.7.3-cp310-cp310-macosx_13_0_arm64.whl; onnxsim-0.7.3-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; onnxsim-0.7.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxsim-0.7.3-cp310-cp310-win_amd64.whl; onnxsim-0.7.3-cp311-cp311-macosx_13_0_arm64.whl; onnxsim-0.7.3-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; onnxsim-0.7.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxsim-0.7.3-cp311-cp311-win_amd64.whl; onnxsim-0.7.3-cp312-abi3-macosx_13_0_arm64.whl; onnxsim-0.7.3-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; onnxsim-0.7.3-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxsim-0.7.3-cp312-abi3-win_amd64.whl; onnxsim-0.7.3-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Keywords: deep-learning, ONNX

Development Status :: 4 - BetaIntended Audience :: DevelopersProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Scientific/EngineeringTopic :: Software Development

Tags

ONNX model simplificationconstant folding neural networksreduce ONNX model sizegraph optimization ONNXONNX model compressionsimplify deep learning modelsONNX inference optimization
model-optimizationonnxdeep-learning

More Software Development packages

Further reading