mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-16 21:00:14 +00:00
Add ms domain during saving onnx model in onnx_model.py (#13978)
Add domain "com.microsoft" during saving model if needed.
This commit is contained in:
parent
cc0a6213e4
commit
6fb54fc607
1 changed files with 10 additions and 0 deletions
|
|
@ -917,6 +917,16 @@ class OnnxModel:
|
|||
):
|
||||
Path(output_path).parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Add ms domain if needed
|
||||
ms_opset = [opset for opset in model.opset_import if opset.domain == "com.microsoft"]
|
||||
# Check whether there is custom op in top level graph (our fusion is on top level right now).
|
||||
# May need to extend to subgraph if our fusion are extended to subgraphs.
|
||||
ms_node = [node for node in model.graph.node if node.domain == "com.microsoft"]
|
||||
if ms_node and not ms_opset:
|
||||
opset = model.opset_import.add()
|
||||
opset.version = 1
|
||||
opset.domain = "com.microsoft"
|
||||
|
||||
if save_as_external_data:
|
||||
# Save model to external data, which is needed for model size > 2GB
|
||||
output_dir = Path(output_path).parent
|
||||
|
|
|
|||
Loading…
Reference in a new issue