Skip to content

Commit 99fe7c7

Browse files
committed
fix: Minor changes to SAWB perCh
Signed-off-by: Brandon Groth <[email protected]>
1 parent 389a427 commit 99fe7c7

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

fms_mo/quant_refactor/sawb_new.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
PerChannelSTESAWB,
3232
PerChannelSTESAWB_PTnative,
3333
)
34-
from fms_mo.quant_refactor.linear_utils import linear_dequantize, linear_quantize
34+
# from fms_mo.quant_refactor.linear_utils import linear_dequantize, linear_quantize
3535
from fms_mo.quant_refactor.sawb_utils import sawb_params, sawb_params_code
3636

3737
clip_valn_default = torch.tensor(-8.0)

tests/quantizers/test_sawb.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ def test_sawb_symmetric_perCh(
369369
tensor: torch.FloatTensor,
370370
quantizer_symmetric_perCh: dict,
371371
base_options: dict,
372-
other_options: dict, # only 1 STE for this case right now
373372
):
374373
"""
375374
Test SAWB w/ symmetric tensors for per channel
@@ -378,7 +377,6 @@ def test_sawb_symmetric_perCh(
378377
tensor (torch.FloatTensor): Tensor to quantize.
379378
quantizer_symmetric_perCh (dict): Symmetric quantizer settings for per channel.
380379
base_options (dict): Base options for quantization.
381-
other_options (dict): Other Options for quantization.
382380
"""
383381

384382
Nch = tensor.shape[0]
@@ -401,11 +399,12 @@ def test_sawb_symmetric_perCh(
401399
# Set base quantizer and SAWB options ; save nativePT
402400
native_pt = base_options["nativePT"]
403401
base_options["nativePT"] = False # Not supported for SAWB
402+
403+
# Create only set of other options for SAWB perCh STEs
404+
other_options = {"clipSTE": True, "align_zero": True, "use16bins": False}
405+
404406
set_base_options(sawb_quantizer_symmetric_perCh, torch_quantizer_symmetric_perCh, base_options)
405407
set_per_channel(tensor, sawb_quantizer_symmetric_perCh, torch_quantizer_symmetric_perCh)
406-
# set_other_options_new(
407-
# tensor, sawb_quantizer_symmetric_perCh, torch_quantizer_symmetric_perCh, other_options
408-
# )
409408

410409
# Create quantized tensors from FMS Model Optimizer + torch
411410
qtensor_fms_mo = sawb_quantizer_symmetric_perCh(tensor).detach()

0 commit comments

Comments
 (0)