Skip to content

Commit

Permalink
Qwen nan fix (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
baoyf4244 authored Jun 30, 2024
1 parent c53cc7e commit 35d23db
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 @@ -322,7 +322,7 @@ def _compute_best_scale(

# NOTE: s^-1 * x is fused here, according to paper
if self.duo_scaling:
scales = (x_mean.pow(ratio) / w_mean.pow(1 - ratio)).clamp(min=1e-4)
scales = (x_mean.pow(ratio) / (w_mean.pow(1 - ratio) + 1e-4)).clamp(min=1e-4)
else:
scales = x_mean.pow(ratio).clamp(min=1e-4).view(-1)
scales = scales / (scales.max() * scales.min()).sqrt()
Expand Down

0 comments on commit 35d23db

Please sign in to comment.