Make quantization config parameters searchable#2573
Open
shaahji wants to merge 2 commits into
Open
Conversation
Callers pass kwargs by field alias (e.g. Footprint.record forwards `model_config=...`), matching how FootprintNode(**kwargs) constructs a node. Pydantic accepts aliases at construction time, but setattr only accepts real field names. Since `model_config` is reserved by Pydantic v2, the field is declared as `model_config_data` with alias="model_config", so a raw setattr(self, "model_config", v) raises "FootprintNode object has no field model_config". Map aliases back to field names first.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances Olive’s search-mode usability by making key quantization-related pass config parameters explicitly searchable (via search_defaults) and fixes a footprint update bug caused by Pydantic field aliasing.
Changes:
- Added a
CategoricalBoolsearch parameter alias for clearer boolean search defaults in pass configs. - Expanded/added
search_defaultsfor quantization and selective mixed precision parameters so they can participate in search. - Fixed
FootprintNode.updateto correctly handle Pydantic field aliases (e.g.,model_config).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| olive/search/search_parameter.py | Adds CategoricalBool as a readability-oriented alias for boolean categorical search parameters. |
| olive/passes/pytorch/selective_mixed_precision.py | Broadens and adds searchable defaults for selective mixed precision parameters (algorithm/bits/group sizes/bools/ratio). |
| olive/passes/pytorch/quant_utils.py | Adds searchable defaults for shared quantizer config parameters used by multiple PyTorch quantization passes. |
| olive/passes/pytorch/gptq.py | Makes damp_percent searchable via categorical defaults. |
| olive/engine/footprint.py | Fixes footprint node updates when callers pass field aliases (notably model_config). |
Updated SelectiveMixedPrecision & generic quant_config parameters to be searchable. Each is updated with reasonable searchable constants. Remove CategoricalBool; served no purpose as it was a duplicate of Boolean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make quantization config parameters searchable
Checklist before requesting a review
lintrunner -a(Optional) Issue link