Skip to content

Commit

Permalink
Update quant.py (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
gushiqiao authored Sep 27, 2024
1 parent e68484e commit e54df96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llmc/compression/quantization/quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def get_qparams(self, tensor_range, device):
scales = abs_max / qmax
zeros = torch.tensor(0.0)
else:
scales = (max_val - min_val).clamp(min=1e-5) / qmax
scales = (max_val - min_val).clamp(min=1e-5) / (qmax - qmin)
zeros = (qmin - torch.round(min_val / scales)).clamp(qmin, qmax)
if not self.round_zp:
zeros = qmin - (min_val / scales)
Expand Down

0 comments on commit e54df96

Please sign in to comment.