File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1674,7 +1674,7 @@ def get_main_parser() -> ArgumentParser:
16741674 sbs - compares an exported program and a onnx model
16751675 stats - produces statistics on a model
16761676 unlighten - restores an onnx model produces by the previous experiment
1677- validate - validate a model (knowning its model id on HuggginFace Hub)
1677+ validate - validate a model (knowing its model id on HuggginFace Hub)
16781678 """
16791679 ),
16801680 )
Original file line number Diff line number Diff line change 11from typing import Optional , Union
2+ import pprint
23import onnx
34
45
@@ -22,7 +23,7 @@ def optimize_model(
2223 :param processor: optimization are done for the processor
2324 :param infer_shapes: infer shapes before optimizing, this might not be
2425 available for all algorithm
25- :param remove_shape_info: rmeove shape information before saving the model
26+ :param remove_shape_info: remove shape information before saving the model
2627 :param verbose: verbosity level
2728 :return: optimized model
2829
@@ -74,7 +75,12 @@ def optimize_model(
7475 if verbose :
7576 print (f"[optimize_model] starts optimizing with { len (pats )} patterns" )
7677 print (f"[optimize_model] model has { len (proto .graph .node )} nodes" )
77- opt_onx = gr .to_onnx (optimize = True )
78+ opt_onx , report = gr .to_onnx (optimize = True , return_optimize_report = True )
79+ if verbose :
80+ print ("[optimize_model] optimization report" )
81+ pprint .print (report )
82+ print ("[optimize_model] done" )
83+
7884 elif algorithm == "slim" :
7985 import onnxslim
8086
You can’t perform that action at this time.
0 commit comments