Artifact versions
Seldon V2 Kubernetes Multi Version Artifact Examples
We have a Triton model that has two version folders
Model 1 adds 10 to input, Model 2 multiples by 10 the input. The structure of the artifact repo is shown below:
config.pbtxt
1/model.py <add 10>
2/model.py <mul 10>
Before you begin
Ensure that you have installed Seldon Core 2 in the namespace
seldon-mesh.Ensure that you are performing these steps in the directory where you have downloaded the samples.
Get the IP address of the Seldon Core 2 instance running with Istio:
ISTIO_INGRESS=$(kubectl get svc seldon-mesh -n seldon-mesh -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "Seldon Core 2: http://$ISTIO_INGRESS"Model
cat ./models/multi-version-1.yamlapiVersion: mlops.seldon.io/v1alpha1
kind: Model
metadata:
name: math
spec:
storageUri: "gs://seldon-models/scv2/samples/triton_23-03/multi-version"
artifactVersion: 1
requirements:
- triton
- python
kubectl apply -f ./models/multi-version-1.yaml -n seldon-meshmodel.mlops.seldon.io/math created
kubectl wait --for condition=ready --timeout=300s model --all -n seldon-meshmodel.mlops.seldon.io/math condition met
curl -k http://<INGRESS_IP>:80/v2/models/math/infer \
-H "Host: seldon-mesh.inference.seldon" \
-H "Content-Type: application/json" \
-H "Seldon-Model: math" \
-d '{
"model_name": "math",
"inputs": [
{
"name": "INPUT",
"datatype": "FP32",
"shape": [4],
"data": [1, 2, 3, 4]
}
]
}' | jq{
"model_name": "math_1",
"model_version": "1",
"outputs": [
{
"name": "OUTPUT",
"datatype": "FP32",
"shape": [
4
],
"data": [
11.0,
12.0,
13.0,
14.0
]
}
]
}
seldon model infer math --inference-mode grpc --inference-host <INGRESS_IP>:80 \
'{"model_name":"math","inputs":[{"name":"INPUT","contents":{"fp32_contents":[1,2,3,4]},"datatype":"FP32","shape":[4]}]}' | jq -M .{
"modelName": "math_1",
"modelVersion": "1",
"outputs": [
{
"name": "OUTPUT",
"datatype": "FP32",
"shape": [
"4"
],
"contents": {
"fp32Contents": [
11,
12,
13,
14
]
}
}
]
}
cat ./models/multi-version-2.yamlapiVersion: mlops.seldon.io/v1alpha1
kind: Model
metadata:
name: math
spec:
storageUri: "gs://seldon-models/scv2/samples/triton_23-03/multi-version"
artifactVersion: 2
requirements:
- triton
- python
kubectl apply -f ./models/multi-version-2.yaml -n seldon-meshmodel.mlops.seldon.io/math configured
kubectl wait --for condition=ready --timeout=300s model --all -n seldon-meshmodel.mlops.seldon.io/math condition met
curl -k http://<INGRESS_IP>:80/v2/models/math/infer \
-H "Host: seldon-mesh.inference.seldon" \
-H "Content-Type: application/json" \
-H "Seldon-Model: math" \
-d '{
"model_name": "math",
"inputs": [
{
"name": "INPUT",
"datatype": "FP32",
"shape": [4],
"data": [1, 2, 3, 4]
}
]
}' | jq{
"model_name": "math_2",
"model_version": "1",
"outputs": [
{
"name": "OUTPUT",
"datatype": "FP32",
"shape": [
4
],
"data": [
10.0,
20.0,
30.0,
40.0
]
}
]
}
seldon model infer math --inference-mode grpc --inference-host <INGRESS_IP>:80 \
'{"model_name":"math","inputs":[{"name":"INPUT","contents":{"fp32_contents":[1,2,3,4]},"datatype":"FP32","shape":[4]}]}' | jq -M .{
"modelName": "math_2",
"modelVersion": "1",
"outputs": [
{
"name": "OUTPUT",
"datatype": "FP32",
"shape": [
"4"
],
"contents": {
"fp32Contents": [
10,
20,
30,
40
]
}
}
]
}
kubectl delete -f ./models/multi-version-1.yaml -n seldon-meshmodel.mlops.seldon.io "math" deleted
Last updated
Was this helpful?

