Skip to content

Commit

Permalink
Fix (examples/llm): set group_size only for groupwise quantization (#853
Browse files Browse the repository at this point in the history
)
  • Loading branch information
nickfraser authored Feb 15, 2024
1 parent 2369645 commit 0633ea7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/brevitas_examples/common/generative/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,12 @@ def quantize_model(
**{
'bit_width': weight_bit_width,
'narrow_range': False,
'group_size': weight_group_size,
'quantize_zero_point': quantize_weight_zero_point},
**weight_float_format)

# Set the group_size is we're doing groupwise quantization
if weight_quant_granularity == 'per_group':
weight_quant = weight_quant.let(**{'group_size': weight_group_size})
# weight scale is converted to a standalone parameter
# This is done already by default in the per_group quantizer
if weight_quant_granularity != 'per_group':
Expand Down

0 comments on commit 0633ea7

Please sign in to comment.