@@ -181,12 +181,10 @@ def __init__(
181181 axis : int | tuple | list | None = None ,
182182 quant_func : Callable | None = None ,
183183 error_func : Callable | None = None ,
184- fp8_scale_sweep_stride : int = 1 ,
185184 ):
186185 """Initialize NVFP4 MSE calibrator with per-block and global amax."""
187186 super ().__init__ (amax = amax , axis = axis , quant_func = quant_func , error_func = error_func )
188187 self ._global_amax = global_amax
189- self ._fp8_scale_sweep_stride = max (1 , fp8_scale_sweep_stride or 1 )
190188
191189 def _compute_candidate_amax (self , candidates : torch .Tensor ) -> torch .Tensor :
192190 if candidates .ndim != 0 : # Called during final compute amax
@@ -199,9 +197,4 @@ def _generate_candidates(self, device: torch.device) -> torch.Tensor:
199197 fp8_values = uint8_values .view (torch .float8_e4m3fn ).float ()
200198 valid_mask = torch .isfinite (fp8_values ) & (fp8_values > 0 )
201199 fp8_values = fp8_values [valid_mask ]
202- if self ._fp8_scale_sweep_stride > 1 :
203- candidates = fp8_values [:: self ._fp8_scale_sweep_stride ]
204- if candidates [- 1 ] != fp8_values [- 1 ]:
205- candidates = torch .cat ([candidates , fp8_values [- 1 :]])
206- fp8_values = candidates
207200 return fp8_values / 448.0
0 commit comments