Skip to content

Commit 0275c61

Browse files
Asma Kuriparambil ThekkumpaterealAsma
authored andcommitted
[1/N] Refactored AutoQuantizeSearcher to _AutoQuantizeBaseSearcher & AutoQuantizeGradientSearcher; seperated quant modules and score modules
Signed-off-by: realAsma <[email protected]> minor Signed-off-by: realAsma <[email protected]> minor Signed-off-by: realAsma <[email protected]> chery-picked some relevant changes Signed-off-by: realAsma <[email protected]> updated docs; code clean up Signed-off-by: realAsma <[email protected]> clean ups Signed-off-by: realAsma <[email protected]> clean ups Signed-off-by: realAsma <[email protected]> Remove torch.compile decorator to fix ONNX unittests Signed-off-by: realAsma <[email protected]>
1 parent 01e24fd commit 0275c61

File tree

6 files changed

+531
-293
lines changed

6 files changed

+531
-293
lines changed

modelopt/torch/opt/hparam.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __eq__(self, other) -> bool:
4848
class Hparam:
4949
"""A base hyperparameter of a DynamicModule.
5050
51-
An example of such a Hparam could be an hparam with identity dependencies.
51+
Keeps track of hyperparameter values and their importance, which can be used for search algorithms.
5252
"""
5353

5454
Importance = Union[torch.Tensor, None] # noqa: UP007
@@ -249,10 +249,14 @@ def _enforce_order(self, order: torch.Tensor | None = None) -> None:
249249
order = order.cpu()
250250
self._slice_order = order
251251

252+
@property
253+
def attrs(self) -> list[str]:
254+
"""Return the attributes of the hparam for repr."""
255+
return ["choices", "active", "original"]
256+
252257
def __repr__(self) -> str:
253258
"""Return string representation with relevant properties of the class."""
254-
attrs = ["choices", "active", "original"]
255-
return f"{type(self).__name__}({', '.join(f'{x}={getattr(self, x)}' for x in attrs)})"
259+
return f"{type(self).__name__}({', '.join(f'{x}={getattr(self, x)}' for x in self.attrs)})"
256260

257261
def __iand__(self, hp: "Hparam"):
258262
"""Merge another hparam into self."""

0 commit comments

Comments
 (0)