Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/prototype/test_awq.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ def forward(self, x):
device_to_base_configs = {
"cuda": [
Int4WeightOnlyConfig(group_size=128),
# Note: the functionality unit test doesn't work for hqq
Int4WeightOnlyConfig(group_size=128, int4_packing_format="tile_packed_to_4d"),
Int4WeightOnlyConfig(
group_size=128,
int4_packing_format="tile_packed_to_4d",
Copy link
Contributor Author

@namgyu-youn namgyu-youn Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: How about using packing_format instead of int4_packing_format, and choose_qparams_algorithm instead of int4_choose_qparams_algorithm? The current name seems too long and not generalized.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is intentional actually since we don't want to introduce global abstractions that is only used by a single dtype

int4_choose_qparams_algorithm="hqq",
),
],
"cpu": [Int4WeightOnlyConfig(group_size=128, int4_packing_format="opaque")],
"xpu": [Int4WeightOnlyConfig(group_size=128, int4_packing_format="plain_int32")],
Expand Down
6 changes: 6 additions & 0 deletions torchao/quantization/quant_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,12 @@ class Int4WeightOnlyConfig(AOBaseConfig):

def __post_init__(self):
torch._C._log_api_usage_once("torchao.quantization.Int4WeightOnlyConfig")
if isinstance(self.int4_packing_format, str):
self.int4_packing_format = Int4PackingFormat(self.int4_packing_format)
if isinstance(self.int4_choose_qparams_algorithm, str):
self.int4_choose_qparams_algorithm = Int4ChooseQParamsAlgorithm(
self.int4_choose_qparams_algorithm
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are not needed actually since we use str Enum

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove this? I guess we can just add the config and it works.



# for BC
Expand Down