Skip to content

Commit 48be9ce

Browse files
authored
ci: Fix OpenVINO models (#7904)
1 parent 997bb70 commit 48be9ce

8 files changed

+37
-51
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved.
1+
Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
22

33
Redistribution and use in source and binary forms, with or without
44
modification, are permitted provided that the following conditions

qa/common/gen_common.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# Copyright 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# Redistribution and use in source and binary forms, with or without
44
# modification, are permitted provided that the following conditions
@@ -24,6 +24,7 @@
2424
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2525
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

27+
import os
2728
from typing import List
2829

2930
# Common utilities for model generation scripts
@@ -168,3 +169,20 @@ def np_to_torch_dtype(np_dtype):
168169
elif np_dtype == np_dtype_string:
169170
return List[str]
170171
return None
172+
173+
174+
def openvino_save_model(model_version_dir, model):
175+
import openvino as ov
176+
177+
# W/A for error moving to OpenVINO new APIs "Attempt to get a name for a Tensor without names".
178+
# For more details, check https://github.com/triton-inference-server/openvino_backend/issues/89
179+
if len(model.outputs) == 0:
180+
model.outputs[0].get_tensor().set_names({"OUTPUT"})
181+
else:
182+
for idx, out in enumerate(model.outputs):
183+
out.get_tensor().set_names({f"OUTPUT{idx}"})
184+
185+
os.makedirs(model_version_dir, exist_ok=True)
186+
ov.serialize(
187+
model, model_version_dir + "/model.xml", model_version_dir + "/model.bin"
188+
)

qa/common/gen_qa_dyna_sequence_models.py

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# Copyright 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# Copyright 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
66
# modification, are permitted provided that the following conditions
@@ -36,6 +36,7 @@
3636
np_to_tf_dtype,
3737
np_to_torch_dtype,
3838
np_to_trt_dtype,
39+
openvino_save_model,
3940
)
4041

4142
FLAGS = None
@@ -1304,15 +1305,7 @@ def create_openvino_modelfile(models_dir, model_version, max_batch, dtype, shape
13041305
op0 = ov.opset1.multiply(tmp, ready, name="OUTPUT")
13051306

13061307
model = ov.Model([op0], [in0, start, end, ready, corrid], model_name)
1307-
1308-
try:
1309-
os.makedirs(model_version_dir)
1310-
except OSError as ex:
1311-
pass # ignore existing dir
1312-
1313-
ov.serialize(
1314-
model, model_version_dir + "/model.xml", model_version_dir + "/model.bin"
1315-
)
1308+
openvino_save_model(model_version_dir, model)
13161309

13171310

13181311
def create_openvino_modelconfig(models_dir, model_version, max_batch, dtype, shape):

qa/common/gen_qa_identity_models.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# Copyright 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# Copyright 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
66
# modification, are permitted provided that the following conditions
@@ -37,6 +37,7 @@
3737
np_to_onnx_dtype,
3838
np_to_tf_dtype,
3939
np_to_trt_dtype,
40+
openvino_save_model,
4041
)
4142

4243
FLAGS = None
@@ -581,12 +582,7 @@ def create_openvino_modelfile(
581582
)
582583

583584
model = ov.Model(openvino_outputs, openvino_inputs, model_name)
584-
585-
os.makedirs(model_version_dir, exist_ok=True)
586-
587-
ov.serialize(
588-
model, model_version_dir + "/model.xml", model_version_dir + "/model.bin"
589-
)
585+
openvino_save_model(model_version_dir, model)
590586

591587

592588
def create_openvino_modelconfig(

qa/common/gen_qa_model_repository

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright 2018-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# Copyright 2018-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
#
44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions
@@ -55,7 +55,7 @@ ONNX_VERSION=1.16.1
5555
ONNX_OPSET=0
5656

5757
# OPENVINO version
58-
OPENVINO_VERSION=2024.4.0
58+
OPENVINO_VERSION=2024.5.0
5959

6060
UBUNTU_IMAGE=${UBUNTU_IMAGE:=ubuntu:22.04}
6161
PYTORCH_IMAGE=${PYTORCH_IMAGE:=nvcr.io/nvidia/pytorch:$TRITON_VERSION-py3}

qa/common/gen_qa_models.py

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# Copyright 2018-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# Copyright 2018-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
66
# modification, are permitted provided that the following conditions
@@ -39,6 +39,7 @@
3939
np_to_tf_dtype,
4040
np_to_torch_dtype,
4141
np_to_trt_dtype,
42+
openvino_save_model,
4243
)
4344

4445
FLAGS = None
@@ -1826,15 +1827,7 @@ def create_openvino_modelfile(
18261827
op1 = ov.opset1.convert(result1, destination_type=output1_dtype, name="OUTPUT1")
18271828

18281829
model = ov.Model([op0, op1], [in0, in1], model_name)
1829-
1830-
try:
1831-
os.makedirs(model_version_dir)
1832-
except OSError as ex:
1833-
pass # ignore existing dir
1834-
1835-
ov.serialize(
1836-
model, model_version_dir + "/model.xml", model_version_dir + "/model.bin"
1837-
)
1830+
openvino_save_model(model_version_dir, model)
18381831

18391832

18401833
def create_openvino_modelconfig(

qa/common/gen_qa_reshape_models.py

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# Copyright 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# Copyright 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
66
# modification, are permitted provided that the following conditions
@@ -38,6 +38,7 @@
3838
np_to_tf_dtype,
3939
np_to_torch_dtype,
4040
np_to_trt_dtype,
41+
openvino_save_model,
4142
)
4243

4344
FLAGS = None
@@ -949,15 +950,7 @@ def create_openvino_modelfile(
949950
)
950951

951952
model = ov.Model(openvino_outputs, openvino_inputs, model_name)
952-
953-
try:
954-
os.makedirs(model_version_dir)
955-
except OSError as ex:
956-
pass # ignore existing dir
957-
958-
ov.serialize(
959-
model, model_version_dir + "/model.xml", model_version_dir + "/model.bin"
960-
)
953+
openvino_save_model(model_version_dir, model)
961954

962955

963956
def create_openvino_modelconfig(

qa/common/gen_qa_sequence_models.py

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# Copyright 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# Copyright 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
66
# modification, are permitted provided that the following conditions
@@ -37,6 +37,7 @@
3737
np_to_tf_dtype,
3838
np_to_torch_dtype,
3939
np_to_trt_dtype,
40+
openvino_save_model,
4041
)
4142

4243
FLAGS = None
@@ -1153,15 +1154,7 @@ def create_openvino_modelfile(models_dir, model_version, max_batch, dtype, shape
11531154
op0 = ov.opset1.multiply(tmp, ready, name="OUTPUT")
11541155

11551156
model = ov.Model([op0], [in0, start, ready], model_name)
1156-
1157-
try:
1158-
os.makedirs(model_version_dir)
1159-
except OSError as ex:
1160-
pass # ignore existing dir
1161-
1162-
ov.serialize(
1163-
model, model_version_dir + "/model.xml", model_version_dir + "/model.bin"
1164-
)
1157+
openvino_save_model(model_version_dir, model)
11651158

11661159

11671160
def create_openvino_modelconfig(models_dir, model_version, max_batch, dtype, shape):

0 commit comments

Comments
 (0)