Skip to content

Commit 43594f0

Browse files
author
Avishek Goswami
committed
Merge branch 'main' into feat/group-size-divisibility-check
Signed-off-by: Avishek Goswami <avishek.goswami@ibm.com>
2 parents efda147 + b9a6f88 commit 43594f0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/llmcompressor/modifiers/quantization/group_size_validation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,17 @@ def validate_group_size_divisibility(
9595
model: torch.nn.Module,
9696
resolved_targets: Set[str],
9797
ignore: list[str],
98+
*,
99+
bypass: bool = False,
98100
) -> None:
99101
"""
100102
Ensure targeted group/tensor_group layers have columns divisible by group_size.
101103
102104
If any such layer has columns % group_size != 0, raises ValueError with layer FQNs.
105+
When bypass is True, skips the check (e.g. for runtimes that support non-divisible).
103106
"""
107+
if bypass:
108+
return
104109
indivisible = get_layers_indivisible_by_group_size(model, resolved_targets, ignore)
105110
if not indivisible:
106111
return

tests/llmcompressor/modifiers/quantization/test_group_size_validation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ def test_get_layers_indivisible_by_group_size_finds_layer():
6060
from compressed_tensors.quantization import QuantizationScheme, QuantizationStrategy
6161
from compressed_tensors.quantization.quant_args import QuantizationArgs
6262

63-
# 1) Unit test: _layer_indivisible with a simple args object (no CT QuantizationArgs
64-
# attribute quirks; tests our logic in isolation).
63+
# 1) Unit test: _layer_indivisible with strategy=GROUP (enum).
6564
# Linear(in_features, out_features) has weight.shape = (out_features, in_features);
6665
# we use shape[-1] (columns) for group divisibility, so use in_features=200.
6766
linear = torch.nn.Linear(

0 commit comments

Comments
 (0)