Skip to content

Commit 5e75764

Browse files
committed
packing_format --> float8_packing_format
1 parent de9a931 commit 5e75764

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

test/quantization/quantize_/workflows/float8/test_float8_opaque_tensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def get_config(granularity):
2929
return Float8DynamicActivationFloat8WeightConfig(
3030
activation_dtype=torch.float8_e4m3fn,
3131
granularity=granularity,
32-
packing_format="opaque",
32+
float8_packing_format="opaque",
3333
)
3434

3535

torchao/quantization/quant_api.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,7 @@ class Float8DynamicActivationFloat8WeightConfig(AOBaseConfig):
17701770
kernel_preference: KernelPreference = KernelPreference.AUTO
17711771
set_inductor_config: bool = True
17721772
version: int = 2
1773-
packing_format: Float8PackingFormat = Float8PackingFormat.PLAIN
1773+
float8_packing_format: Float8PackingFormat = Float8PackingFormat.PLAIN
17741774

17751775
def __post_init__(self):
17761776
torch._C._log_api_usage_once(
@@ -1781,7 +1781,7 @@ def __post_init__(self):
17811781
activation_granularity, weight_granularity = _normalize_granularity(
17821782
self.granularity
17831783
)
1784-
if self.packing_format == Float8PackingFormat.PLAIN:
1784+
if self.float8_packing_format == Float8PackingFormat.PLAIN:
17851785
assert isinstance(activation_granularity, (PerTensor, PerRow)), (
17861786
f"Unsupported granularity {activation_granularity}, only PerTensor or PerRow are supported."
17871787
)
@@ -1809,7 +1809,7 @@ def _float8_dynamic_activation_float8_weight_quantize_tensor(weight, config):
18091809
activation_value_lb = config.activation_value_lb
18101810
activation_value_ub = config.activation_value_ub
18111811
kernel_preference = config.kernel_preference
1812-
packing_format = config.packing_format
1812+
float8_packing_format = config.float8_packing_format
18131813

18141814
# Ensure works on device
18151815
activation_granularity, weight_granularity = granularity
@@ -1861,7 +1861,7 @@ def _float8_dynamic_activation_float8_weight_quantize_tensor(weight, config):
18611861
kernel_preference=kernel_preference,
18621862
)
18631863

1864-
if packing_format == Float8PackingFormat.PLAIN:
1864+
if float8_packing_format == Float8PackingFormat.PLAIN:
18651865
quantized_weight = Float8Tensor.from_hp(
18661866
weight,
18671867
float8_dtype=weight_dtype,
@@ -1870,15 +1870,17 @@ def _float8_dynamic_activation_float8_weight_quantize_tensor(weight, config):
18701870
kernel_preference=kernel_preference,
18711871
act_quant_kwargs=act_quant_kwargs,
18721872
)
1873-
elif packing_format == Float8PackingFormat.OPAQUE:
1873+
elif float8_packing_format == Float8PackingFormat.OPAQUE:
18741874
block_size = get_block_size(weight.shape, weight_granularity)
18751875
quantized_weight = Float8OpaqueTensor.from_hp(
18761876
weight,
18771877
block_size=block_size,
18781878
act_quant_kwargs=act_quant_kwargs,
18791879
)
18801880
else:
1881-
raise ValueError(f"Unsupported float8 packing format: {packing_format}")
1881+
raise ValueError(
1882+
f"Unsupported float8 packing format: {float8_packing_format}"
1883+
)
18821884

18831885
return quantized_weight
18841886

0 commit comments

Comments
 (0)