Skip to content

Commit 95b5af3

Browse files
committed
minor cleanup
Signed-off-by: Suguna Velury <178320438+sugunav14@users.noreply.github.com>
1 parent d7e311f commit 95b5af3

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

examples/llm_ptq/hf_ptq.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,14 +1067,10 @@ def quantize_main(
10671067
"Plain quantization supports only one quantization format."
10681068
)
10691069

1070-
if args.qformat in QUANT_CFG_CHOICES:
1071-
quant_cfg = QUANT_CFG_CHOICES[args.qformat]
1072-
elif hasattr(mtq, args.qformat):
1073-
quant_cfg = getattr(mtq, args.qformat)
1074-
else:
1075-
raise AssertionError(
1076-
f"Unsupported quantization format: {args.qformat}, choices are: {list(QUANT_CFG_CHOICES.keys())}"
1077-
)
1070+
assert args.qformat in QUANT_CFG_CHOICES, (
1071+
f"Unsupported quantization format: {args.qformat}, choices are: {list(QUANT_CFG_CHOICES.keys())}"
1072+
)
1073+
quant_cfg = QUANT_CFG_CHOICES[args.qformat]
10781074

10791075
quant_cfg = build_quant_cfg(
10801076
args.qformat,
@@ -1109,7 +1105,7 @@ def quantize_main(
11091105
quant_cfg = copy.deepcopy(quant_cfg)
11101106
_set_kv_cache_constant_amax(quant_cfg["quant_cfg"])
11111107

1112-
if args.qformat in QUANT_CFG_CHOICES or hasattr(mtq, args.qformat):
1108+
if args.qformat in QUANT_CFG_CHOICES:
11131109
mono_quantize(
11141110
args,
11151111
quant_cfg,

0 commit comments

Comments
 (0)