scs4onnx
A very simple tool that compresses the overall size of the ONNX model by aggregating duplicate constant values as much as possible. Simple Constant value Shrink for ONNX.
What it is and what it does
scs4onnx is a command-line and Python API tool for reducing ONNX model file sizes by finding and consolidating duplicate constant tensor values across the computation graph. It operates in two modes: 'shrink' mode keeps constants inside the model for maximum inference speed, while 'npy' mode extracts repeated constants to external .npy files for smaller model size at the cost of file-loading overhead. The tool can also optionally downcast Float64 to Float32 and INT64 to INT32 to further compress models, and supports forced extraction of specific operations or constants by name.
The package is a lightweight utility with no runtime dependencies beyond onnx itself. It was designed for processing large models where constant duplication inflates file size—the documentation shows real examples like reducing a 1.8GB model to 886.8MB or extracting weights to achieve 2.1MB model plus 884.7MB external data. However, the project has been abandoned since September 2022 and receives no maintenance, so it may not work reliably with ONNX models or toolchains released after that date.
Use it for:
- Reduce deployment size of large computer vision models before shipping to edge devices or cloud inference endpoints.
- Extract weights from extremely large models that hit Protocol Buffer size limits, splitting into smaller .onnx plus external .npy files.
- Downcast high-precision models from Float64/INT64 to Float32/INT32 to save storage and improve inference speed.
- Deduplicate constant tensors in models generated by converters or graph optimization tools that may have introduced redundant copies.
- Prepare ONNX models for mobile or embedded deployment where model size impacts app download size and memory footprint.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Compresses ONNX model files by deduplicating constant tensor values throughout the graph, with options to extract weights to external .npy files or downcast numeric types for further size reduction.
Yes, if you have a large ONNX model with duplicate constants and need to reduce its file size before deployment. Install friction is low and the tool is straightforward to use. However, the project is abandoned and has not been maintained since September 2022, so test thoroughly with your specific ONNX models and toolchain versions before relying on it in production. No known security vulnerabilities.
Install
scs4onnx on PyPI
pip
pip install scs4onnxuv
uv add scs4onnxpoetry
poetry add scs4onnxInstalling scs4onnx
Before you install
Installs with no runtime dependencies and low friction. Project is abandoned as of September 2022 with no recent updates, so expect no bug fixes or maintenance going forward.
License in practice
MIT License permits free use, modification, and distribution with minimal restrictions, making it suitable for both open and proprietary projects.
Quickstart
pip install scs4onnx
from scs4onnx import shrinking
shrunk_graph, npy_paths = shrinking(
input_onnx_file_path='input.onnx',
output_onnx_file_path='output.onnx',
mode='shrink'
)
Requires onnx package to be installed separately; Python >=3.6.
Verify before relying
- Whether the tool works correctly with current ONNX opset versions released after September 2022
- Compatibility with modern ONNX model architectures and recent PyTorch/TensorFlow exports
- Performance impact of loading external .npy files in production inference pipelines
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 | abandoned — 1,436 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 82,855/month — #14,122 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: scs4onnx-1.0.18-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
sne4onnxExtracts subgraphs from ONNX model files by…
permissive · top 15,000 on PyPI
spo4onnxApplies specialized optimization techniques to…
permissive · top 15,000 on PyPI
scc4onnxConverts ONNX model input tensor dimensions and…
permissive · top 15,000 on PyPI
ssi4onnxInfers and fills missing tensor shape…
permissive · top 15,000 on PyPI
onnxoptimizerApplies graph-level optimizations to ONNX…
permissive · top 15,000 on PyPI
sed4onnxEncodes and decodes Base64-formatted constant…
permissive · top 15,000 on PyPI
sde4onnxRemoves embedded doc_strings from ONNX model…
permissive · top 15,000 on PyPI
ssc4onnxAnalyzes and displays the structure of ONNX…
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