Skip to content

Commit

Permalink
Update number of groups (#178)
Browse files Browse the repository at this point in the history
* set num_groups to 1 if if < 1

* Update src/compressed_tensors/quantization/lifecycle/initialize.py

Co-authored-by: Kyle Sayers <[email protected]>

---------

Co-authored-by: Kyle Sayers <[email protected]>
  • Loading branch information
dsikka and kylesayrs authored Oct 3, 2024
1 parent 4da7887 commit 9afd956
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/compressed_tensors/quantization/lifecycle/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ def _initialize_scale_zero_point_observer(
# (output_channels, 1)
expected_shape = (weight_shape[0], 1)
elif quantization_args.strategy == QuantizationStrategy.GROUP:
num_groups = weight_shape[1] // quantization_args.group_size
expected_shape = (
weight_shape[0],
weight_shape[1] // quantization_args.group_size,
max(num_groups, 1)
)

scale_dtype = module.weight.dtype
Expand Down

0 comments on commit 9afd956

Please sign in to comment.