File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments