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.
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 sne4onnxuv
uv add sne4onnxpoetry
poetry add sne4onnxInstalling 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
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
scs4onnxCompresses ONNX model files by deduplicating…
permissive · top 15,000 on PyPI
snd4onnxRemoves specified nodes from ONNX model graphs…
permissive · top 15,000 on PyPI
sng4onnxAutomatically generates and assigns operation…
permissive · top 15,000 on PyPI
spo4onnxApplies specialized optimization techniques to…
permissive · top 15,000 on PyPI
ssc4onnxAnalyzes and displays the structure of ONNX…
permissive · top 15,000 on PyPI
soa4onnxAdds or modifies output nodes in ONNX model…
permissive · top 15,000 on PyPI
sde4onnxRemoves embedded doc_strings from ONNX model…
permissive · top 15,000 on PyPI
snc4onnxMerges multiple ONNX neural network models into…
permissive · top 15,000 on PyPI
sod4onnxsod4onnx removes specified output operations…
permissive · top 15,000 on PyPI
sor4onnxRenames input, output, and operator nodes in…
permissive · top 15,000 on PyPI