Skip to content

Commit

Permalink
docs: adding curl command and seldon-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
abhimanyu003 committed Jan 22, 2025
1 parent 59e5e53 commit 4dd103c
Showing 1 changed file with 219 additions and 4 deletions.
223 changes: 219 additions & 4 deletions docs-gb/examples/local-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Wait for the model to be ready

{% tab title="kubectl" %}
```bash
kubectl get model iris -n seldon-mesh -o json | jq -r '.status.conditions[] | select(.message == "ModelAvailable") | .status'
kubectl get model iris -n ${NAMESPACE} -o json | jq -r '.status.conditions[] | select(.message == "ModelAvailable") | .status'
```
```bash
True
Expand Down Expand Up @@ -246,7 +246,7 @@ Wait for the model to be ready.

{% tab title="kubectl" %}
```bash
kubectl get model tfsimple1 -n seldon-mesh -o json | jq -r '.status.conditions[] | select(.message == "ModelAvailable") | .status'
kubectl get model tfsimple1 -n ${NAMESPACE} -o json | jq -r '.status.conditions[] | select(.message == "ModelAvailable") | .status'
```
```bash
True
Expand All @@ -266,6 +266,64 @@ seldon model status tfsimple1 -w ModelAvailable | jq -M .

Get model metadata


{% tabs %}

{% tab title="curl" %}

```bash
curl --location 'http://${MESH_IP}:9000/v2/models/tfsimple1'
```

```json
{
"name": "tfsimple1_1",
"versions": [
"1"
],
"platform": "tensorflow_graphdef",
"inputs": [
{
"name": "INPUT0",
"datatype": "INT32",
"shape": [
-1,
16
]
},
{
"name": "INPUT1",
"datatype": "INT32",
"shape": [
-1,
16
]
}
],
"outputs": [
{
"name": "OUTPUT0",
"datatype": "INT32",
"shape": [
-1,
16
]
},
{
"name": "OUTPUT1",
"datatype": "INT32",
"shape": [
-1,
16
]
}
]
}

```
{% endtab %}

{% tab title="seldon-cli" %}
```bash
seldon model metadata tfsimple1
```
Expand Down Expand Up @@ -316,9 +374,89 @@ seldon model metadata tfsimple1
}

```
{% endtab %}

{% endtabs %}


Do a REST inference call.



{% tabs %}

{% tab title="curl" %}
```bash
curl --location 'http://${MESH_IP}:9000/v2/models/iris/infer' \
--header 'Content-Type: application/json' \
--data '{"inputs":[{"name":"INPUT0","data":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],"datatype":"INT32","shape":[1,16]},{"name":"INPUT1","data":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],"datatype":"INT32","shape":[1,16]}]}' | jq -M .
```

```json
{
"model_name": "tfsimple1_1",
"model_version": "1",
"outputs": [
{
"name": "OUTPUT0",
"datatype": "INT32",
"shape": [
1,
16
],
"data": [
2,
4,
6,
8,
10,
12,
14,
16,
18,
20,
22,
24,
26,
28,
30,
32
]
},
{
"name": "OUTPUT1",
"datatype": "INT32",
"shape": [
1,
16
],
"data": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

```
{% endtab %}

{% tab title="seldon-cli" %}

```bash
seldon model infer tfsimple1 \
'{"inputs":[{"name":"INPUT0","data":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],"datatype":"INT32","shape":[1,16]},{"name":"INPUT1","data":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],"datatype":"INT32","shape":[1,16]}]}' | jq -M .
Expand Down Expand Up @@ -385,6 +523,11 @@ seldon model infer tfsimple1 \
}

```
{% endtab %}

{% endtabs %}



Do a gRPC inference call

Expand Down Expand Up @@ -461,9 +604,24 @@ seldon model infer tfsimple1 --inference-mode grpc \

Unload the model


{% tabs %}

{% tab title="kubectl" %}
```bash
kubectl delete model tfsimple1
```
{% endtab %}

{% tab title="seldon-cli" %}
```bash
seldon model unload tfsimple1
```
{% endtab %}

{% endtabs %}



### Experiment

Expand Down Expand Up @@ -503,19 +661,54 @@ spec:

Load both models.


{% tabs %}

{% tab title="kubectl" %}
```bash
kubectl apply -f ./models/sklearn1.yaml
kubectl apply -f ./models/sklearn2.yaml
```

```bash
model.mlops.seldon.io/sklearn1 created
model.mlops.seldon.io/sklearn2 created
```
{% endtab %}

{% tab title="seldon-cli" %}
```bash
seldon model load -f ./models/sklearn1.yaml
seldon model load -f ./models/sklearn2.yaml
```

```json
{}
{}

```
{% endtab %}

{% endtabs %}



Wait for both models to be ready.


{% tabs %}

{% tab title="kubectl" %}
```
kubectl get model iris -n seldon-mesh -o json | jq -r '.status.conditions[] | select(.message == "ModelAvailable") | .status'
kubectl get model iris2 -n seldon-mesh -o json | jq -r '.status.conditions[] | select(.message == "ModelAvailable") | .status'
```

```
True
True
```
{% endtab %}

{% tab title="seldon-cli" %}
```bash
seldon model status iris | jq -M .
seldon model status iris2 | jq -M .
Expand Down Expand Up @@ -596,6 +789,12 @@ seldon model status iris2 | jq -M .
}

```
{% endtab %}

{% endtabs %}




Create an experiment that modifies the iris model to add a second model splitting traffic 50/50 between the two.

Expand Down Expand Up @@ -730,7 +929,23 @@ Success: map[:iris_1::100]

Unload both models.



{% tabs %}

{% tab title="kubectl" %}
```bash
kubectl delete model iris
kubectl delete model iris2
```
{% endtab %}

{% tab title="seldon-cli" %}
```bash
seldon model unload iris
seldon model unload iris2
```
{% endtab %}

{% endtabs %}

0 comments on commit 4dd103c

Please sign in to comment.