Skip to content

Commit a418e29

Browse files
Update quantizers.py
Signed-off-by: chichun-charlie-liu <[email protected]>
1 parent 5495560 commit a418e29

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fms_mo/quant/quantizers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3945,13 +3945,13 @@ def init_quantization_scale(self, x: torch.Tensor, channel_wise: bool = False):
39453945
delta = float(x_max - x_min) / (self.n_levels - 1)
39463946
if delta < 1e-8:
39473947
logger.info(f"Quantization range close to zero: [{x_min}, {x_max}]")
3948-
delta = 1e-8 # type: ignore[assignment]
3948+
delta = 1e-8
39493949

39503950
zero_point = round(-x_min / delta)
39513951

39523952
elif self.scale_method == "mse":
39533953
x_max = x.max()
3954-
x_min = x.min() # type: ignore[assignment]
3954+
x_min = x.min()
39553955
best_score = 1e10
39563956
for i in range(80):
39573957
new_max = x_max * (1.0 - (i * 0.01))
@@ -5454,7 +5454,7 @@ def custom_fp8_quantizer(
54545454
mantissa_bits: int = 3,
54555455
use_subnormal: bool = False,
54565456
scale_to_max: bool = False,
5457-
) -> torch.Tensor:
5457+
):
54585458
"""Convert tensor tensor to FP8 format, remanining in decimal form (no binary conversion)
54595459
and using some clever manipulation to round each tensor values to the closest representable
54605460
FP8 value.

0 commit comments

Comments
 (0)