From 5cb527e89925edd486c55d9b605cceb48a2bce2f Mon Sep 17 00:00:00 2001 From: Satya Jandhyala Date: Tue, 20 Feb 2024 13:40:23 -0800 Subject: [PATCH] Changed command line argpasrse to process '--symmetric [True|False]'. --- .../python/tools/quantization/matmul_4bits_quantizer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/onnxruntime/python/tools/quantization/matmul_4bits_quantizer.py b/onnxruntime/python/tools/quantization/matmul_4bits_quantizer.py index 3e9f9a6544a71..e3fefab26aaf8 100644 --- a/onnxruntime/python/tools/quantization/matmul_4bits_quantizer.py +++ b/onnxruntime/python/tools/quantization/matmul_4bits_quantizer.py @@ -348,6 +348,8 @@ def process(self): self.int4_quant_algo() +def ort_convert_str_to_bool(value): + return value.lower() in ("true", "1") def parse_args(): parser = argparse.ArgumentParser( @@ -366,7 +368,9 @@ def parse_args(): "--symmetric", required=False, default=True, - type=bool, + const=False, + nargs='?', + type=ort_convert_str_to_bool, help="Indicate whether to quantize the model symmetrically", ) parser.add_argument(