Repository navigation
Commit 0a2d958
authored
onnxsim: Add version 0.7.3 (#2266)
* onnxsim: Add version 0.7.3
Mirrors build-onnxoptimizer.yml: onnxsim vendors onnx-optimizer (which
vendors onnx) as git submodules and links onnx/protobuf statically, the
same shape already ported. cp310 is dropped for the same reason
(onnxoptimizer has no riscv64 onnx wheel there); cp312's abi3 wheel
serves 3.12+.
* onnxsim: fix matrix so both cp311 and cp312 actually build
An include list whose entries share no key with the base matrix
collapses onto a single job instead of adding one per entry (confirmed
against onnxoptimizer's own CI run, which built only cp312 despite
listing cp311 too). Make python a real matrix dimension so include only
attaches onnxruntime to the matching combination.
* onnxsim: ignore test files with unguarded torch/timm/onnxruntime imports
CI confirmed the wheel itself builds and passes abi3audit on both
interpreters, but pytest aborts collection outright on test_python_api.py,
test_simple.py, test_timm.py, test_rfdetr.py and test_yolo.py: each does
a module-level import of torch, timm or onnxruntime with no
pytest.importorskip guard, so a missing module is a collection error
(exit code 2) rather than a skip. None of those packages have riscv64
wheels (onnxruntime only from cp312, which still lacks timm/rfdetr/
ultralytics/torch), so ignore the files themselves.
* onnxsim: pin ir_version in test_profiling's _foldable_model
cp312-manylinux_riscv64's test step failed all 10 tests in
tests/test_profiling.py:
RuntimeError: Your model ir_version 14 is higher than the
checker's (13).
_foldable_model() builds its onnx.ModelProto via helper.make_model()
with no ir_version, so the model is stamped with whatever
onnx.IR_VERSION the installed onnx package currently defines - and
our registry's newest riscv64 onnx build for cp312 is 1.23.0. onnxsim
statically links a vendored onnx (via the onnx-optimizer git
submodule, frozen at a pinned commit) whose checker only recognizes up
to ir_version 13, so any onnx installed newer than that submodule's
pin breaks every caller of _foldable_model() before the test gets to
what it actually means to check.
Every other test file that builds a model by hand pins ir_version
explicitly; test_profiling.py's _foldable_model() was the one
holdout. Match the existing convention (ir_version=10) so the fixture
stays valid across the range of onnx versions the unpinned runtime
dependency can resolve to.
Adds the checkout/apply-patches step pair (mirroring
build-py-spy.yml) and patches/onnxsim/** to path triggers.
* onnxsim: deselect the two Conv+BN fusion checks on cp311
cp311 has no riscv64 onnxruntime wheel, so onnxsim's check_n equivalence
check runs through onnx's ReferenceEvaluator instead. For opset 9-13 that
dispatches BatchNormalization to BatchNormalization_9, whose inference
path is guarded by `if momentum is None` -- but OpRun fills the attribute
with its schema default 0.9, so it always takes the momentum branch and
blends the batch's own mean/var into the running statistics. The
unsimplified Conv+BN model is therefore evaluated wrongly, and the
correctly fused single Conv is reported as a mismatch (max diff 5.33 in
the riscv64 log).
Not riscv64-specific and not a precision issue: onnxsim 0.7.3's PyPI
x86_64 wheel with onnx 1.23.0 / numpy 2.4.6 and no onnxruntime fails the
same two tests every run (max diff 1.3-3.7). Against a float64 numpy
reference, the fused Conv is within 3.7e-6 while the reference
evaluator's Conv+BN is off by 16.3 and matches the momentum-blended
formula to 2.3e-6. With onnxruntime installed (cp312 here, and every leg
of upstream's CI) both tests pass. onnx main still has the same
BatchNormalization_9 code.
* onnxsim: set ONNXSIM_RELEASE so the wheel is 0.7.3, not 0.7.3.dev0
setup.py appends `.dev<N>` from `git rev-list --count v<ver>..HEAD`
whenever git is available, which it is in the cibuildwheel container, so
the previous run built onnxsim-0.7.3.dev0-*.whl. The publish job titles
the release from the wheel metadata and would have shipped
onnxsim-v0.7.3.dev0. Upstream's own tag builds set ONNXSIM_RELEASE for
exactly this; mirror that.1 parent b0ce0c3 commit 0a2d958
3 files changed
Lines changed: 248 additions & 0 deletions
File tree
- .github/workflows
- docs/packages
- patches/onnxsim/0.7.3
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
Lines changed: 64 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
0 commit comments