-
Notifications
You must be signed in to change notification settings - Fork 169
[5452146] Fix: 'Invalid tensor data type 0' #308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5452146] Fix: 'Invalid tensor data type 0' #308
Conversation
WalkthroughInternal updates to PrecisionConverter.convert() refine shape sanitization to preserve known static dims, add a post-inference step to replace UNDEFINED tensor element types with the target low-precision type, and align handling of graph Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant PC as PrecisionConverter
participant SI as ShapeInference
participant GI as Graph(value_info/outputs)
U->>PC: convert(model, target_dtype)
rect rgb(245,248,255)
note right of PC: Initial inference without strict type checks
PC->>SI: infer_shapes(check_type=false)
SI-->>PC: shapes/types (may include UNDEFINED)
end
rect rgb(245,255,245)
note right of PC: New step: ensure types defined
PC->>GI: _ensure_types_are_defined()<br/>Replace UNDEFINED elem_type -> target low-precision
GI-->>PC: value_info updated
end
rect rgb(255,248,240)
note right of PC: Conservative shape sanitization
PC->>GI: For each dim: set dim_param="unk" only when dim_value is concrete
GI-->>PC: value_info & outputs aligned
end
PC-->>U: Converted model
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks (3 passed)✅ Passed checks (3 passed)
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
87ca671
to
d0001ee
Compare
Signed-off-by: gcunhase <[email protected]>
d0001ee
to
5bd42c5
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #308 +/- ##
==========================================
- Coverage 73.93% 73.86% -0.07%
==========================================
Files 172 172
Lines 17408 17415 +7
==========================================
- Hits 12870 12864 -6
- Misses 4538 4551 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: gcunhase <[email protected]>
What does this PR do?
Type of change: Bug fix
Overview: Fixed 'Invalid tensor data type 0' in ONNX Autocast by ensuring that intermediate tensors have a defined data type.
Usage
$ python -m modelopt.onnx.quantization --onnx_path=$MODEL_NAME.onnx --high_precision_dtype=fp16
Testing
Internal model.
Before your PR is "Ready for review"
Additional Information
Related: #302
Summary by CodeRabbit
Bug Fixes
Improvements