File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 build_executorch_binary ,
2323 get_backend_type ,
2424 make_output_dir ,
25+ make_quantizer ,
2526 parse_skip_delegation_node ,
2627 setup_common_args_and_variables ,
2728 SimpleADB ,
@@ -90,9 +91,12 @@ def main(args):
9091
9192 pte_filename = "mobilevit_v2_qnn"
9293 backend = get_backend_type (args .backend )
93- quant_dtype = {
94+ quantizer = {
9495 QnnExecuTorchBackendType .kGpuBackend : None ,
95- QnnExecuTorchBackendType .kHtpBackend : QuantDtype .use_16a8w ,
96+ QnnExecuTorchBackendType .kHtpBackend : make_quantizer (
97+ quant_dtype = QuantDtype .use_16a8w ,
98+ eps = 2 ** - 10 ,
99+ ),
96100 }[backend ]
97101 build_executorch_binary (
98102 module ,
@@ -102,7 +106,7 @@ def main(args):
102106 inputs ,
103107 skip_node_id_set = skip_node_id_set ,
104108 skip_node_op_set = skip_node_op_set ,
105- quant_dtype = quant_dtype ,
109+ custom_quantizer = quantizer ,
106110 backend = backend ,
107111 shared_buffer = args .shared_buffer ,
108112 online_prepare = args .online_prepare ,
Original file line number Diff line number Diff line change @@ -135,7 +135,6 @@ def __iter__(self):
135135
136136def quantize (args ):
137137 logger = get_logger ()
138-
139138 # get corresponding QnnQuantizer
140139 try :
141140 quant_dtype = getattr (QuantDtype , args .config )
@@ -147,6 +146,7 @@ def quantize(args):
147146 act_observer = act_observer ,
148147 backend = get_backend_type (args .backend ),
149148 soc_model = args .model ,
149+ eps = args .eps ,
150150 )
151151 except Exception :
152152 logger .error (
@@ -450,6 +450,12 @@ def main():
450450 default = "htp" ,
451451 help = "Backend to be deployed ('htp'/'gpu' are currently supported)." ,
452452 )
453+ sub_quantize .add_argument (
454+ "--eps" ,
455+ help = "EPS value for quantizer. Accepts floating‑point literal. E.g., 0.0009765625." ,
456+ type = float ,
457+ default = None ,
458+ )
453459 sub_quantize .set_defaults (callback = quantize )
454460
455461 sub_compile = subparsers .add_parser (
Original file line number Diff line number Diff line change @@ -371,9 +371,9 @@ def make_quantizer(
371371 act_symmetric = False ,
372372 is_qat = False ,
373373 submodule_qconfig_list : Optional [List [Tuple [Callable , ModuleQConfig ]]] = None ,
374- eps = None ,
375374 backend = QnnExecuTorchBackendType .kHtpBackend ,
376375 soc_model = "SM8750" ,
376+ eps = None ,
377377):
378378 quantizer = QnnQuantizer (backend = backend , soc_model = getattr (QcomChipset , soc_model ))
379379 quantizer .add_custom_quant_annotations (custom_annotations )
You can’t perform that action at this time.
0 commit comments