spo4onnx
Simple tool for partial optimization of ONNX. Further optimize some models that cannot be optimized with onnx-optimizer and onnxsim by several tens of percent. In particular, models containing Einsum and OneHot.
Decision gist · record as of 2026-08-14
Yes, if you have ONNX models with Einsum or OneHot operations that standard optimizers leave largely unchanged and you can verify the model contains no non-deterministic operations. The low install friction and permissive license make it a low-risk addition to a model optimization pipeline. However, the dormant maintenance status means no active support for new onnxsim versions or bug fixes—treat it as a specialized tool for a specific problem, not a general-purpose optimizer.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires onnx and onnxruntime to be installed separately; models with non-deterministic output shapes (NonZero, NonMaxSuppression) will be corrupted by optimization.
- Low friction installation with no runtime dependencies.
- The package is dormant (last release 2024-05-07, 829 days ago), so expect no active maintenance or bug fixes.
License · maintenance · safety
MIT License (permissive) — MIT License permits free use, modification, and distribution with minimal restrictions, making this safe for commercial and open-source projects.
last release 2024-05-07 (829 days) · last repo commit 2024-05-07 · 19 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 82,697 downloads/mo, #14,143 on PyPI
Alternatives
Verify before relying
pip install spo4onnx
from spo4onnx import partial_optimization
optimized_model = partial_optimization(
input_onnx_file_path='model.onnx',
output_onnx_file_path='model_optimized.onnx'
)- Whether the tool's optimization gains (claimed 30%-60% reduction) are reproducible across model architectures beyond the documented examples.
- Current compatibility with recent onnxsim versions beyond the default 0.4.30 target.
- Whether models with dynamic shapes can be reliably optimized without manual intervention.
What it is and what it does
spo4onnx is a specialized ONNX model optimizer designed to handle cases where standard tools like onnx-optimizer and onnxsim reach their limits. It focuses on models containing Einsum and OneHot operations, which are common bottlenecks in neural network graphs. The tool works by temporarily downgrading onnxsim to version 0.4.30, applying its own optimization sequence to reduce redundant operations, then restoring the original environment. It can be used as a command-line tool or imported as a Python module.
The optimization strategy preserves Einsum operations rather than expanding them into MatMul chains, which can lead to significant reductions in model complexity—documented examples show reductions from 9,988 operations to 3,927. However, the tool has important limitations: it cannot safely process models with non-deterministic output shapes (like NonZero or NonMaxSuppression), and not all models benefit equally. The package requires onnx and onnxruntime as peer dependencies and is permissively licensed under MIT.
Use it for
- Optimize large computer vision models with Einsum operations for deployment on resource-constrained devices.
- Reduce model complexity and file size for models that onnxsim alone cannot adequately simplify.
- Pre-process ONNX models before quantization or conversion to other inference formats.
- Improve inference latency by reducing the operation count in models with OneHot layers.
- Prepare models with fixed input dimensions for edge deployment after manual shape specification.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you have ONNX models with Einsum or OneHot operations that standard optimizers leave largely unchanged and you can verify the model contains no non-deterministic operations.
The low install friction and permissive license make it a low-risk addition to a model optimization pipeline. However, the dormant maintenance status means no active support for new onnxsim versions or bug fixes—treat it as a specialized tool for a specific problem, not a general-purpose optimizer.
Install
spo4onnx on PyPI
Before you install
Low friction installation with no runtime dependencies. The package is dormant (last release 2024-05-07, 829 days ago), so expect no active maintenance or bug fixes.
Requires onnx and onnxruntime to be installed separately; models with non-deterministic output shapes (NonZero, NonMaxSuppression) will be corrupted by optimization.
License in practice
MIT License permits free use, modification, and distribution with minimal restrictions, making this safe for commercial and open-source projects.
Quickstart
pip install spo4onnx
from spo4onnx import partial_optimization
optimized_model = partial_optimization(
input_onnx_file_path='model.onnx',
output_onnx_file_path='model_optimized.onnx'
)
Verify before relying
- Whether the tool's optimization gains (claimed 30%-60% reduction) are reproducible across model architectures beyond the documented examples.
- Current compatibility with recent onnxsim versions beyond the default 0.4.30 target.
- Whether models with dynamic shapes can be reliably optimized without manual intervention.
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 | Dormant 829 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 82,697 / month, #14,143 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: spo4onnx-1.0.5-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
An agent finds packages by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language. Give your agent the search over MCP.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also scs4onnx · onnxsim · onnxoptimizer · opt-einsum-fx · sne4onnx · sde4onnx · snd4onnx · cotengra · opt-einsum · sbi4onnx