-
Notifications
You must be signed in to change notification settings - Fork 169
Fix torch.onnx._internal imports for torch 2.9 #356
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
Conversation
WalkthroughRefactors typing and import patterns to use forward-referenced "GraphContext" and string-literal torch.Value annotations, adds TYPE_CHECKING guards and version-aware imports for torch.onnx internals, updates attention/export symbolics accordingly, and switches is_compiling checks from torch._dynamo to torch.compiler in tensor quantizer logic. Changes
Sequence Diagram(s)sequenceDiagram
actor U as Caller
participant D as Diffusers.FP8SDPA.symbolic
participant E as export_onnx.scaled_dot_product_attention
participant O as ONNX Graph
Note over D,E: GraphContext and Value types are forward-referenced (string) with TYPE_CHECKING guards.
U->>D: call symbolic(g, q, k, v, attn_mask?, scale?)
alt torch.onnx version A
D->>E: delegate SDPA export (version-aware imports)
else torch.onnx version B
D->>E: delegate SDPA export (alt symbolics)
end
E->>O: emit attention nodes (scale/mask/causal paths)
O-->>U: constructed subgraph
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used🧬 Code graph analysis (1)modelopt/torch/quantization/nn/modules/tensor_quantizer.py (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). (5)
🔇 Additional comments (11)
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 |
Signed-off-by: Keval Morabia <[email protected]>
a5cfedd
to
0a4521a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #356 +/- ##
==========================================
- Coverage 73.48% 73.46% -0.02%
==========================================
Files 172 172
Lines 17636 17640 +4
==========================================
Hits 12960 12960
- Misses 4676 4680 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Keval Morabia <[email protected]>
Signed-off-by: Keval Morabia <[email protected]>
Signed-off-by: Keval Morabia <[email protected]> Signed-off-by: Ye Yu <[email protected]>
What does this PR do?
Type of change: Import fixes
Testing
Summary by CodeRabbit
Refactor
Chores
Documentation
Notes