use typed quantize config instead of a raw dict#1249
Conversation
Signed-off-by: Shengliang Xu <shengliangx@nvidia.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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe changes introduce type safety to the quantization configuration by replacing an untyped dictionary with a strongly typed Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
safe from Pydantic v2 Signed-off-by: Shengliang Xu <shengliangx@nvidia.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1249 +/- ##
==========================================
+ Coverage 76.90% 77.44% +0.54%
==========================================
Files 350 350
Lines 40524 40524
==========================================
+ Hits 31166 31385 +219
+ Misses 9358 9139 -219
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cjluo-nv
left a comment
There was a problem hiding this comment.
Small, well-scoped bug fix (6 lines changed across 3 files). Changes ModelOptPTQRecipe.quantize from dict[str, Any] to the proper typed QuantizeConfig, fixing an accidental raw-dict typing. The hf_ptq.py example correctly calls .model_dump() to convert back to a dict where downstream code expects dict operations (.append(), copy.deepcopy(), subscript access). Tests are updated to match the new typed access pattern. The change is correct and straightforward.
### What does this PR do? But fix: Use typed QuantizeConfig instead using raw dict for formal typed ModelOpt configs. The dict typing was accidental. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Quantization recipe configuration is now implemented with a strongly-typed, structured schema that enforces type safety and provides enhanced validation with comprehensive error detection capabilities. * **Tests** * Updated recipe loading tests to correctly validate quantization configurations when recipes are loaded from directories, fully supporting the new structured object-based configuration format. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Shengliang Xu <shengliangx@nvidia.com>
What does this PR do?
But fix:
Use typed QuantizeConfig instead using raw dict for formal typed ModelOpt configs.
The dict typing was accidental.
Summary by CodeRabbit
Refactor
Tests