@@ -112,7 +112,7 @@ def main():
112112 args = parse_args ()
113113 # verify args
114114 if (
115- len ( [fm in ["hailo" , "tflite" , "vela" ] for fm in args .format ])
115+ True in [fm in ["hailo" , "tflite" , "vela" ] for fm in args .format ]
116116 and args .image_path is None
117117 ):
118118 raise ValueError ("image_path is required for hailo/tflite/vela format" )
@@ -253,7 +253,7 @@ def export_savemodel(onnx_file, calibration_data=None):
253253 print ("The pb model format was exported successfully" )
254254 except Exception as e :
255255 print ("Export of pb model failed, export interrupted" )
256- return
256+ raise RuntimeError ( e )
257257
258258 return osp .dirname (onnx_file )
259259
@@ -295,6 +295,7 @@ def export_onnx(model, args):
295295 onnx .save (onnx_model , f )
296296 except Exception as e :
297297 print (f"Simplify failure: { e } " )
298+ raise RuntimeError (e )
298299
299300 return f
300301
@@ -377,10 +378,6 @@ def representative_dataset():
377378 converter .representative_dataset = representative_dataset
378379 converter ._experimental_disable_per_channel = False
379380
380- # converter._experimental_disable_fuse_mul_and_fc
381- # converter.experimental_new_dynamic_range_quantizer=True
382- # converter.experimental_use_stablehlo_quantizer=True
383-
384381 tflite_quant_model = converter .convert ()
385382 with open (tflite_path , "wb" ) as f :
386383 f .write (tflite_quant_model )
@@ -404,7 +401,7 @@ def export_vela(tflite_path: str, verify=False):
404401 if not state :
405402 print ("Export of vela model succeeded" )
406403 else :
407- print ( "Exporting vela model failed" )
404+ raise RuntimeError ( "Export of vela model failed" )
408405
409406 if verify :
410407 verify_tflite (tflite_path )
0 commit comments