Skip to content

Commit ee20c81

Browse files
ignore 3 assignment errs and 1 call-overload err
Signed-off-by: chichun-charlie-liu <[email protected]>
1 parent f2e3994 commit ee20c81

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fms_mo/quant/quantizers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3932,25 +3932,25 @@ def init_quantization_scale(self, x: torch.Tensor, channel_wise: bool = False):
39323932
else:
39333933
if "max" in self.scale_method:
39343934
x_min = min(x.min().item(), 0)
3935-
x_max = max(x.max().item(), 0)
3935+
x_max = max(x.max().item(), 0) # type: ignore[assignment]
39363936
if "scale" in self.scale_method:
39373937
x_min = x_min * (self.n_bits + 2) / 8
39383938
x_max = x_max * (self.n_bits + 2) / 8
39393939

3940-
x_absmax = max(abs(x_min), x_max)
3940+
x_absmax = max(abs(x_min), x_max) # type: ignore [call-overload]
39413941
if self.sym:
39423942
x_min, x_max = -x_absmax if x_min < 0 else 0, x_absmax
39433943

39443944
delta = float(x_max - x_min) / (self.n_levels - 1)
39453945
if delta < 1e-8:
39463946
logger.info(f"Quantization range close to zero: [{x_min}, {x_max}]")
3947-
delta = 1e-8
3947+
delta = 1e-8 # type: ignore[assignment]
39483948

39493949
zero_point = round(-x_min / delta)
39503950

39513951
elif self.scale_method == "mse":
39523952
x_max = x.max()
3953-
x_min = x.min()
3953+
x_min = x.min() # type: ignore[assignment]
39543954
best_score = 1e10
39553955
for i in range(80):
39563956
new_max = x_max * (1.0 - (i * 0.01))

0 commit comments

Comments
 (0)