Skip to content

Commit d0516d3

Browse files
committed
fix
1 parent 37c54de commit d0516d3

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

onnx_diagnostic/_command_lines_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
)

onnx_diagnostic/helpers/optim_helper.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from typing import Optional, Union
2+
import pprint
23
import 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

0 commit comments

Comments
 (0)