skillfed

sne4onnx

A very simple tool for situations where optimization with onnx-simplifier would exceed the Protocol Buffers upper file size limit of 2GB, or simply to separate onnx files to any size you want. Simple Network Extraction for ONNX.

sne4onnx v2.0.1 127.8K downloads/30d#11,731 on PyPI17
Permissive license MIT License Active released

What it is and what it does

sne4onnx is a lightweight utility for extracting subgraphs from ONNX neural network models. It takes an ONNX file and a pair of input and output operation names, then isolates the computation graph between those points and writes a new, smaller ONNX file. The tool was built to address a specific problem: when onnx-simplifier optimization would push a model past the Protocol Buffers 2GB file size limit, or when you simply want to partition a large model into smaller pieces for deployment or analysis.

The package provides both a command-line interface and a Python API. It implements its own graph extraction logic rather than relying on the slower onnx.utils.extractor.extract_model function. With no runtime dependencies and support for Python versions >=3.6, it integrates easily into existing ONNX workflows. The tool is commonly used in model optimization pipelines, particularly in computer vision and deep learning contexts where model size and inference latency matter.

Use it for:

  • Extract a specific layer or stage from a large ONNX model to debug or profile that portion independently.
  • Split an oversized ONNX model into smaller subgraphs to stay under the 2GB Protocol Buffers limit.
  • Isolate a trained backbone or encoder from a full model for transfer learning or fine-tuning.
  • Partition a multi-stage inference pipeline (e.g., preprocessing, main model, postprocessing) into separate deployable units.
  • Reduce model file size for embedded or edge deployment by keeping only the necessary computation graph.

Worth the install?

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

Extracts subgraphs from ONNX model files by specifying input and output operation names, generating smaller ONNX files without the overhead of standard extraction methods.

Yes. The package is lightweight, actively maintained, has no runtime dependencies, carries a permissive MIT license, and solves a real problem in ONNX model workflows—particularly when dealing with large models or size constraints. Install it if you work with ONNX models and need to extract subgraphs or partition files by operation boundaries.

Install

sne4onnx on PyPI

pip

pip install sne4onnx

uv

uv add sne4onnx

poetry

poetry add sne4onnx

Installing sne4onnx

Before you install

Low friction: pure Python wheel with no runtime dependencies. Last release was recent (2026-02-24), and the project is actively maintained with a clean repository.

License in practice

MIT License permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.

Quickstart

pip install sne4onnx

from sne4onnx import extraction

extracted_graph = extraction(
  input_op_names=['aaa','bbb','ccc'],
  output_op_names=['ddd','eee','fff'],
  input_onnx_file_path='input.onnx',
  output_onnx_file_path='output.onnx',
)

Requires onnx package to be installed separately (not listed as a dependency in this package).

Verify before relying

  • Whether onnx is an undeclared runtime dependency or expected to be pre-installed by the user.
  • Performance characteristics compared to onnx.utils.extractor.extract_model on large models.
  • Whether the custom extraction logic handles all ONNX opset versions correctly.

Package facts

License MIT License (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 171 days since the last release
Last repo commit
First released
Downloads 127,775/month — #11,731 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sne4onnx-2.0.1-py3-none-any.whl

Tags

onnx model subgraph extractionsplit onnx files by sizeextract onnx layers by nameonnx graph slicing toolreduce onnx file sizeonnx network extraction
onnx-toolsmodel-optimization

More Artificial Intelligence packages