Skip to content

Commit

Permalink
nan problem of Qwen2-72B quantization (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
baoyf4244 authored Jun 24, 2024
1 parent 6b45c95 commit c53cc7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion awq/quantize/quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def _search_best_scale(
weight = weight.view(-1, self.group_size)
# Calculates the relative magnitude of the weights within each of the quantization groups,
# and rescales each group individually so that each group has weights on a 0-1 scale.
w_scale = weight.abs() / weight.abs().amax(dim=1, keepdim=True)
w_scale = weight.abs() / (weight.abs().amax(dim=1, keepdim=True) + 1e-6)
# Resizes the rescaled weight matrix back up to its original dimensions
w_scale = w_scale.view(org_shape)
# Gets the average rescaled magnitude for each output channel
Expand Down

0 comments on commit c53cc7e

Please sign in to comment.