--- id: scs4onnx version: "1.0.18" license: MIT License license_treatment: permissive maintenance: abandoned --- # 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. License: permissive · Maintenance: abandoned · Downloads: 82.9K/mo ## 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 above — 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 pip install scs4onnx uv add scs4onnx poetry add scs4onnx ## Installing 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_current - Install friction: low - Maintenance: abandoned - Downloads: 82.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags onnx model compression, reduce onnx file size, deduplicate onnx constants, onnx weight extraction, shrink neural network models, onnx constant aggregation, optimize onnx graph size, model-optimization, onnx-tools, compression [View on SkillFed](https://skillfed.io/packages/scs4onnx) · [View on PyPI](https://pypi.org/project/scs4onnx/)