Skip to content

Commit 3ce12f7

Browse files
Update src/llmcompressor/modifiers/awq/base.py
Co-authored-by: Brian Dellabetta <[email protected]> Signed-off-by: LeiZhang <[email protected]>
1 parent a75ba31 commit 3ce12f7

File tree

1 file changed

+6
-5
lines changed
  • src/llmcompressor/modifiers/awq

1 file changed

+6
-5
lines changed

src/llmcompressor/modifiers/awq/base.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,12 @@ def _apply_smoothing(self, model: Module) -> None:
464464
# The weights are reshaped to be organised by quantization group
465465
if self._group_size > 0:
466466
weight = weight.view(-1, self._group_size)
467-
# Calculates the relative magnitude of the weights within
468-
# each of the quantization groups, and rescales each group
469-
# individually so that each group has weights on a 0-1 scale.
470-
weight.abs_()
471-
weight.div_(weight.amax(dim=1, keepdim=True) + 1e-6)
467+
# Calculates the relative magnitude of the weights within
468+
# each of the quantization groups, and rescales each group
469+
# individually so that each group has weights on a 0-1 scale.
470+
weight.abs_()
471+
weight.div_(weight.amax(dim=1, keepdim=True) + 1e-6)
472+
if self._group_size >0:
472473
# Resizes the rescaled weight matrix back up to
473474
# its original dimensions
474475
weight = weight.view(org_shape)

0 commit comments

Comments
 (0)