Skip to content

Commit 5024afb

Browse files
committed
Add ONNX model format testcase in MLServer test-suite
Signed-off-by: Snomaan6846 <syedali@redhat.com> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
1 parent a811bea commit 5024afb

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"id": "onnx",
3+
"model_name": "onnx",
4+
"model_version": "v1.0.0",
5+
"outputs": [
6+
{
7+
"data": [
8+
-137.39060974121094
9+
],
10+
"datatype": "FP32",
11+
"name": "predict",
12+
"parameters": {
13+
"content_type": "np"
14+
},
15+
"shape": [
16+
1,
17+
1
18+
]
19+
}
20+
],
21+
"parameters": {}
22+
}

tests/model_serving/model_runtime/mlserver/basic_model_deployment/test_mlserver_basic_model_deployment.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@
5151
deployment_type=RAW_DEPLOYMENT_TYPE,
5252
),
5353
),
54+
pytest.param(
55+
get_model_namespace_dict(
56+
model_format_name=ModelFormat.ONNX,
57+
deployment_type=RAW_DEPLOYMENT_TYPE,
58+
),
59+
get_deployment_config_dict(model_format_name=ModelFormat.ONNX, deployment_type=RAW_DEPLOYMENT_TYPE),
60+
get_model_storage_uri_dict(model_format_name=ModelFormat.ONNX),
61+
get_deployment_config_dict(model_format_name=ModelFormat.ONNX, deployment_type=RAW_DEPLOYMENT_TYPE),
62+
ModelFormat.ONNX,
63+
id=get_test_case_id(
64+
model_format_name=ModelFormat.ONNX,
65+
deployment_type=RAW_DEPLOYMENT_TYPE,
66+
),
67+
),
5468
pytest.param(
5569
get_model_namespace_dict(
5670
model_format_name=ModelFormat.SKLEARN,

tests/model_serving/model_runtime/mlserver/constant.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,31 @@ class OutputType:
7777
],
7878
}
7979

80+
ONNX_REST_INPUT_QUERY = {
81+
"id": "onnx",
82+
"inputs": [
83+
{
84+
"name": "input",
85+
"shape": [1, 4],
86+
"datatype": "FP32",
87+
"data": [[-1.44964521969853, -0.6500239344068982, -0.08343796979036086, -1.496529255090079]],
88+
}
89+
],
90+
}
91+
8092
MODEL_CONFIGS: dict[str, dict[str, Any]] = {
8193
ModelFormat.LIGHTGBM: {
8294
"model_name": ModelFormat.LIGHTGBM,
8395
"model_version": "v0.1.0",
8496
"rest_query": LIGHTGBM_REST_INPUT_QUERY,
8597
"output_type": OutputType.DETERMINISTIC,
8698
},
99+
ModelFormat.ONNX: {
100+
"model_name": ModelFormat.ONNX,
101+
"model_version": "v1.0.0",
102+
"rest_query": ONNX_REST_INPUT_QUERY,
103+
"output_type": OutputType.DETERMINISTIC,
104+
},
87105
ModelFormat.SKLEARN: {
88106
"model_name": ModelFormat.SKLEARN,
89107
"model_version": "v1.0.0",

0 commit comments

Comments
 (0)