A lightweight tool for extracting subgraphs (model slicing) from ONNX models. Useful when onnx-simplifier exceeds the 2GB Protocol Buffers file size limit, or to split models into arbitrary sizes. Current version 2.0.1, released June 2024. Development is active.
pip install sne4onnxVerified import paths — ran on the pinned version, not inferred.
Extract a subgraph from an ONNX model by specifying input and output operation names.
Update to v2.0.0+ and ensure no usage of `onnx_graphsurgeon` inside sne4onnx (it is no longer a dependency).
Use node names (e.g., from model.graph.node[i].name) as input/output_op_names. Inspect the model's graph nodes to find correct names.
Avoid calling `onnx.shape_inference.infer_shapes()` on models with external data before extraction. Let sne4onnx handle it.
Use `sne4onnx -h` to see current CLI arguments. Prefer long-form options for scripts to avoid ambiguity.