Fix stale value_info on ONNX export and IndexError in powermetrics - #12
Open
alisajil wants to merge 1 commit into
Open
Fix stale value_info on ONNX export and IndexError in powermetrics#12alisajil wants to merge 1 commit into
alisajil wants to merge 1 commit into
Conversation
…trics line OnnxOptimizer's Gather-squeeze QNN workaround hand-crafts a value_info entry without keeping the rest of the graph's shape info in sync. onnxruntime tolerates the resulting inconsistency but AI Hub's strict onnx.checker rejects it (ShapeInferenceError: rank mismatch). Refresh value_info from scratch at the end of every optimization pass instead of patching individual exported artifacts by hand each time this comes up. Also guard PowerMetricsCollector._run_apple against an empty stdout line from the powermetrics subprocess, which crashed a background thread with an IndexError. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Author
|
@microsoft-github-policy-service agree |
1 similar comment
Author
|
@microsoft-github-policy-service agree |
Author
|
@microsoft-github-policy-service agree company="ecogo.ai" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small, independent bug fixes found while exporting a model through the Qualcomm ONNX path and benchmarking on macOS:
conversion/_exporter/_onnx_utils.py:OnnxOptimizer's Gather-squeeze QNN workaround (_qc_workaround_squeeze_gather_4d) hand-crafts avalue_infoentry for an intermediate tensor without refreshing the rest of the graph's shape info afterward.onnxruntimetolerates the resulting inconsistency, but Qualcomm AI Hub's strictonnx.checker.check_model(..., full_check=True)rejects it withShapeInferenceError: Inferred shape and existing shape differ in rank. Fix: clearvalue_infoand re-runonnx.shape_inference.infer_shapes()at the end of every optimization pass, so the saved model is always internally consistent regardless of which passes ran.conversion/_powermetrics.py:PowerMetricsCollector._run_appleindexes into an emptyreadline()result (if line[0] == 0), which throwsIndexErrorin a background thread whenever thepowermetricssubprocess emits a blank line. Fix: guard withif line and line[0] == 0.Test plan
value_infofailure on a 1080p (1920x1088) export throughconvert.py export --model-type onnx --target-device qualcomm; confirmedonnx.checker.check_model(full_check=True)now passes on all exported graphs (encoder part 1/2, decoder) with no manual post-processing.IndexErrorviaconvert.py export --benchmarkon macOS; confirmed the guard prevents the crash.