Skip to content

Fix uninterpolated error messages in per-channel TensorQuantOverrides validation - #31696

Open
Nilesh Patil (nileshpatil6) wants to merge 1 commit into
microsoft:mainfrom
nileshpatil6:fix-quant-override-fstrings
Open

Fix uninterpolated error messages in per-channel TensorQuantOverrides validation#31696
Nilesh Patil (nileshpatil6) wants to merge 1 commit into
microsoft:mainfrom
nileshpatil6:fix-quant-override-fstrings

Conversation

@nileshpatil6

Copy link
Copy Markdown

Reopens #29551, which Xavier Dupré (@xadupre) had already approved. I accidentally killed that PR by deleting my fork while cleaning up old repos, and GitHub won't let a PR reopen once the head repo is gone. Same commit, cherry-picked onto current main (clean, no conflicts).

For context from the original PR:

Four error messages in TensorQuantOverridesHelper._is_valid_per_channel were built as plain strings instead of f-strings, so users hitting per-channel validation errors saw literal {tensor_name} and {index} placeholders instead of the actual tensor and channel index. The fix adds the missing f prefixes and a regression test.

Re-verified after the rebase: installed the published onnxruntime wheel, swapped in the patched tensor_quant_overrides.py, and ran test_tensor_quant_overrides_option.py: 22 passed, 47 subtests passed. Also did the negative control again, against the unpatched wheel the new test fails with the literal placeholder message, with the patch it passes.

The one failing check on the old PR (web_Debug / build_onnxruntime_web) was an unrelated WebGPU flake in the browser test suite, this change only touches the Python quantization tooling.

… validation

The mismatch checks for quant_type, axis, symmetric and reduce_range in
TensorQuantOverridesHelper._is_valid_per_channel were missing the f prefix,
so the returned error string literally contained {tensor_name} and {index}
instead of the actual values. Added the missing f prefixes and a test that
exercises the symmetric mismatch case.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant