mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-21 21:52:11 +00:00
Changed command line argpasrse to process '--symmetric [True|False]'. (#19577)
### Description
<!-- Describe your changes. -->
Accept the command line option --symmetric and its optional value
correctly. If the optional value matches uncased to 'True' then set
symmetric to True else set symmetric to False. Asymmetric quantization
will generate zero_point input.
```
usage: matmul_4bits_quantizer.py [-h] --input_model INPUT_MODEL --output_model OUTPUT_MODEL [--block_size BLOCK_SIZE] [--symmetric [{True,False}]] [--accuracy_level ACCURACY_LEVEL] [-v]
[--nodes_to_exclude NODES_TO_EXCLUDE [NODES_TO_EXCLUDE ...]]
```
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
This commit is contained in:
parent
124bde985a
commit
8092a89688
1 changed files with 8 additions and 1 deletions
|
|
@ -349,6 +349,10 @@ class MatMul4BitsQuantizer:
|
|||
self.int4_quant_algo()
|
||||
|
||||
|
||||
def ort_convert_str_to_bool(value):
|
||||
return value.lower() in ("true", "1")
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="""Blockwise int4 quantization for MatMul 2D weight matrices.
|
||||
|
|
@ -366,7 +370,10 @@ set of 4b integers with a scaling factor and an optional offset.
|
|||
"--symmetric",
|
||||
required=False,
|
||||
default=True,
|
||||
type=bool,
|
||||
const=True,
|
||||
nargs="?",
|
||||
type=ort_convert_str_to_bool,
|
||||
choices=[True, False],
|
||||
help="Indicate whether to quantize the model symmetrically",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
|
|
|||
Loading…
Reference in a new issue