Add Vision v8 ONNX quantization release tooling - #22
Conversation
Complexity-ML
left a comment
There was a problem hiding this comment.
The targeted tests pass, but the release path does not yet enforce the issue's acceptance criteria. Please address these blockers before merge:
-
quantize_int8()records all manifest settings in the sidecar, butquantize_static()does not receivesymmetric_activations,symmetric_weights,batch_size, ornum_threads. Apply the supported settings (for example the ONNX Runtime symmetry options), implement the batching/thread behavior, or remove unsupported fields from the reproducibility contract. The sidecar must only claim settings actually used. -
The fail-closed checks are disconnected helpers.
assert_disjoint_image_ids,check_provider_precision_supported,check_unexpected_fp32_nodes, andcheck_quantized_accuracy_reportare called only by unit tests. The existingonnx-release.ymlstill builds, verifies, and uploads only the FP32 artifacts. Wire FP16/INT8 generation, all required gates, and the quantized assets/checksums into the release workflow so a failed required artifact blocks publication. -
The configured raw-logit, decoded-box, and score thresholds are never consumed.
check_quantized_accuracy_report()only checks mAP, and it expects{reference, candidate}whileevaluate_onnx_coco.pyproduces abranchesreport. Add executable FP32-vs-quantized raw and decoded parity gates and connect the evaluator output to the accuracy gate. -
The documented evaluation and benchmark commands pass
tr_hash_v8_o2m_fp16.jsonas detector metadata. That path is the default quantization sidecar written byquantize_onnx.py, and it lacks the detector metadata fields required byOnnxDetectorPipeline. Keep the detector metadata at a distinct path (or copy/extend it) and update the reproduction commands.
Also, peak_memory_mb currently samples process RSS once after the benchmark rather than measuring a peak, and ruff format --check fails on three changed files (complexity/deploy/onnx_detector/pipeline.py, scripts/check_onnx_quantized_artifacts.py, and tests/test_onnx_quantization_accuracy_gate.py).
Validation performed locally at head 8982b727ea7629103d069b00e439a1a26de0f8c3: 19 targeted quantization tests passed; targeted ruff check passed.
|
Thanks for the review. I pushed a follow-up commit: Changes included:
Validation: |
Complexity-ML
left a comment
There was a problem hiding this comment.
Thanks for the follow-up. The ORT settings, detector/provenance sidecar split, and parity integration address part of the previous review, but the release path is still not executable and does not yet enforce all acceptance criteria.
-
The committed calibration manifest still contains placeholder hashes and has no
image_idsorimages.load_calibration_manifest(configs/vision_v8_quantization_calibration.json)currently fails withdataset.image_ids_sha256 must be a SHA-256. The configuredaccuracy.jsonandaccuracy.mdinputs are also absent from a clean checkout, sobuild_onnx_release.pyaborts before producing quantized artifacts. -
The release workflow runs on
ubuntu-latestand installs the CPUonnxruntimepackage, while the release config requiresCUDAExecutionProviderfor FP16. ORT will fall back to CPU and the provider gate will then reject CPU/FP16. Please use a runner/runtime that can satisfy the configured provider, or revise the supported release contract. -
INT8 calibration batches eight images, but
build_release()exports a fixed-batch-size-1 ONNX graph becausedynamic_batchis not enabled. The calibration reader's[8, 3, H, W]input cannot run against that graph. Export dynamically or keep calibration inputs compatible with the exported shape. -
The COCO accuracy gate validates only one global
candidate_precision. A report with passing FP16 and catastrophically regressed INT8 is accepted whencandidate_precisionisfp16; the INT8 section is ignored. The release requires both FP16 and INT8 to be compared against FP32 for both branches. -
assert_disjoint_image_ids()is still called only by tests. Wire the actual calibration IDs and evaluation IDs into the release gate so a declareddisjoint_fromstring cannot substitute for the required leakage check. -
Benchmark reports are not generated, validated, or included in the release manifest, and
peak_memory_mbstill samples RSS once after the benchmark rather than measuring a peak. This remains part of issue #19's scope and the PR's documented release assets.
Validation at c6093db070b6cf820aaee68c4fff29396beb6d20: 44 relevant tests pass and ruff check passes. ruff format --check still fails on eight changed Python files. The green PR checks do not execute the ONNX release workflow; full-coco-eval is skipped.
|
Updated the quantized ONNX release path to address the latest review blockers.
Verification run locally:
Caveat before merge:
|
Complexity-ML
left a comment
There was a problem hiding this comment.
Thanks for the follow-up. The latest commit addresses the per-precision accuracy gate, actual image-ID leakage check, artifact bindings, benchmark generation, and peak-memory sampling. The targeted suite passes (52 passed) and ruff check passes, but the clean release path still has two execution blockers:
-
The evidence artifact uploads only
calibration.json,accuracy.json, andaccuracy.md.build_onnx_release.pythen dereferences every path incalibration.json["images"]for INT8 calibration and uses the first one for parity. Those image files live on the self-hosted evidence runner and are not uploaded or recreated on the freshubuntu-latestrelease runner, so the release build will fail as soon as preprocessing opens them. Please package the pinned calibration images with the evidence artifact and rewrite/resolve the manifest paths against that downloaded directory, or deterministically materialize the images in the release job. -
The release job installs CPU-only ONNX Runtime, and the release config now declares
CPUExecutionProvideras supporting FP16. ONNX Runtime's own float16 documentation states that the CPU build does not support float16 ops. This turns the provider policy into a declaration that makes the static gate pass, but the generated FP16 detector still cannot be executed by the configured release runner for parity and benchmarks. Please run the FP16 gates on a GPU runner withonnxruntime-gpu/CUDA (and keep INT8 on CPU if required), or use an execution provider that actually supports the FP16 graph. The checked-in implementation plan also still defines CPU as FP32/INT8 only.
There is also a formatting regression: ruff format --check reports that scripts/check_onnx_quantized_parity.py and scripts/quantize_onnx.py would be reformatted.
Validation at 0c63ed4c7cd0741a05f1c3ff530875635a264dcd: 52 targeted tests passed; ruff check passed; ruff format --check failed on the two files above. The public PR checks are green, but full-coco-eval is still skipped and therefore does not exercise either blocker.
|
Updated the release path for the latest review feedback.
Local verification:
|
Complexity-ML
left a comment
There was a problem hiding this comment.
The latest fixes address the previous calibration portability and release-runner issues, but the quantized accuracy evidence path still does not enforce the release provider contract.
Blocking issues:
-
vision-v8-coco-accuracy.ymlpasses the same${{ inputs.provider }}to FP32, FP16, and INT8 evaluations. The checked-in release contract requires CPU for FP32, CUDA for FP16, and CPU for INT8, so no single input value can produce evidence for that matrix. The evaluation job also installs theexportextra, which depends on the CPUonnxruntimedistribution, rather than explicitly installingonnxruntime-gpufor the FP16 CUDA run. -
merge_vision_v8_coco_reports.pykeeps only the top-level environment from the first FP32 report and does not copyenvironmentinto each nested precision report.check_quantized_accuracy_report()then validates metrics and artifact hashes but never validatesrequested_provideroractual_providerper precision. I reproduced this locally: a complete FP32/FP16/INT8 report withWrongExecutionProviderfor every precision returns no gate failures. This allows FP16 CPU fallback or INT8 CUDA evidence to be accepted despite the release policy. -
The release workflow downloads an arbitrary prior
EVIDENCE_RUN_ID, but neither the workflow norbuild_onnx_release.pybinds the evidence report'sframework_committo the evaluator revision expected by the release. Artifact hashes bind the model files, but stale evaluator logic can still supply accepted metrics.
Please use an explicit provider per precision, preserve and validate provider metadata for every nested precision report, install the matching ORT distribution in the evidence job, and bind the downloaded evidence to an accepted evaluator revision.
Validation on e57ab278: 87 relevant tests passed; targeted Ruff check and format check passed. The PR checks are green for onnx-parity and fixture-gate, but full-coco-eval is skipped, so the affected publication path has not run.
|
Pushed follow-up commit
Local targeted validation passed: |
Closed: #19
Summary:
Validation:
Note: