Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOGS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Change Logs
0.4.0
+++++

* :pr:`50`: add support for onnxruntime fusion
* :pr:`48`: add support for EncoderDecoderCache, test with openai/whisper-tiny
* :pr:`45`: improve change_dynamic_dimension to fix some dimensions

Expand Down
6 changes: 6 additions & 0 deletions _unittests/ut_torch_models/test_test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
get_inputs_for_task,
validate_model,
filter_inputs,
run_ort_fusion,
)
from onnx_diagnostic.torch_models.hghub.model_inputs import get_get_inputs_function_for_tasks

Expand Down Expand Up @@ -69,6 +70,11 @@ def test_validate_model_onnx(self):
self.assertIsInstance(summary, dict)
self.assertIsInstance(data, dict)
self.assertLess(summary["disc_onnx_ort_run_abs"], 1e-4)
onnx_filename = data["onnx_filename"]
output_path = f"{onnx_filename}.ortopt.onnx"
run_ort_fusion(
onnx_filename, output_path, num_attention_heads=2, hidden_size=192, verbose=10
)

def test_filter_inputs(self):
inputs, ds = {"a": 1, "b": 2}, {"a": 20, "b": 30}
Expand Down
7 changes: 7 additions & 0 deletions onnx_diagnostic/_command_lines_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ def get_parser_validate() -> ArgumentParser:
help="drops the following inputs names, it should be a list "
"with comma separated values",
)
parser.add_argument(
"--ortfusiontype",
required=False,
help="applies onnxruntime fusion, this parameter should contain the "
"model type or multiple values separated by |",
)
parser.add_argument("-v", "--verbose", default=0, type=int, help="verbosity")
parser.add_argument("--dtype", help="changes dtype if necessary")
parser.add_argument("--device", help="changes the device if necessary")
Expand Down Expand Up @@ -338,6 +344,7 @@ def _cmd_validate(argv: List[Any]):
exporter=args.export,
dump_folder=args.dump_folder,
drop_inputs=None if not args.drop else args.drop.split(","),
ortfusiontype=args.ortfusiontype,
)
print("")
print("-- summary --")
Expand Down
Loading
Loading