sam4onnx
A very simple tool to rewrite parameters such as attributes and constants for OPs in ONNX models. Simple Attribute and Constant Modifier for ONNX.
Decision gist · record as of 2026-08-14
Yes, if you need to edit ONNX operator parameters post-export. Low install friction, no dependencies, permissive license, and straightforward API make it a practical choice for model tweaking. Aging maintenance (189 days since last release) is a minor concern but not a blocker for a stable utility tool. Verify that graph-level side effects of your edits are acceptable before relying on it in production pipelines.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with no runtime dependencies.
- Maintenance status is aging—last release 189 days ago—but the repository remains active and targets current Python versions.
License · maintenance · safety
MIT License (permissive) — MIT License permits commercial and private use, modification, and distribution with minimal restrictions, making it suitable for most projects.
last release 2026-02-06 (189 days) · last repo commit 2026-02-06 · 15 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 82,975 downloads/mo, #14,113 on PyPI
Alternatives
Verify before relying
pip install sam4onnx
from sam4onnx import modify
modified = modify(
input_onnx_file_path='model.onnx',
output_onnx_file_path='modified.onnx',
op_name='Transpose_17',
attributes={'perm': [0, 1]}
)- Whether graph integrity validation is performed after modifications beyond the documented single-OP scope.
- Performance characteristics when working with large models or deeply nested subgraph structures.
- Compatibility with ONNX opset versions beyond what the fact sheet documents.
What it is and what it does
sam4onnx is a lightweight utility for modifying operator attributes and constant inputs in ONNX models. It accepts either a file path to an .onnx model or an in-memory onnx.ModelProto object, locates a specified operator by name, and rewrites its attributes or the constants feeding into it. The tool operates on a single operator at a time and includes support for recursive modification within If operator subgraphs.
The package provides both a command-line interface and a Python API. It does not validate the overall graph integrity after modifications—that responsibility falls to the user. It is designed for simple, targeted edits rather than comprehensive model transformation, making it useful for quick parameter adjustments, debugging, or preparing models for deployment with modified hyperparameters.
Use it for
- Adjust operator attributes (e.g., transpose permutation, reshape dimensions) in an exported ONNX model without retraining.
- Modify constant tensor values feeding into operators to test different hyperparameters or thresholds.
- Batch-edit multiple models' parameters via CLI for deployment pipeline automation.
- Recursively update parameters in conditional branches (If operators) across a model's subgraph structure.
- Prepare quantized or pruned models by rewriting shape metadata or operator-specific configuration.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to edit ONNX operator parameters post-export.
Low install friction, no dependencies, permissive license, and straightforward API make it a practical choice for model tweaking. Aging maintenance (189 days since last release) is a minor concern but not a blocker for a stable utility tool. Verify that graph-level side effects of your edits are acceptable before relying on it in production pipelines.
Install
sam4onnx on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance status is aging—last release 189 days ago—but the repository remains active and targets current Python versions.
License in practice
MIT License permits commercial and private use, modification, and distribution with minimal restrictions, making it suitable for most projects.
Quickstart
pip install sam4onnx
from sam4onnx import modify
modified = modify(
input_onnx_file_path='model.onnx',
output_onnx_file_path='modified.onnx',
op_name='Transpose_17',
attributes={'perm': [0, 1]}
)
Verify before relying
- Whether graph integrity validation is performed after modifications beyond the documented single-OP scope.
- Performance characteristics when working with large models or deeply nested subgraph structures.
- Compatibility with ONNX opset versions beyond what the fact sheet documents.
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 | Aging 189 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 82,975 / month, #14,113 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: sam4onnx-2.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “onnx model attribute modifier”
- sam4onnxRewrites attributes and constants in ONNX model operators via CLI or…
- soc4onnxChanges the opset version of an ONNX model graph, either via…
- sod4onnxsod4onnx removes specified output operations from ONNX model files,…
Give your agent the search over MCP, or paste the wish link into any chat.
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 onnxscript · sng4onnx · sed4onnx · soc4onnx · sna4onnx · sio4onnx · soa4onnx · sor4onnx · sod4onnx · sog4onnx