-
Notifications
You must be signed in to change notification settings - Fork 168
[5545101]: AutoCast: Add options to force include node/op in F16 #386
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds force-include controls to AutoCast: new include parameters in CLI and Python API propagate to NodeClassifier, which now evaluates include rules that can override exclude rules when classifying node precision. Documentation, changelog, and unit tests updated. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User/Script
participant CLI as AutoCast CLI
participant Convert as convert_to_mixed_precision
participant NC as NodeClassifier
participant ONNX as ONNX Model
U->>CLI: autocast --nodes_to_include ... --op_types_to_include ...
CLI->>Convert: convert_to_mixed_precision(..., nodes_to_include, op_types_to_include)
Convert->>NC: NodeClassifier(..., nodes_to_include, op_types_to_include)
Convert->>NC: run(model)
loop For each node
NC->>NC: Evaluate exclude rules
NC->>NC: Evaluate include rules
alt Matches exclude AND not matches include
NC-->>Convert: classify node as High precision (keep FP32)
else Otherwise (include matched or not excluded)
NC-->>Convert: classify node as Low precision (cast to FP16/BF16)
end
end
Convert->>ONNX: Apply casts per classification
Convert-->>CLI: Return mixed-precision model
CLI-->>U: Output model/report
note over NC: Include rules take precedence and can force low precision
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 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)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #386 +/- ##
==========================================
+ Coverage 73.86% 73.88% +0.02%
==========================================
Files 171 171
Lines 17629 17645 +16
==========================================
+ Hits 13021 13037 +16
Misses 4608 4608 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add options nodes_to_include, op_types_to_include that force-include nodes in the conversion, overriding NodeClassifier exclusion logic Signed-off-by: Gal Hubara Agam <[email protected]>
be7614f
to
1ac7868
Compare
Signed-off-by: Gal Hubara Agam <[email protected]>
What does this PR do?
Type of change: ? new feature
Overview:
Add options nodes_to_include, op_types_to_include that force-include nodes in the conversion, overriding NodeClassifier exclusion logic
Usage
Testing
pytest tests/unit/onnx/autocast/test_nodeclassifier.py::test_node_classifier_force_include
Before your PR is "Ready for review"
Additional Information
Summary by CodeRabbit
New Features
Documentation
Tests
Chores