Skip to content

Releases: Luv-Goel/onnx-model-surgery

v0.2.0 - 7 New Features: FLOPs, Diff, Extract, Simplify, Report, Rename & More

10 May 05:00

Choose a tag to compare

v0.2.0

7 new CLI commands and a major under-the-hood cleanup:

New Features

  • *\onnx-surgery flops * — Estimate MACs, FLOPs, total parameters, and memory footprint with per-operator ASCII bar chart
  • *\onnx-surgery diff * — Structural comparison of two models: added/removed/changed nodes, input/output diffs, op distribution shifts
  • *\onnx-surgery extract --from X --to Y* — Slice a model between named tensors into a standalone .onnx file
  • *\onnx-surgery simplify * — Graph simplification: constant folding, Identity removal, optional BN-Conv fusion
  • *\onnx-surgery report -o report.html* — Self-contained HTML report with summary cards, node tables, FLOPs breakdown
  • *\onnx-surgery rename --map old:new* — Bulk rename tensors throughout the entire model
  • *\onnx-surgery info --shapes * — Enhanced info with computational estimates

Fixes

  • All unicode/emoji replaced with ASCII for Windows cp1252 terminal compatibility
  • 100% test pass rate across 12 tests on Python 3.10/3.11/3.12
  • CLI now has 13 subcommands total

v0.1.0 — Initial Release

10 May 04:44

Choose a tag to compare

🔪 ONNX Model Surgery v0.1.0

First public release. A terminal workbench for inspecting, pruning, patching, and optimizing ONNX models — no API keys, no cloud, no GPU required.

What's inside

🔍 Inspectiononnx-surgery info model.onnx gives you a complete structural dump: IR version, opsets, every node, every tensor shape, parameter sizes. JSON export for scripting.

📊 Graph visualizationonnx-surgery graph renders the full model topology as ASCII right in your terminal. Optional Graphviz DOT generation for pretty PNGs.

✂️ Pruning — Drop entire op types (--op-types Dropout Identity), keep only named nodes, or prune isolated subgraphs automatically.

🔧 Patching — Replace any node's operation, inputs, or outputs. Rename tensors across the entire model. Insert new nodes.

🧹 Stripping — Remove unused initializers, fold Identity nodes, eliminate dangling subgraphs.

✅ Validation — Runs the official ONNX checker and reports any structural issues.

Installation

pip install onnx numpy rich
pip install git+https://github.com/Luv-Goel/onnx-model-surgery.git

Stats

  • 8 source modules, ~2,500 lines
  • 12 passing tests
  • Python 3.10+ support
  • Zero external API dependencies