-
Notifications
You must be signed in to change notification settings - Fork 222
[5750013][5591945][5360813]: AutoCast standalone implementation for type inference #719
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
Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #719 +/- ##
==========================================
- Coverage 74.69% 74.62% -0.08%
==========================================
Files 192 192
Lines 18946 19169 +223
==========================================
+ Hits 14152 14305 +153
- Misses 4794 4864 +70 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
created by cursor and committed by mistake Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com>
Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com>
Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com>
…add to changelog Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com>
a659cad to
7caedc7
Compare
What does this PR do?
Type of change: New feature
Overview:
AutoCast runs full type inference to get the new types after adding casts. ONNX doesn't have a separate function for type inference, and it is done as part of shape inference. Shape inference is a much more complex task than type inference, especially when dynamic shapes are involved. We're seeing some shape inference related bugs in AutoCast. Typically we can WAR, but it's cumbersome. A local implementation might allow users to WAR shape inference related issues. This is opt-in and marked as experimental.
Usage
python -m modelopt.onnx.autocast --onnx_path /path/to/input.onnx [options] --use_standalone_type_inference
Testing
Added use_standalone_type_inference=True to all existing PrecisionConverter tests.
Before your PR is "Ready for review"
Additional Information
A more permanent fix would be to decouple type and shape inference in ONNX, we should invest in that when we have the resources - see onnx/onnx#7100
. This is a quick fix, which is also why it is opt-in and not the default mode.