diff --git a/samples/cli-tests.ipynb b/samples/cli-tests.ipynb index d8c30bb923..37c0e36698 100644 --- a/samples/cli-tests.ipynb +++ b/samples/cli-tests.ipynb @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 1, "id": "5fd9e443", "metadata": {}, "outputs": [ @@ -38,7 +38,7 @@ "source": [ "!seldon model load -f ./models/sklearn-iris-gs.yaml\n", "!seldon model load -f ./models/tfsimple1.yaml\n", - "!seldon model load -f ./experiments/sklearn2.yaml\n", + "!seldon model load -f ./models/sklearn2.yaml\n", "!seldon model load -f ./models/cifar10.yaml\n", "!seldon experiment start -f ./experiments/ab-default-model.yaml \n", "!seldon pipeline load -f ./pipelines/cifar10.yaml" @@ -46,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 5, "id": "8e34a00a", "metadata": {}, "outputs": [ @@ -54,12 +54,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "model\t\tstate\t\t\treason\r\n", - "-----\t\t-----\t\t\t------\r\n", - "iris2\t\tModelAvailable\t\t\r\n", - "cifar10\t\tModelProgressing\t\r\n", - "iris\t\tModelAvailable\t\t\r\n", - "tfsimple1\tModelAvailable\t\t\r\n" + "model\t\tstate\t\treason\r\n", + "-----\t\t-----\t\t------\r\n", + "iris\t\tModelAvailable\t\r\n", + "tfsimple1\tModelAvailable\t\r\n", + "iris2\t\tModelAvailable\t\r\n", + "cifar10\t\tModelAvailable\t\r\n" ] } ], @@ -69,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 6, "id": "b7b66dfa", "metadata": {}, "outputs": [ @@ -115,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 7, "id": "8241d2cf", "metadata": {}, "outputs": [ @@ -125,8 +125,8 @@ "text": [ "server\t\treplicas\tmodels\r\n", "------\t\t--------\t------\r\n", - "triton\t\t1\t\t2\r\n", - "mlserver\t1\t\t2\r\n" + "mlserver\t1\t\t2\r\n", + "triton\t\t1\t\t2\r\n" ] } ], @@ -136,7 +136,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 8, "id": "ba809650", "metadata": {}, "outputs": [ @@ -156,7 +156,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 9, "id": "5cc2ca16", "metadata": {}, "outputs": [ @@ -164,9 +164,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "pipeline\r\n", - "--------\r\n", - "cifar10-production\r\n" + "pipeline\t\tstate\t\treason\r\n", + "--------\t\t-----\t\t------\r\n", + "cifar10-production\tPipelineReady\tcreated pipeline\r\n" ] } ], @@ -176,7 +176,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 10, "id": "c486937c", "metadata": {}, "outputs": [ @@ -207,12 +207,12 @@ "id": "5b1925df", "metadata": {}, "source": [ - "### Badly formed model\n" + "### Resource Errors from CLI" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 11, "id": "8b4be911", "metadata": {}, "outputs": [ @@ -224,7 +224,6 @@ "kind: Model\r\n", "metadata:\r\n", " name: iris\r\n", - " namespace: seldon-mesh\r\n", "spec:\r\n", " storagUri: \"gs://seldon-models/mlserver/iris\"\r\n", " requirements:\r\n", @@ -238,7 +237,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 12, "id": "checked-cream", "metadata": {}, "outputs": [ @@ -246,20 +245,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Error: json: unknown field \"storagUri\"\r\n", - "Usage:\r\n", - " seldon model load [flags]\r\n", - "\r\n", - "Flags:\r\n", - " -f, --file-path string model file to load\r\n", - " -h, --help help for load\r\n", - " --scheduler-host string seldon scheduler host (default \"0.0.0.0:9004\")\r\n", - "\r\n", - "Global Flags:\r\n", - " -r, --show-request show request\r\n", - " -o, --show-response show response (default true)\r\n", - "\r\n", - "json: unknown field \"storagUri\"\r\n" + "Error: json: unknown field \"storagUri\"\r\n" ] } ], @@ -269,7 +255,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 13, "id": "cb9f8f62", "metadata": {}, "outputs": [ @@ -281,7 +267,6 @@ "kind: Pipeline\r\n", "metadata:\r\n", " name: tfsimple-conditional\r\n", - " namespace: seldon-mesh\r\n", "spec:\r\n", " steps:\r\n", " - name: conditional\r\n", @@ -309,7 +294,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 14, "id": "f229a839", "metadata": {}, "outputs": [ @@ -317,20 +302,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Error: json: unknown field \"input\"\r\n", - "Usage:\r\n", - " seldon pipeline load [flags]\r\n", - "\r\n", - "Flags:\r\n", - " -f, --file-path string pipeline file to load\r\n", - " -h, --help help for load\r\n", - " --scheduler-host string seldon scheduler host (default \"0.0.0.0:9004\")\r\n", - "\r\n", - "Global Flags:\r\n", - " -r, --show-request show request\r\n", - " -o, --show-response show response (default true)\r\n", - "\r\n", - "json: unknown field \"input\"\r\n" + "Error: json: unknown field \"input\"\r\n" ] } ], @@ -340,7 +312,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 15, "id": "e5988e99", "metadata": {}, "outputs": [ @@ -352,13 +324,12 @@ "kind: Experiment\r\n", "metadata:\r\n", " name: experiment-sample\r\n", - " namespace: seldon-mesh\r\n", "spec:\r\n", - " defaultModel: iris\r\n", + " default: iris\r\n", " candidate:\r\n", - " - modelName: iris\r\n", + " - name: iris\r\n", " weight: 50\r\n", - " - modelName: iris2\r\n", + " - name: iris2\r\n", " weight: 50\r\n" ] } @@ -369,7 +340,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 16, "id": "13058853", "metadata": {}, "outputs": [ @@ -377,20 +348,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Error: json: unknown field \"candidate\"\r\n", - "Usage:\r\n", - " seldon experiment start [flags]\r\n", - "\r\n", - "Flags:\r\n", - " -f, --file-path string model file to load\r\n", - " -h, --help help for start\r\n", - " --scheduler-host string seldon scheduler host (default \"0.0.0.0:9004\")\r\n", - "\r\n", - "Global Flags:\r\n", - " -r, --show-request show request\r\n", - " -o, --show-response show response (default true)\r\n", - "\r\n", - "json: unknown field \"candidate\"\r\n" + "Error: json: unknown field \"candidate\"\r\n" ] } ], @@ -400,7 +358,34 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 24, + "id": "08c65f5b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Pipeline\r\n", + "metadata:\r\n", + " name: iris\r\n", + "spec:\r\n", + " steps:\r\n", + " - name: iris\r\n", + " output:\r\n", + " steps:\r\n", + " - iris\r\n" + ] + } + ], + "source": [ + "!cat ./pipelines/error-step-name.yaml" + ] + }, + { + "cell_type": "code", + "execution_count": 21, "id": "dfa15efb", "metadata": {}, "outputs": [ @@ -408,20 +393,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Error: rpc error: code = FailedPrecondition desc = pipeline iris must not have a step name with the same name\r\n", - "Usage:\r\n", - " seldon pipeline load [flags]\r\n", - "\r\n", - "Flags:\r\n", - " -f, --file-path string pipeline file to load\r\n", - " -h, --help help for load\r\n", - " --scheduler-host string seldon scheduler host (default \"0.0.0.0:9004\")\r\n", - "\r\n", - "Global Flags:\r\n", - " -r, --show-request show request\r\n", - " -o, --show-response show response (default true)\r\n", - "\r\n", - "rpc error: code = FailedPrecondition desc = pipeline iris must not have a step name with the same name\r\n" + "Error: rpc error: code = FailedPrecondition desc = pipeline iris must not have a step name with the same name as pipeline name\r\n" ] } ], @@ -429,17 +401,116 @@ "!seldon pipeline load -f ./pipelines/error-step-name.yaml" ] }, + { + "cell_type": "code", + "execution_count": 22, + "id": "da863b1c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Pipeline\r\n", + "metadata:\r\n", + " name: iris-pipeline\r\n", + "spec:\r\n", + " steps:\r\n", + " - name: first\r\n", + " - name: second\r\n", + " inputs:\r\n", + " -\r\n", + " output:\r\n", + " steps:\r\n", + " - iris\r\n" + ] + } + ], + "source": [ + "!cat ./pipelines/error-empty-input.yaml" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "d5e4ff75", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Error: rpc error: code = FailedPrecondition desc = pipeline iris-pipeline step second has an empty input\r\n" + ] + } + ], + "source": [ + "!seldon pipeline load -f ./pipelines/error-empty-input.yaml" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "6d7b65d5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Pipeline\r\n", + "metadata:\r\n", + " name: iris-pipeline\r\n", + "spec:\r\n", + " steps:\r\n", + " - name: first\r\n", + " - name: second\r\n", + " - name: third\r\n", + " inputs:\r\n", + " - first\r\n", + " triggers:\r\n", + " -\r\n", + " output:\r\n", + " steps:\r\n", + " - iris\r\n" + ] + } + ], + "source": [ + "!cat ./pipelines/error-empty-trigger.yaml" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "e643dd64", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Error: rpc error: code = FailedPrecondition desc = pipeline iris-pipeline step third has an empty trigger\r\n" + ] + } + ], + "source": [ + "!seldon pipeline load -f ./pipelines/error-empty-trigger.yaml" + ] + }, { "cell_type": "markdown", "id": "9e476335", "metadata": {}, "source": [ - "## Failed scheduling" + "## Failed scheduling errors from CLI" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 25, "id": "81f6ff20", "metadata": {}, "outputs": [ @@ -447,20 +518,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Error: rpc error: code = FailedPrecondition desc = failed to schedule model badcapabilities. [failed replica filter RequirementsReplicaFilter for server replica triton:0 : model requirements [foobar] replica capabilities [triton dali fil onnx openvino python pytorch tensorflow tensorrt] failed replica filter RequirementsReplicaFilter for server replica mlserver:0 : model requirements [foobar] replica capabilities [mlserver alibi-detect lightgbm mlflow python sklearn spark-mlib xgboost]]\r\n", - "Usage:\r\n", - " seldon model load [flags]\r\n", - "\r\n", - "Flags:\r\n", - " -f, --file-path string model file to load\r\n", - " -h, --help help for load\r\n", - " --scheduler-host string seldon scheduler host (default \"0.0.0.0:9004\")\r\n", - "\r\n", - "Global Flags:\r\n", - " -r, --show-request show request\r\n", - " -o, --show-response show response (default true)\r\n", - "\r\n", - "rpc error: code = FailedPrecondition desc = failed to schedule model badcapabilities. [failed replica filter RequirementsReplicaFilter for server replica triton:0 : model requirements [foobar] replica capabilities [triton dali fil onnx openvino python pytorch tensorflow tensorrt] failed replica filter RequirementsReplicaFilter for server replica mlserver:0 : model requirements [foobar] replica capabilities [mlserver alibi-detect lightgbm mlflow python sklearn spark-mlib xgboost]]\r\n" + "Error: rpc error: code = FailedPrecondition desc = failed to schedule model badcapabilities. [failed replica filter RequirementsReplicaFilter for server replica mlserver:0 : model requirements [foobar] replica capabilities [mlserver alibi-detect alibi-explain huggingface lightgbm mlflow python sklearn spark-mlib xgboost] failed replica filter RequirementsReplicaFilter for server replica triton:0 : model requirements [foobar] replica capabilities [triton dali fil onnx openvino python pytorch tensorflow tensorrt]]\r\n" ] } ], @@ -470,7 +528,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 26, "id": "a1874007", "metadata": {}, "outputs": [ @@ -485,6 +543,14 @@ "source": [ "!seldon model unload badcapabilities" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "109cf2e1", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -503,7 +569,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/samples/cli-tests.md b/samples/cli-tests.md index 038269f9c9..68ceafbcdd 100644 --- a/samples/cli-tests.md +++ b/samples/cli-tests.md @@ -7,7 +7,7 @@ ```python !seldon model load -f ./models/sklearn-iris-gs.yaml !seldon model load -f ./models/tfsimple1.yaml -!seldon model load -f ./experiments/sklearn2.yaml +!seldon model load -f ./models/sklearn2.yaml !seldon model load -f ./models/cifar10.yaml !seldon experiment start -f ./experiments/ab-default-model.yaml !seldon pipeline load -f ./pipelines/cifar10.yaml @@ -26,12 +26,12 @@ !seldon model list ``` - model state reason - ----- ----- ------ - iris2 ModelAvailable - cifar10 ModelProgressing - iris ModelAvailable - tfsimple1 ModelAvailable + model state reason + ----- ----- ------ + iris ModelAvailable + tfsimple1 ModelAvailable + iris2 ModelAvailable + cifar10 ModelAvailable @@ -77,8 +77,8 @@ server replicas models ------ -------- ------ - triton 1 2 mlserver 1 2 + triton 1 2 @@ -96,9 +96,9 @@ !seldon pipeline list ``` - pipeline - -------- - cifar10-production + pipeline state reason + -------- ----- ------ + cifar10-production PipelineReady created pipeline @@ -119,8 +119,7 @@ {} -### Badly formed model - +### Resource Errors from CLI ```python @@ -131,7 +130,6 @@ kind: Model metadata: name: iris - namespace: seldon-mesh spec: storagUri: "gs://seldon-models/mlserver/iris" requirements: @@ -144,19 +142,6 @@ ``` Error: json: unknown field "storagUri" - Usage: - seldon model load [flags] - - Flags: - -f, --file-path string model file to load - -h, --help help for load - --scheduler-host string seldon scheduler host (default "0.0.0.0:9004") - - Global Flags: - -r, --show-request show request - -o, --show-response show response (default true) - - json: unknown field "storagUri" @@ -168,7 +153,6 @@ kind: Pipeline metadata: name: tfsimple-conditional - namespace: seldon-mesh spec: steps: - name: conditional @@ -195,19 +179,6 @@ ``` Error: json: unknown field "input" - Usage: - seldon pipeline load [flags] - - Flags: - -f, --file-path string pipeline file to load - -h, --help help for load - --scheduler-host string seldon scheduler host (default "0.0.0.0:9004") - - Global Flags: - -r, --show-request show request - -o, --show-response show response (default true) - - json: unknown field "input" @@ -219,13 +190,12 @@ kind: Experiment metadata: name: experiment-sample - namespace: seldon-mesh spec: - defaultModel: iris + default: iris candidate: - - modelName: iris + - name: iris weight: 50 - - modelName: iris2 + - name: iris2 weight: 50 @@ -235,19 +205,23 @@ ``` Error: json: unknown field "candidate" - Usage: - seldon experiment start [flags] - - Flags: - -f, --file-path string model file to load - -h, --help help for start - --scheduler-host string seldon scheduler host (default "0.0.0.0:9004") - - Global Flags: - -r, --show-request show request - -o, --show-response show response (default true) - - json: unknown field "candidate" + + + +```python +!cat ./pipelines/error-step-name.yaml +``` + + apiVersion: mlops.seldon.io/v1alpha1 + kind: Pipeline + metadata: + name: iris + spec: + steps: + - name: iris + output: + steps: + - iris @@ -255,43 +229,76 @@ !seldon pipeline load -f ./pipelines/error-step-name.yaml ``` - Error: rpc error: code = FailedPrecondition desc = pipeline iris must not have a step name with the same name - Usage: - seldon pipeline load [flags] - - Flags: - -f, --file-path string pipeline file to load - -h, --help help for load - --scheduler-host string seldon scheduler host (default "0.0.0.0:9004") - - Global Flags: - -r, --show-request show request - -o, --show-response show response (default true) - - rpc error: code = FailedPrecondition desc = pipeline iris must not have a step name with the same name + Error: rpc error: code = FailedPrecondition desc = pipeline iris must not have a step name with the same name as pipeline name + + + +```python +!cat ./pipelines/error-empty-input.yaml +``` + + apiVersion: mlops.seldon.io/v1alpha1 + kind: Pipeline + metadata: + name: iris-pipeline + spec: + steps: + - name: first + - name: second + inputs: + - + output: + steps: + - iris + + + +```python +!seldon pipeline load -f ./pipelines/error-empty-input.yaml +``` + + Error: rpc error: code = FailedPrecondition desc = pipeline iris-pipeline step second has an empty input + + + +```python +!cat ./pipelines/error-empty-trigger.yaml +``` + + apiVersion: mlops.seldon.io/v1alpha1 + kind: Pipeline + metadata: + name: iris-pipeline + spec: + steps: + - name: first + - name: second + - name: third + inputs: + - first + triggers: + - + output: + steps: + - iris + + + +```python +!seldon pipeline load -f ./pipelines/error-empty-trigger.yaml +``` + + Error: rpc error: code = FailedPrecondition desc = pipeline iris-pipeline step third has an empty trigger -## Failed scheduling +## Failed scheduling errors from CLI ```python !seldon model load -f ./models/error-bad-capabilities.yaml ``` - Error: rpc error: code = FailedPrecondition desc = failed to schedule model badcapabilities. [failed replica filter RequirementsReplicaFilter for server replica triton:0 : model requirements [foobar] replica capabilities [triton dali fil onnx openvino python pytorch tensorflow tensorrt] failed replica filter RequirementsReplicaFilter for server replica mlserver:0 : model requirements [foobar] replica capabilities [mlserver alibi-detect lightgbm mlflow python sklearn spark-mlib xgboost]] - Usage: - seldon model load [flags] - - Flags: - -f, --file-path string model file to load - -h, --help help for load - --scheduler-host string seldon scheduler host (default "0.0.0.0:9004") - - Global Flags: - -r, --show-request show request - -o, --show-response show response (default true) - - rpc error: code = FailedPrecondition desc = failed to schedule model badcapabilities. [failed replica filter RequirementsReplicaFilter for server replica triton:0 : model requirements [foobar] replica capabilities [triton dali fil onnx openvino python pytorch tensorflow tensorrt] failed replica filter RequirementsReplicaFilter for server replica mlserver:0 : model requirements [foobar] replica capabilities [mlserver alibi-detect lightgbm mlflow python sklearn spark-mlib xgboost]] + Error: rpc error: code = FailedPrecondition desc = failed to schedule model badcapabilities. [failed replica filter RequirementsReplicaFilter for server replica mlserver:0 : model requirements [foobar] replica capabilities [mlserver alibi-detect alibi-explain huggingface lightgbm mlflow python sklearn spark-mlib xgboost] failed replica filter RequirementsReplicaFilter for server replica triton:0 : model requirements [foobar] replica capabilities [triton dali fil onnx openvino python pytorch tensorflow tensorrt]] @@ -301,3 +308,8 @@ {} + + +```python + +``` diff --git a/samples/experiment_versions.ipynb b/samples/experiment_versions.ipynb index 9d00b9b8b5..39586b592d 100644 --- a/samples/experiment_versions.ipynb +++ b/samples/experiment_versions.ipynb @@ -30,7 +30,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "elect-samba", "metadata": {}, "outputs": [ @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "floral-moisture", "metadata": { "scrolled": true @@ -84,7 +84,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "0a7cfc57", "metadata": {}, "outputs": [ @@ -92,7 +92,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris_1::50]\r\n" + "Success: map[:iris_1::50]\r\n" ] } ], @@ -103,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "570c4769", "metadata": {}, "outputs": [ @@ -111,7 +111,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::50]\r\n" + "Success: map[:iris2_1::50]\r\n" ] } ], @@ -122,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "id": "a102ca45", "metadata": {}, "outputs": [ @@ -130,7 +130,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris3_1::50]\r\n" + "Success: map[:iris3_1::50]\r\n" ] } ], @@ -149,7 +149,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "id": "10fe4447", "metadata": {}, "outputs": [ @@ -177,7 +177,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "id": "differential-array", "metadata": {}, "outputs": [ @@ -195,7 +195,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "id": "overhead-banks", "metadata": {}, "outputs": [ @@ -228,7 +228,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "finite-significance", "metadata": {}, "outputs": [ @@ -236,7 +236,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::50 :iris_1::50]\r\n" + "Success: map[:iris2_1::58 :iris_1::42]\r\n" ] } ], @@ -255,7 +255,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 11, "id": "2f614d4d", "metadata": {}, "outputs": [ @@ -283,7 +283,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 12, "id": "03aada00", "metadata": {}, "outputs": [ @@ -301,7 +301,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 13, "id": "64e0ac04", "metadata": {}, "outputs": [ @@ -334,7 +334,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 14, "id": "73e85d3f", "metadata": {}, "outputs": [ @@ -342,7 +342,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris3_1::49 :iris_1::51]\r\n" + "Success: map[:iris3_1::44 :iris_1::56]\r\n" ] } ], @@ -353,7 +353,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 15, "id": "downtown-construction", "metadata": {}, "outputs": [ @@ -379,7 +379,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 16, "id": "8ca25a85", "metadata": {}, "outputs": [ @@ -387,7 +387,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris_1::50]\r\n" + "Success: map[:iris_1::50]\r\n" ] } ], @@ -398,7 +398,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 17, "id": "d6c20826", "metadata": {}, "outputs": [ @@ -406,7 +406,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::50]\r\n" + "Success: map[:iris2_1::50]\r\n" ] } ], @@ -417,7 +417,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 18, "id": "a695dd79", "metadata": {}, "outputs": [ @@ -425,7 +425,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris3_1::50]\r\n" + "Success: map[:iris3_1::50]\r\n" ] } ], @@ -436,7 +436,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 19, "id": "077bbce8", "metadata": {}, "outputs": [ @@ -468,7 +468,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 20, "id": "0c477529", "metadata": {}, "outputs": [ @@ -490,7 +490,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 21, "id": "440a0751", "metadata": { "scrolled": true @@ -522,7 +522,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 22, "id": "acebcac3", "metadata": {}, "outputs": [ @@ -530,7 +530,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris_1::50]\r\n" + "Success: map[:iris_1::50]\r\n" ] } ], @@ -541,7 +541,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 23, "id": "2c58faba", "metadata": {}, "outputs": [ @@ -549,7 +549,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::50]\r\n" + "Success: map[:iris2_1::50]\r\n" ] } ], @@ -560,7 +560,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 24, "id": "5d0ebaa8", "metadata": {}, "outputs": [ @@ -568,7 +568,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris3_1::50]\r\n" + "Success: map[:iris3_1::50]\r\n" ] } ], @@ -587,7 +587,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 25, "id": "6ed52032", "metadata": {}, "outputs": [ @@ -615,7 +615,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 26, "id": "92c1044f", "metadata": {}, "outputs": [ @@ -633,7 +633,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 27, "id": "4499a50c", "metadata": {}, "outputs": [ @@ -666,7 +666,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 28, "id": "f09e5168", "metadata": {}, "outputs": [ @@ -674,7 +674,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::50 :iris_1::50]\r\n" + "Success: map[:iris2_1::51 :iris_1::49]\r\n" ] } ], @@ -693,7 +693,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 29, "id": "c26e67ea", "metadata": {}, "outputs": [ @@ -721,7 +721,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 30, "id": "71484348", "metadata": {}, "outputs": [ @@ -739,7 +739,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 31, "id": "82c0da83", "metadata": {}, "outputs": [ @@ -772,7 +772,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 32, "id": "112c92dc", "metadata": {}, "outputs": [ @@ -780,7 +780,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris_1::50]\r\n" + "Success: map[:iris_1::50]\r\n" ] } ], @@ -791,7 +791,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 33, "id": "07033575", "metadata": {}, "outputs": [ @@ -799,7 +799,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::30 :iris3_1::20]\r\n" + "Success: map[:iris2_1::24 :iris3_1::26]\r\n" ] } ], @@ -810,7 +810,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 34, "id": "29ae8890", "metadata": {}, "outputs": [ @@ -818,7 +818,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::50]\r\n" + "Success: map[:iris2_1::50]\r\n" ] } ], @@ -829,7 +829,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 35, "id": "d4aced42", "metadata": {}, "outputs": [ @@ -855,7 +855,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 36, "id": "832aab89", "metadata": {}, "outputs": [ @@ -863,7 +863,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris_1::50]\r\n" + "Success: map[:iris_1::50]\r\n" ] } ], @@ -874,7 +874,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 37, "id": "2b846b96", "metadata": {}, "outputs": [ @@ -882,7 +882,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::50]\r\n" + "Success: map[:iris2_1::50]\r\n" ] } ], @@ -893,7 +893,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 38, "id": "a239c6ac", "metadata": {}, "outputs": [ @@ -901,7 +901,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris3_1::50]\r\n" + "Success: map[:iris3_1::50]\r\n" ] } ], @@ -912,7 +912,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 39, "id": "d0fe31cb", "metadata": {}, "outputs": [ @@ -957,7 +957,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/samples/experiment_versions.md b/samples/experiment_versions.md index d0b2a20037..5a08614ed1 100644 --- a/samples/experiment_versions.md +++ b/samples/experiment_versions.md @@ -40,7 +40,7 @@ Let's call all three models individually first. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris_1::50] + Success: map[:iris_1::50] @@ -49,7 +49,7 @@ Let's call all three models individually first. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris2_1::50] + Success: map[:iris2_1::50] @@ -58,7 +58,7 @@ Let's call all three models individually first. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris3_1::50] + Success: map[:iris3_1::50] We will start an experiment to change the iris endpoint to split traffic with the `iris2` model. @@ -112,7 +112,7 @@ Now when we call the iris model we should see a roughly 50/50 split between the '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris2_1::50 :iris_1::50] + Success: map[:iris2_1::58 :iris_1::42] Now we update the experiment to change to a split with the `iris3` model. @@ -166,7 +166,7 @@ Now we should see a split with the `iris3` model. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris3_1::49 :iris_1::51] + Success: map[:iris3_1::44 :iris_1::56] @@ -185,7 +185,7 @@ Now the experiment has been stopped we check everything as before. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris_1::50] + Success: map[:iris_1::50] @@ -194,7 +194,7 @@ Now the experiment has been stopped we check everything as before. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris2_1::50] + Success: map[:iris2_1::50] @@ -203,7 +203,7 @@ Now the experiment has been stopped we check everything as before. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris3_1::50] + Success: map[:iris3_1::50] @@ -254,7 +254,7 @@ Let's call all three models to verify initial conditions. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris_1::50] + Success: map[:iris_1::50] @@ -263,7 +263,7 @@ Let's call all three models to verify initial conditions. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris2_1::50] + Success: map[:iris2_1::50] @@ -272,7 +272,7 @@ Let's call all three models to verify initial conditions. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris3_1::50] + Success: map[:iris3_1::50] Now we start an experiment to change calls to the `iris` model to split with the `iris2` model. @@ -326,7 +326,7 @@ Run a set of calls and record which route the traffic took. There should be roug '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris2_1::50 :iris_1::50] + Success: map[:iris2_1::51 :iris_1::49] Now let's change the model we want to experiment to modify to the `iris3` model. Splitting between that and `iris2`. @@ -380,7 +380,7 @@ Let's check the iris model is now as before but the iris3 model has traffic spli '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris_1::50] + Success: map[:iris_1::50] @@ -389,7 +389,7 @@ Let's check the iris model is now as before but the iris3 model has traffic spli '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris2_1::30 :iris3_1::20] + Success: map[:iris2_1::24 :iris3_1::26] @@ -398,7 +398,7 @@ Let's check the iris model is now as before but the iris3 model has traffic spli '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris2_1::50] + Success: map[:iris2_1::50] @@ -417,7 +417,7 @@ Finally, let's check now the experiment has stopped as is as at the start. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris_1::50] + Success: map[:iris_1::50] @@ -426,7 +426,7 @@ Finally, let's check now the experiment has stopped as is as at the start. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris2_1::50] + Success: map[:iris2_1::50] @@ -435,7 +435,7 @@ Finally, let's check now the experiment has stopped as is as at the start. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris3_1::50] + Success: map[:iris3_1::50] diff --git a/samples/explainer-examples.ipynb b/samples/explainer-examples.ipynb index 0bb2eca6da..8619498a85 100644 --- a/samples/explainer-examples.ipynb +++ b/samples/explainer-examples.ipynb @@ -10,7 +10,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 1, "id": "bed5b232", "metadata": {}, "outputs": [ @@ -35,7 +35,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 2, "id": "e65edf6d", "metadata": {}, "outputs": [ @@ -53,7 +53,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 3, "id": "b1a65e4f", "metadata": {}, "outputs": [ @@ -71,7 +71,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 4, "id": "1729d991", "metadata": {}, "outputs": [ @@ -82,7 +82,7 @@ "{\r\n", "\t\"model_name\": \"income_1\",\r\n", "\t\"model_version\": \"1\",\r\n", - "\t\"id\": \"fc0fce00-5454-493f-85c1-945e9bf6ed4f\",\r\n", + "\t\"id\": \"e41ac2cf-6c53-48a1-90cd-bbb4b3bb64d1\",\r\n", "\t\"parameters\": {\r\n", "\t\t\"content_type\": null,\r\n", "\t\t\"headers\": null\r\n", @@ -111,7 +111,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 5, "id": "843a5a70", "metadata": {}, "outputs": [ @@ -137,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 6, "id": "73de58f8", "metadata": {}, "outputs": [ @@ -155,7 +155,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 7, "id": "10e50de8", "metadata": {}, "outputs": [ @@ -173,7 +173,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 8, "id": "6191c534", "metadata": {}, "outputs": [ @@ -184,7 +184,7 @@ "{\r\n", "\t\"model_name\": \"income-explainer_1\",\r\n", "\t\"model_version\": \"1\",\r\n", - "\t\"id\": \"0109be60-4b40-41d5-aef7-106601fc8cf5\",\r\n", + "\t\"id\": \"1f50efc2-848a-42c7-85cf-978da74fab7d\",\r\n", "\t\"parameters\": {\r\n", "\t\t\"content_type\": null,\r\n", "\t\t\"headers\": null\r\n", @@ -201,7 +201,7 @@ "\t\t\t\t\"headers\": null\r\n", "\t\t\t},\r\n", "\t\t\t\"data\": [\r\n", - "\t\t\t\t\"{\\\"meta\\\": {\\\"name\\\": \\\"AnchorTabular\\\", \\\"type\\\": [\\\"blackbox\\\"], \\\"explanations\\\": [\\\"local\\\"], \\\"params\\\": {\\\"seed\\\": 1, \\\"disc_perc\\\": [25, 50, 75], \\\"threshold\\\": 0.95, \\\"delta\\\": 0.1, \\\"tau\\\": 0.15, \\\"batch_size\\\": 100, \\\"coverage_samples\\\": 10000, \\\"beam_size\\\": 1, \\\"stop_on_first\\\": false, \\\"max_anchor_size\\\": null, \\\"min_samples_start\\\": 100, \\\"n_covered_ex\\\": 10, \\\"binary_cache_size\\\": 10000, \\\"cache_margin\\\": 1000, \\\"verbose\\\": false, \\\"verbose_every\\\": 1, \\\"kwargs\\\": {}}, \\\"version\\\": \\\"0.8.0\\\"}, \\\"data\\\": {\\\"anchor\\\": [\\\"Marital Status = Never-Married\\\", \\\"Relationship = Own-child\\\", \\\"Capital Gain <= 0.00\\\"], \\\"precision\\\": 0.975609756097561, \\\"coverage\\\": 0.06853582554517133, \\\"raw\\\": {\\\"feature\\\": [3, 5, 8], \\\"mean\\\": [0.7866666666666666, 0.9232876712328767, 0.975609756097561], \\\"precision\\\": [0.7866666666666666, 0.9232876712328767, 0.975609756097561], \\\"coverage\\\": [0.3037383177570093, 0.07165109034267912, 0.06853582554517133], \\\"examples\\\": [{\\\"covered_true\\\": [[35, 4, 1, 1, 7, 5, 4, 0, 0, 0, 24, 4], [24, 4, 1, 1, 8, 3, 2, 0, 0, 0, 40, 9], [43, 4, 1, 1, 8, 0, 4, 1, 0, 0, 45, 9], [42, 6, 1, 1, 6, 0, 4, 1, 0, 0, 60, 9], [32, 2, 5, 1, 5, 0, 4, 1, 0, 0, 50, 9], [26, 4, 1, 1, 5, 3, 4, 0, 0, 0, 40, 9], [29, 4, 1, 1, 2, 1, 4, 1, 0, 0, 40, 9], [28, 4, 1, 1, 2, 1, 4, 1, 0, 0, 55, 9], [32, 4, 1, 1, 5, 1, 4, 0, 0, 0, 45, 9], [27, 4, 1, 1, 7, 3, 4, 0, 0, 0, 20, 9]], \\\"covered_false\\\": [[46, 6, 5, 1, 8, 0, 4, 1, 0, 0, 50, 9], [42, 6, 5, 1, 8, 0, 4, 1, 0, 0, 50, 9], [40, 4, 5, 1, 5, 1, 4, 0, 0, 0, 45, 9], [30, 4, 1, 1, 5, 5, 4, 0, 7688, 0, 50, 9], [52, 4, 5, 1, 5, 4, 4, 1, 15020, 0, 50, 9], [48, 4, 5, 1, 8, 1, 4, 1, 99999, 0, 50, 9], [40, 2, 1, 1, 5, 1, 4, 1, 0, 0, 50, 9], [44, 4, 5, 1, 8, 1, 4, 1, 14084, 0, 56, 9], [30, 4, 1, 1, 5, 5, 4, 0, 7688, 0, 50, 9], [43, 4, 1, 1, 8, 0, 4, 1, 0, 1977, 50, 9]], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}, {\\\"covered_true\\\": [[40, 6, 1, 1, 8, 3, 4, 1, 0, 0, 45, 9], [39, 4, 1, 1, 6, 3, 4, 1, 0, 0, 60, 9], [53, 4, 5, 1, 8, 3, 4, 1, 0, 0, 40, 9], [25, 4, 1, 1, 1, 3, 4, 0, 0, 0, 40, 9], [75, 6, 5, 1, 5, 3, 4, 0, 0, 0, 50, 9], [25, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9], [30, 4, 1, 1, 4, 3, 4, 1, 0, 0, 60, 4], [22, 4, 1, 1, 8, 3, 4, 0, 0, 0, 30, 9], [48, 4, 1, 1, 5, 3, 4, 1, 0, 0, 45, 1], [51, 4, 2, 1, 5, 3, 4, 1, 0, 0, 40, 9]], \\\"covered_false\\\": [[47, 6, 1, 1, 8, 3, 2, 1, 10520, 0, 45, 9], [44, 4, 1, 1, 5, 3, 4, 1, 7688, 0, 40, 9], [50, 4, 5, 1, 8, 3, 4, 1, 15024, 0, 65, 9], [32, 4, 1, 1, 6, 3, 2, 1, 15024, 0, 50, 9], [66, 4, 1, 1, 5, 3, 4, 1, 20051, 0, 40, 9], [49, 7, 2, 1, 8, 3, 4, 1, 0, 0, 50, 9], [78, 5, 1, 1, 8, 3, 4, 1, 9386, 0, 45, 9]], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}, {\\\"covered_true\\\": [[27, 4, 1, 1, 8, 3, 4, 1, 0, 0, 45, 9], [32, 2, 5, 1, 5, 3, 4, 0, 0, 0, 40, 9], [41, 4, 5, 1, 5, 3, 4, 1, 0, 0, 40, 9], [44, 4, 1, 1, 5, 3, 4, 1, 0, 0, 40, 9], [26, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9], [31, 4, 1, 1, 8, 3, 4, 0, 0, 0, 50, 9], [27, 4, 1, 1, 5, 3, 1, 1, 0, 0, 40, 9], [43, 4, 1, 1, 8, 3, 4, 0, 0, 0, 40, 9], [43, 4, 1, 1, 2, 3, 2, 1, 0, 0, 40, 9], [26, 7, 1, 1, 5, 3, 1, 1, 0, 0, 20, 1]], \\\"covered_false\\\": [], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}], \\\"all_precision\\\": 0, \\\"num_preds\\\": 1000000, \\\"success\\\": true, \\\"names\\\": [\\\"Marital Status = Never-Married\\\", \\\"Relationship = Own-child\\\", \\\"Capital Gain <= 0.00\\\"], \\\"prediction\\\": [0], \\\"instance\\\": [47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0], \\\"instances\\\": [[47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0]]}}}\"\r\n", + "\t\t\t\t\"{\\\"meta\\\": {\\\"name\\\": \\\"AnchorTabular\\\", \\\"type\\\": [\\\"blackbox\\\"], \\\"explanations\\\": [\\\"local\\\"], \\\"params\\\": {\\\"seed\\\": 1, \\\"disc_perc\\\": [25, 50, 75], \\\"threshold\\\": 0.95, \\\"delta\\\": 0.1, \\\"tau\\\": 0.15, \\\"batch_size\\\": 100, \\\"coverage_samples\\\": 10000, \\\"beam_size\\\": 1, \\\"stop_on_first\\\": false, \\\"max_anchor_size\\\": null, \\\"min_samples_start\\\": 100, \\\"n_covered_ex\\\": 10, \\\"binary_cache_size\\\": 10000, \\\"cache_margin\\\": 1000, \\\"verbose\\\": false, \\\"verbose_every\\\": 1, \\\"kwargs\\\": {}}, \\\"version\\\": \\\"0.8.0\\\"}, \\\"data\\\": {\\\"anchor\\\": [\\\"Marital Status = Never-Married\\\", \\\"Relationship = Own-child\\\", \\\"Capital Gain <= 0.00\\\"], \\\"precision\\\": 0.9973684210526316, \\\"coverage\\\": 0.06853582554517133, \\\"raw\\\": {\\\"feature\\\": [3, 5, 8], \\\"mean\\\": [0.8037383177570093, 0.9179954441913439, 0.9973684210526316], \\\"precision\\\": [0.8037383177570093, 0.9179954441913439, 0.9973684210526316], \\\"coverage\\\": [0.3037383177570093, 0.07165109034267912, 0.06853582554517133], \\\"examples\\\": [{\\\"covered_true\\\": [[32, 0, 1, 1, 0, 1, 4, 0, 0, 0, 20, 0], [40, 4, 1, 1, 6, 1, 4, 1, 0, 0, 53, 9], [26, 4, 5, 1, 2, 0, 4, 1, 0, 0, 20, 1], [42, 4, 1, 1, 6, 0, 4, 1, 0, 0, 40, 9], [43, 4, 1, 1, 2, 0, 4, 1, 0, 0, 48, 9], [37, 2, 1, 1, 7, 0, 4, 1, 0, 0, 40, 9], [34, 4, 1, 1, 2, 0, 4, 1, 0, 0, 50, 9], [57, 4, 1, 1, 8, 0, 4, 1, 0, 0, 40, 9], [55, 5, 5, 1, 5, 1, 4, 0, 0, 0, 35, 9], [44, 6, 5, 1, 5, 0, 4, 1, 0, 0, 40, 9]], \\\"covered_false\\\": [[51, 5, 2, 1, 5, 0, 4, 1, 15024, 0, 40, 9], [39, 4, 5, 1, 5, 0, 4, 1, 0, 0, 50, 9], [34, 7, 5, 1, 5, 0, 4, 1, 7688, 0, 38, 9], [52, 4, 2, 1, 8, 0, 4, 1, 0, 0, 57, 9], [46, 4, 5, 1, 5, 0, 4, 1, 0, 0, 40, 9], [37, 4, 5, 1, 8, 0, 4, 1, 0, 0, 40, 9], [37, 6, 2, 1, 5, 1, 4, 0, 0, 2559, 60, 9], [52, 5, 2, 1, 5, 0, 4, 1, 99999, 0, 65, 9], [65, 5, 1, 1, 8, 0, 4, 1, 99999, 0, 65, 9], [70, 6, 1, 1, 5, 0, 4, 1, 20051, 0, 35, 9]], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}, {\\\"covered_true\\\": [[46, 7, 1, 1, 5, 3, 4, 1, 0, 0, 37, 9], [37, 2, 1, 1, 5, 3, 4, 0, 0, 0, 30, 9], [46, 4, 1, 1, 2, 3, 4, 1, 0, 0, 50, 0], [45, 4, 1, 1, 6, 3, 4, 1, 0, 2002, 55, 9], [41, 4, 1, 1, 2, 3, 4, 1, 0, 0, 40, 9], [45, 4, 1, 1, 5, 3, 4, 1, 0, 0, 30, 9], [39, 4, 1, 1, 1, 3, 4, 1, 0, 0, 40, 9], [29, 4, 1, 1, 5, 3, 4, 0, 0, 0, 45, 9], [34, 7, 2, 1, 4, 3, 1, 1, 0, 0, 20, 2], [31, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9]], \\\"covered_false\\\": [[30, 4, 1, 1, 6, 3, 4, 1, 7298, 0, 50, 9], [34, 4, 1, 1, 6, 3, 4, 1, 0, 0, 40, 9], [65, 4, 1, 1, 8, 3, 4, 1, 99999, 0, 40, 9], [90, 4, 1, 1, 6, 3, 4, 1, 9386, 0, 15, 9], [41, 4, 5, 1, 5, 3, 4, 1, 15024, 0, 50, 9], [46, 4, 5, 1, 5, 3, 4, 0, 7688, 0, 35, 9]], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}, {\\\"covered_true\\\": [[26, 4, 5, 1, 5, 3, 4, 1, 0, 0, 40, 9], [30, 7, 1, 1, 5, 3, 4, 1, 0, 0, 35, 9], [29, 4, 1, 1, 1, 3, 1, 0, 0, 0, 40, 6], [44, 6, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9], [47, 4, 1, 1, 1, 3, 4, 1, 0, 0, 40, 9], [49, 4, 1, 1, 5, 3, 4, 0, 0, 0, 40, 9], [62, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9], [47, 4, 5, 1, 5, 3, 4, 0, 0, 0, 50, 9], [57, 4, 1, 1, 6, 3, 4, 1, 0, 0, 55, 9], [37, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9]], \\\"covered_false\\\": [], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}], \\\"all_precision\\\": 0, \\\"num_preds\\\": 1000000, \\\"success\\\": true, \\\"names\\\": [\\\"Marital Status = Never-Married\\\", \\\"Relationship = Own-child\\\", \\\"Capital Gain <= 0.00\\\"], \\\"prediction\\\": [0], \\\"instance\\\": [47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0], \\\"instances\\\": [[47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0]]}}}\"\r\n", "\t\t\t]\r\n", "\t\t}\r\n", "\t]\r\n", @@ -216,7 +216,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 9, "id": "a8d8b077", "metadata": {}, "outputs": [ @@ -234,7 +234,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 10, "id": "bce80764", "metadata": {}, "outputs": [ @@ -275,7 +275,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/samples/explainer-examples.md b/samples/explainer-examples.md index 2b3c4c0fbd..6c52893cad 100644 --- a/samples/explainer-examples.md +++ b/samples/explainer-examples.md @@ -40,7 +40,7 @@ { "model_name": "income_1", "model_version": "1", - "id": "fc0fce00-5454-493f-85c1-945e9bf6ed4f", + "id": "e41ac2cf-6c53-48a1-90cd-bbb4b3bb64d1", "parameters": { "content_type": null, "headers": null @@ -102,7 +102,7 @@ { "model_name": "income-explainer_1", "model_version": "1", - "id": "0109be60-4b40-41d5-aef7-106601fc8cf5", + "id": "1f50efc2-848a-42c7-85cf-978da74fab7d", "parameters": { "content_type": null, "headers": null @@ -119,7 +119,7 @@ "headers": null }, "data": [ - "{\"meta\": {\"name\": \"AnchorTabular\", \"type\": [\"blackbox\"], \"explanations\": [\"local\"], \"params\": {\"seed\": 1, \"disc_perc\": [25, 50, 75], \"threshold\": 0.95, \"delta\": 0.1, \"tau\": 0.15, \"batch_size\": 100, \"coverage_samples\": 10000, \"beam_size\": 1, \"stop_on_first\": false, \"max_anchor_size\": null, \"min_samples_start\": 100, \"n_covered_ex\": 10, \"binary_cache_size\": 10000, \"cache_margin\": 1000, \"verbose\": false, \"verbose_every\": 1, \"kwargs\": {}}, \"version\": \"0.8.0\"}, \"data\": {\"anchor\": [\"Marital Status = Never-Married\", \"Relationship = Own-child\", \"Capital Gain <= 0.00\"], \"precision\": 0.975609756097561, \"coverage\": 0.06853582554517133, \"raw\": {\"feature\": [3, 5, 8], \"mean\": [0.7866666666666666, 0.9232876712328767, 0.975609756097561], \"precision\": [0.7866666666666666, 0.9232876712328767, 0.975609756097561], \"coverage\": [0.3037383177570093, 0.07165109034267912, 0.06853582554517133], \"examples\": [{\"covered_true\": [[35, 4, 1, 1, 7, 5, 4, 0, 0, 0, 24, 4], [24, 4, 1, 1, 8, 3, 2, 0, 0, 0, 40, 9], [43, 4, 1, 1, 8, 0, 4, 1, 0, 0, 45, 9], [42, 6, 1, 1, 6, 0, 4, 1, 0, 0, 60, 9], [32, 2, 5, 1, 5, 0, 4, 1, 0, 0, 50, 9], [26, 4, 1, 1, 5, 3, 4, 0, 0, 0, 40, 9], [29, 4, 1, 1, 2, 1, 4, 1, 0, 0, 40, 9], [28, 4, 1, 1, 2, 1, 4, 1, 0, 0, 55, 9], [32, 4, 1, 1, 5, 1, 4, 0, 0, 0, 45, 9], [27, 4, 1, 1, 7, 3, 4, 0, 0, 0, 20, 9]], \"covered_false\": [[46, 6, 5, 1, 8, 0, 4, 1, 0, 0, 50, 9], [42, 6, 5, 1, 8, 0, 4, 1, 0, 0, 50, 9], [40, 4, 5, 1, 5, 1, 4, 0, 0, 0, 45, 9], [30, 4, 1, 1, 5, 5, 4, 0, 7688, 0, 50, 9], [52, 4, 5, 1, 5, 4, 4, 1, 15020, 0, 50, 9], [48, 4, 5, 1, 8, 1, 4, 1, 99999, 0, 50, 9], [40, 2, 1, 1, 5, 1, 4, 1, 0, 0, 50, 9], [44, 4, 5, 1, 8, 1, 4, 1, 14084, 0, 56, 9], [30, 4, 1, 1, 5, 5, 4, 0, 7688, 0, 50, 9], [43, 4, 1, 1, 8, 0, 4, 1, 0, 1977, 50, 9]], \"uncovered_true\": [], \"uncovered_false\": []}, {\"covered_true\": [[40, 6, 1, 1, 8, 3, 4, 1, 0, 0, 45, 9], [39, 4, 1, 1, 6, 3, 4, 1, 0, 0, 60, 9], [53, 4, 5, 1, 8, 3, 4, 1, 0, 0, 40, 9], [25, 4, 1, 1, 1, 3, 4, 0, 0, 0, 40, 9], [75, 6, 5, 1, 5, 3, 4, 0, 0, 0, 50, 9], [25, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9], [30, 4, 1, 1, 4, 3, 4, 1, 0, 0, 60, 4], [22, 4, 1, 1, 8, 3, 4, 0, 0, 0, 30, 9], [48, 4, 1, 1, 5, 3, 4, 1, 0, 0, 45, 1], [51, 4, 2, 1, 5, 3, 4, 1, 0, 0, 40, 9]], \"covered_false\": [[47, 6, 1, 1, 8, 3, 2, 1, 10520, 0, 45, 9], [44, 4, 1, 1, 5, 3, 4, 1, 7688, 0, 40, 9], [50, 4, 5, 1, 8, 3, 4, 1, 15024, 0, 65, 9], [32, 4, 1, 1, 6, 3, 2, 1, 15024, 0, 50, 9], [66, 4, 1, 1, 5, 3, 4, 1, 20051, 0, 40, 9], [49, 7, 2, 1, 8, 3, 4, 1, 0, 0, 50, 9], [78, 5, 1, 1, 8, 3, 4, 1, 9386, 0, 45, 9]], \"uncovered_true\": [], \"uncovered_false\": []}, {\"covered_true\": [[27, 4, 1, 1, 8, 3, 4, 1, 0, 0, 45, 9], [32, 2, 5, 1, 5, 3, 4, 0, 0, 0, 40, 9], [41, 4, 5, 1, 5, 3, 4, 1, 0, 0, 40, 9], [44, 4, 1, 1, 5, 3, 4, 1, 0, 0, 40, 9], [26, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9], [31, 4, 1, 1, 8, 3, 4, 0, 0, 0, 50, 9], [27, 4, 1, 1, 5, 3, 1, 1, 0, 0, 40, 9], [43, 4, 1, 1, 8, 3, 4, 0, 0, 0, 40, 9], [43, 4, 1, 1, 2, 3, 2, 1, 0, 0, 40, 9], [26, 7, 1, 1, 5, 3, 1, 1, 0, 0, 20, 1]], \"covered_false\": [], \"uncovered_true\": [], \"uncovered_false\": []}], \"all_precision\": 0, \"num_preds\": 1000000, \"success\": true, \"names\": [\"Marital Status = Never-Married\", \"Relationship = Own-child\", \"Capital Gain <= 0.00\"], \"prediction\": [0], \"instance\": [47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0], \"instances\": [[47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0]]}}}" + "{\"meta\": {\"name\": \"AnchorTabular\", \"type\": [\"blackbox\"], \"explanations\": [\"local\"], \"params\": {\"seed\": 1, \"disc_perc\": [25, 50, 75], \"threshold\": 0.95, \"delta\": 0.1, \"tau\": 0.15, \"batch_size\": 100, \"coverage_samples\": 10000, \"beam_size\": 1, \"stop_on_first\": false, \"max_anchor_size\": null, \"min_samples_start\": 100, \"n_covered_ex\": 10, \"binary_cache_size\": 10000, \"cache_margin\": 1000, \"verbose\": false, \"verbose_every\": 1, \"kwargs\": {}}, \"version\": \"0.8.0\"}, \"data\": {\"anchor\": [\"Marital Status = Never-Married\", \"Relationship = Own-child\", \"Capital Gain <= 0.00\"], \"precision\": 0.9973684210526316, \"coverage\": 0.06853582554517133, \"raw\": {\"feature\": [3, 5, 8], \"mean\": [0.8037383177570093, 0.9179954441913439, 0.9973684210526316], \"precision\": [0.8037383177570093, 0.9179954441913439, 0.9973684210526316], \"coverage\": [0.3037383177570093, 0.07165109034267912, 0.06853582554517133], \"examples\": [{\"covered_true\": [[32, 0, 1, 1, 0, 1, 4, 0, 0, 0, 20, 0], [40, 4, 1, 1, 6, 1, 4, 1, 0, 0, 53, 9], [26, 4, 5, 1, 2, 0, 4, 1, 0, 0, 20, 1], [42, 4, 1, 1, 6, 0, 4, 1, 0, 0, 40, 9], [43, 4, 1, 1, 2, 0, 4, 1, 0, 0, 48, 9], [37, 2, 1, 1, 7, 0, 4, 1, 0, 0, 40, 9], [34, 4, 1, 1, 2, 0, 4, 1, 0, 0, 50, 9], [57, 4, 1, 1, 8, 0, 4, 1, 0, 0, 40, 9], [55, 5, 5, 1, 5, 1, 4, 0, 0, 0, 35, 9], [44, 6, 5, 1, 5, 0, 4, 1, 0, 0, 40, 9]], \"covered_false\": [[51, 5, 2, 1, 5, 0, 4, 1, 15024, 0, 40, 9], [39, 4, 5, 1, 5, 0, 4, 1, 0, 0, 50, 9], [34, 7, 5, 1, 5, 0, 4, 1, 7688, 0, 38, 9], [52, 4, 2, 1, 8, 0, 4, 1, 0, 0, 57, 9], [46, 4, 5, 1, 5, 0, 4, 1, 0, 0, 40, 9], [37, 4, 5, 1, 8, 0, 4, 1, 0, 0, 40, 9], [37, 6, 2, 1, 5, 1, 4, 0, 0, 2559, 60, 9], [52, 5, 2, 1, 5, 0, 4, 1, 99999, 0, 65, 9], [65, 5, 1, 1, 8, 0, 4, 1, 99999, 0, 65, 9], [70, 6, 1, 1, 5, 0, 4, 1, 20051, 0, 35, 9]], \"uncovered_true\": [], \"uncovered_false\": []}, {\"covered_true\": [[46, 7, 1, 1, 5, 3, 4, 1, 0, 0, 37, 9], [37, 2, 1, 1, 5, 3, 4, 0, 0, 0, 30, 9], [46, 4, 1, 1, 2, 3, 4, 1, 0, 0, 50, 0], [45, 4, 1, 1, 6, 3, 4, 1, 0, 2002, 55, 9], [41, 4, 1, 1, 2, 3, 4, 1, 0, 0, 40, 9], [45, 4, 1, 1, 5, 3, 4, 1, 0, 0, 30, 9], [39, 4, 1, 1, 1, 3, 4, 1, 0, 0, 40, 9], [29, 4, 1, 1, 5, 3, 4, 0, 0, 0, 45, 9], [34, 7, 2, 1, 4, 3, 1, 1, 0, 0, 20, 2], [31, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9]], \"covered_false\": [[30, 4, 1, 1, 6, 3, 4, 1, 7298, 0, 50, 9], [34, 4, 1, 1, 6, 3, 4, 1, 0, 0, 40, 9], [65, 4, 1, 1, 8, 3, 4, 1, 99999, 0, 40, 9], [90, 4, 1, 1, 6, 3, 4, 1, 9386, 0, 15, 9], [41, 4, 5, 1, 5, 3, 4, 1, 15024, 0, 50, 9], [46, 4, 5, 1, 5, 3, 4, 0, 7688, 0, 35, 9]], \"uncovered_true\": [], \"uncovered_false\": []}, {\"covered_true\": [[26, 4, 5, 1, 5, 3, 4, 1, 0, 0, 40, 9], [30, 7, 1, 1, 5, 3, 4, 1, 0, 0, 35, 9], [29, 4, 1, 1, 1, 3, 1, 0, 0, 0, 40, 6], [44, 6, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9], [47, 4, 1, 1, 1, 3, 4, 1, 0, 0, 40, 9], [49, 4, 1, 1, 5, 3, 4, 0, 0, 0, 40, 9], [62, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9], [47, 4, 5, 1, 5, 3, 4, 0, 0, 0, 50, 9], [57, 4, 1, 1, 6, 3, 4, 1, 0, 0, 55, 9], [37, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9]], \"covered_false\": [], \"uncovered_true\": [], \"uncovered_false\": []}], \"all_precision\": 0, \"num_preds\": 1000000, \"success\": true, \"names\": [\"Marital Status = Never-Married\", \"Relationship = Own-child\", \"Capital Gain <= 0.00\"], \"prediction\": [0], \"instance\": [47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0], \"instances\": [[47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0]]}}}" ] } ] diff --git a/samples/huggingface.md b/samples/huggingface.md index a5d9b28a6b..4d1b54746a 100644 --- a/samples/huggingface.md +++ b/samples/huggingface.md @@ -46,7 +46,7 @@ Load the model { "model_name": "text-gen_1", "model_version": "1", - "id": "951a5db1-2511-4304-b6a1-1145c5d7ba1a", + "id": "5412f8b0-f440-4e33-851c-ac3ff754b9c0", "parameters": { "content_type": null, "headers": null @@ -63,7 +63,7 @@ Load the model "headers": null }, "data": [ - "{\"generated_text\": \"Once upon a time in a galaxy far away from the Milky Way, it looks very different. Scientists have discovered that star clusters are at least 1.5 times smaller than the sun and contain the biggest known mass of all the solar masses in the universe\"}" + "[{\"generated_text\": \"Once upon a time in a galaxy far away, the Human Race was destroyed at the hands of an evil machine. But in a galaxy far away, the Human Race was destroyed at the hands of an evil machine. But in a galaxy far away,\"}]" ] } ] @@ -76,7 +76,7 @@ Load the model '{"inputs":[{"name":"args","contents":{"bytes_contents":["T25jZSB1cG9uIGEgdGltZQo="]},"datatype":"BYTES","shape":[1]}]}' ``` - {"modelName":"text-gen_1", "modelVersion":"1", "outputs":[{"name":"output", "datatype":"BYTES", "shape":["1"], "parameters":{"content_type":{"stringParam":"str"}}, "contents":{"bytesContents":["eyJnZW5lcmF0ZWRfdGV4dCI6ICJPbmNlIHVwb24gYSB0aW1lXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG5cblxuXG4ifQ=="]}}]} + {"modelName":"text-gen_1", "modelVersion":"1", "outputs":[{"name":"output", "datatype":"BYTES", "shape":["1"], "parameters":{"content_type":{"stringParam":"str"}}, "contents":{"bytesContents":["W3siZ2VuZXJhdGVkX3RleHQiOiAiT25jZSB1cG9uIGEgdGltZVxuXG5Zb3UgaGF2ZSB0YWtlbiBhIGJpZyB0dW1ibGUgaW50byB5b3VyIGxpdmluZyByb29tIGFuZCBJIGNhbiBzZWUgdGhhdCB5b3UgYXJlIGxvb2tpbmcgYXQgaGltXG5Zb3Ugd2FudCB0byBzdG9wP1xuWW91IHNlZSBhbiBleWU/XG5Zb3Uga25vdyB3aGF0P1xuU29tZXRoaW5nJ3MgYmVlbiBoYXBwZW5pbmcgaW4geW91ciJ9XQ=="]}}]} Unload the model diff --git a/samples/inference.ipynb b/samples/inference.ipynb index 573eb93a1a..241935cdbf 100644 --- a/samples/inference.ipynb +++ b/samples/inference.ipynb @@ -10,15 +10,15 @@ "We will show:\n", "\n", " * Model inference to a Tensorflow model\n", - " * REST and gRPC using seldon CLI and with curl and grpcurl\n", + " * REST and gRPC using seldon CLI, curl and grpcurl\n", " * Pipeline inference\n", - " * REST and gRPC using seldon CLI and with curl and grpcurl\n", + " * REST and gRPC using seldon CLI, curl and grpcurl\n", " \n" ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 1, "id": "2cb9237c", "metadata": {}, "outputs": [ @@ -44,7 +44,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 2, "id": "34165288", "metadata": {}, "outputs": [ @@ -78,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 3, "id": "726f2dd0", "metadata": {}, "outputs": [ @@ -104,7 +104,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 4, "id": "2d9b631f", "metadata": {}, "outputs": [ @@ -122,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 5, "id": "7abd240a", "metadata": {}, "outputs": [ @@ -198,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 6, "id": "f86c494a", "metadata": {}, "outputs": [ @@ -217,7 +217,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 7, "id": "f4f1f4b4", "metadata": {}, "outputs": [ @@ -236,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 8, "id": "a9471bff", "metadata": {}, "outputs": [ @@ -284,7 +284,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 9, "id": "3720658f", "metadata": {}, "outputs": [ @@ -311,7 +311,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 10, "id": "050ed2dc", "metadata": {}, "outputs": [ @@ -329,7 +329,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 11, "id": "5fc982b6", "metadata": {}, "outputs": [ @@ -337,7 +337,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\"pipelineName\":\"tfsimple\", \"versions\":[{\"pipeline\":{\"name\":\"tfsimple\", \"uid\":\"ccvfbn54nntrbfkuk5i0\", \"version\":1, \"steps\":[{\"name\":\"tfsimple1\"}], \"output\":{\"steps\":[\"tfsimple1.outputs\"]}, \"kubernetesMeta\":{}}, \"state\":{\"pipelineVersion\":1, \"status\":\"PipelineReady\", \"reason\":\"created pipeline\", \"lastChangeTimestamp\":\"2022-10-06T15:35:56.699334091Z\"}}]}\r\n" + "{\"pipelineName\":\"tfsimple\", \"versions\":[{\"pipeline\":{\"name\":\"tfsimple\", \"uid\":\"cdqhbfkg9lks73eauglg\", \"version\":1, \"steps\":[{\"name\":\"tfsimple1\"}], \"output\":{\"steps\":[\"tfsimple1.outputs\"]}, \"kubernetesMeta\":{}}, \"state\":{\"pipelineVersion\":1, \"status\":\"PipelineReady\", \"reason\":\"created pipeline\", \"lastChangeTimestamp\":\"2022-11-16T16:54:22.856020153Z\"}}]}\r\n" ] } ], @@ -347,7 +347,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 12, "id": "42efbedd", "metadata": {}, "outputs": [ @@ -422,7 +422,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 13, "id": "db8adc42", "metadata": {}, "outputs": [ @@ -441,7 +441,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 14, "id": "23957098", "metadata": {}, "outputs": [ @@ -460,7 +460,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 15, "id": "21d5cfb8", "metadata": {}, "outputs": [ @@ -506,7 +506,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 16, "id": "8ee2b2fc", "metadata": {}, "outputs": [ @@ -549,7 +549,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/samples/inference.md b/samples/inference.md index d6a8c3dfdc..87e91d7959 100644 --- a/samples/inference.md +++ b/samples/inference.md @@ -3,9 +3,9 @@ We will show: * Model inference to a Tensorflow model - * REST and gRPC using seldon CLI and with curl and grpcurl + * REST and gRPC using seldon CLI, curl and grpcurl * Pipeline inference - * REST and gRPC using seldon CLI and with curl and grpcurl + * REST and gRPC using seldon CLI, curl and grpcurl @@ -206,7 +206,7 @@ Wait for the model to be ready. !seldon pipeline status tfsimple -w PipelineReady ``` - {"pipelineName":"tfsimple", "versions":[{"pipeline":{"name":"tfsimple", "uid":"ccvfbn54nntrbfkuk5i0", "version":1, "steps":[{"name":"tfsimple1"}], "output":{"steps":["tfsimple1.outputs"]}, "kubernetesMeta":{}}, "state":{"pipelineVersion":1, "status":"PipelineReady", "reason":"created pipeline", "lastChangeTimestamp":"2022-10-06T15:35:56.699334091Z"}}]} + {"pipelineName":"tfsimple", "versions":[{"pipeline":{"name":"tfsimple", "uid":"cdqhbfkg9lks73eauglg", "version":1, "steps":[{"name":"tfsimple1"}], "output":{"steps":["tfsimple1.outputs"]}, "kubernetesMeta":{}}, "state":{"pipelineVersion":1, "status":"PipelineReady", "reason":"created pipeline", "lastChangeTimestamp":"2022-11-16T16:54:22.856020153Z"}}]} diff --git a/samples/k8s-batch-examples.ipynb b/samples/k8s-batch-examples.ipynb index 163a55f6b1..546f6f4b24 100644 --- a/samples/k8s-batch-examples.ipynb +++ b/samples/k8s-batch-examples.ipynb @@ -10,28 +10,28 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "id": "3d069ec2-50a0-4fd3-b65e-d178cb7b142d", "metadata": {}, "outputs": [], "source": [ "import os\n", - "os.environ[\"NAMESPACE\"] = \"seldon\"" + "os.environ[\"NAMESPACE\"] = \"seldon-mesh\"" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "id": "93d79639-2651-4b83-bbcf-404e772f1f3e", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'172.19.255.12'" + "'172.19.255.1'" ] }, - "execution_count": 2, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -54,7 +54,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "id": "77169ee9-896f-4ee3-b154-b79997d71925", "metadata": {}, "outputs": [ @@ -62,15 +62,15 @@ "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Model\n", - "metadata:\n", - " name: iris\n", - "spec:\n", - " storageUri: \"gs://seldon-models/mlserver/iris\"\n", - " requirements:\n", - " - sklearn\n", - " memory: 100Ki\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Model\r\n", + "metadata:\r\n", + " name: iris\r\n", + "spec:\r\n", + " storageUri: \"gs://seldon-models/mlserver/iris\"\r\n", + " requirements:\r\n", + " - sklearn\r\n", + " memory: 100Ki\r\n" ] } ], @@ -80,7 +80,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 6, "id": "e5653b7f-b8f5-4f08-ac2c-a26775ddf027", "metadata": {}, "outputs": [ @@ -88,16 +88,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Pipeline\n", - "metadata:\n", - " name: iris-pipeline\n", - "spec:\n", - " steps:\n", - " - name: iris\n", - " output:\n", - " steps:\n", - " - iris\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Pipeline\r\n", + "metadata:\r\n", + " name: iris-pipeline\r\n", + "spec:\r\n", + " steps:\r\n", + " - name: iris\r\n", + " output:\r\n", + " steps:\r\n", + " - iris\r\n" ] } ], @@ -107,7 +107,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "id": "3c51fc8b-3164-4e1a-8616-452f62d61d22", "metadata": {}, "outputs": [ @@ -115,15 +115,15 @@ "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Model\n", - "metadata:\n", - " name: tfsimple1\n", - "spec:\n", - " storageUri: \"gs://seldon-models/triton/simple\"\n", - " requirements:\n", - " - tensorflow\n", - " memory: 100Ki\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Model\r\n", + "metadata:\r\n", + " name: tfsimple1\r\n", + "spec:\r\n", + " storageUri: \"gs://seldon-models/triton/simple\"\r\n", + " requirements:\r\n", + " - tensorflow\r\n", + " memory: 100Ki\r\n" ] } ], @@ -133,7 +133,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 8, "id": "992a0404-e1d6-4d55-a963-2cdebd42231c", "metadata": {}, "outputs": [ @@ -141,16 +141,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Pipeline\n", - "metadata:\n", - " name: tfsimple\n", - "spec:\n", - " steps:\n", - " - name: tfsimple1\n", - " output:\n", - " steps:\n", - " - tfsimple1\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Pipeline\r\n", + "metadata:\r\n", + " name: tfsimple\r\n", + "spec:\r\n", + " steps:\r\n", + " - name: tfsimple1\r\n", + " output:\r\n", + " steps:\r\n", + " - tfsimple1\r\n" ] } ], @@ -160,7 +160,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 9, "id": "b4f7affb-5418-4209-b665-4478482ea3dd", "metadata": {}, "outputs": [ @@ -185,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, "id": "66b6b1f3-08bc-4212-be47-9a1df0b18348", "metadata": {}, "outputs": [ @@ -194,11 +194,9 @@ "output_type": "stream", "text": [ "model.mlops.seldon.io/iris condition met\n", - "model.mlops.seldon.io/tfsimple condition met\n", "model.mlops.seldon.io/tfsimple1 condition met\n", "pipeline.mlops.seldon.io/iris-pipeline condition met\n", "pipeline.mlops.seldon.io/tfsimple condition met\n", - "pipeline.mlops.seldon.io/tfsimple-pipeline condition met\n", "model.mlops.seldon.io/tfsimple1 condition met\n", "pipeline.mlops.seldon.io/tfsimple condition met\n" ] @@ -222,7 +220,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 11, "id": "5b2678d3-a5cb-4b41-ad5b-3f29a7a1202d", "metadata": {}, "outputs": [ @@ -230,28 +228,28 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\n", - " \"model_name\": \"iris_1\",\n", - " \"model_version\": \"1\",\n", - " \"id\": \"3e60ef91-4422-4989-85c6-05d54a0c7473\",\n", - " \"parameters\": {\n", - " \"content_type\": null,\n", - " \"headers\": null\n", - " },\n", - " \"outputs\": [\n", - " {\n", - " \"name\": \"predict\",\n", - " \"shape\": [\n", - " 1\n", - " ],\n", - " \"datatype\": \"INT64\",\n", - " \"parameters\": null,\n", - " \"data\": [\n", - " 2\n", - " ]\n", - " }\n", - " ]\n", - "}\n" + "{\r\n", + " \"model_name\": \"iris_1\",\r\n", + " \"model_version\": \"1\",\r\n", + " \"id\": \"a67233c2-2f8c-4fbc-a87e-4e4d3d034c9f\",\r\n", + " \"parameters\": {\r\n", + " \"content_type\": null,\r\n", + " \"headers\": null\r\n", + " },\r\n", + " \"outputs\": [\r\n", + " {\r\n", + " \"name\": \"predict\",\r\n", + " \"shape\": [\r\n", + " 1\r\n", + " ],\r\n", + " \"datatype\": \"INT64\",\r\n", + " \"parameters\": null,\r\n", + " \"data\": [\r\n", + " 2\r\n", + " ]\r\n", + " }\r\n", + " ]\r\n", + "}\r\n" ] } ], @@ -262,7 +260,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 12, "id": "31701fb2-1185-415c-a0f8-b05ab89ae2d2", "metadata": {}, "outputs": [ @@ -270,21 +268,21 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\n", - " \"model_name\": \"\",\n", - " \"outputs\": [\n", - " {\n", - " \"data\": [\n", - " 2\n", - " ],\n", - " \"name\": \"predict\",\n", - " \"shape\": [\n", - " 1\n", - " ],\n", - " \"datatype\": \"INT64\"\n", - " }\n", - " ]\n", - "}\n" + "{\r\n", + " \"model_name\": \"\",\r\n", + " \"outputs\": [\r\n", + " {\r\n", + " \"data\": [\r\n", + " 2\r\n", + " ],\r\n", + " \"name\": \"predict\",\r\n", + " \"shape\": [\r\n", + " 1\r\n", + " ],\r\n", + " \"datatype\": \"INT64\"\r\n", + " }\r\n", + " ]\r\n", + "}\r\n" ] } ], @@ -295,7 +293,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 14, "id": "e7fd9ec3-fd25-48ad-bf5d-90231805cd01", "metadata": {}, "outputs": [ @@ -303,49 +301,49 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\n", - " \"model_name\": \"tfsimple_1\",\n", - " \"model_version\": \"1\",\n", - " \"outputs\": [\n", - " {\n", - " \"name\": \"OUTPUT0\",\n", - " \"datatype\": \"INT32\",\n", - " \"shape\": [\n", - " 1,\n", - " 16\n", - " ],\n", - " \"data\": [\n", - " 2,\n", - " 4,\n", - " 6,\n", - " 8,\n", - " 10,\n", - " 12,\n", - " 14,\n", - " 16,\n", - " 18,\n", - " 20,\n", - " 22,\n", - " 24,\n", - " 26,\n", - " 28,\n", - " 30,\n", - " 32\n", - " ]\n", - " }\n", - " ]\n", - "}\n" + "{\r\n", + " \"model_name\": \"tfsimple1_1\",\r\n", + " \"model_version\": \"1\",\r\n", + " \"outputs\": [\r\n", + " {\r\n", + " \"name\": \"OUTPUT0\",\r\n", + " \"datatype\": \"INT32\",\r\n", + " \"shape\": [\r\n", + " 1,\r\n", + " 16\r\n", + " ],\r\n", + " \"data\": [\r\n", + " 2,\r\n", + " 4,\r\n", + " 6,\r\n", + " 8,\r\n", + " 10,\r\n", + " 12,\r\n", + " 14,\r\n", + " 16,\r\n", + " 18,\r\n", + " 20,\r\n", + " 22,\r\n", + " 24,\r\n", + " 26,\r\n", + " 28,\r\n", + " 30,\r\n", + " 32\r\n", + " ]\r\n", + " }\r\n", + " ]\r\n", + "}\r\n" ] } ], "source": [ - "!seldon model infer tfsimple --inference-host ${MESH_IP}:80 \\\n", + "!seldon model infer tfsimple1 --inference-host ${MESH_IP}:80 \\\n", " '{\"outputs\":[{\"name\":\"OUTPUT0\"}], \"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 ." ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 16, "id": "9473915b-0ec4-457c-b304-1ba50e9cd78d", "metadata": {}, "outputs": [ @@ -353,68 +351,68 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\n", - " \"model_name\": \"\",\n", - " \"outputs\": [\n", - " {\n", - " \"data\": [\n", - " 2,\n", - " 4,\n", - " 6,\n", - " 8,\n", - " 10,\n", - " 12,\n", - " 14,\n", - " 16,\n", - " 18,\n", - " 20,\n", - " 22,\n", - " 24,\n", - " 26,\n", - " 28,\n", - " 30,\n", - " 32\n", - " ],\n", - " \"name\": \"OUTPUT0\",\n", - " \"shape\": [\n", - " 1,\n", - " 16\n", - " ],\n", - " \"datatype\": \"INT32\"\n", - " },\n", - " {\n", - " \"data\": [\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0,\n", - " 0\n", - " ],\n", - " \"name\": \"OUTPUT1\",\n", - " \"shape\": [\n", - " 1,\n", - " 16\n", - " ],\n", - " \"datatype\": \"INT32\"\n", - " }\n", - " ]\n", - "}\n" + "{\r\n", + " \"model_name\": \"\",\r\n", + " \"outputs\": [\r\n", + " {\r\n", + " \"data\": [\r\n", + " 2,\r\n", + " 4,\r\n", + " 6,\r\n", + " 8,\r\n", + " 10,\r\n", + " 12,\r\n", + " 14,\r\n", + " 16,\r\n", + " 18,\r\n", + " 20,\r\n", + " 22,\r\n", + " 24,\r\n", + " 26,\r\n", + " 28,\r\n", + " 30,\r\n", + " 32\r\n", + " ],\r\n", + " \"name\": \"OUTPUT0\",\r\n", + " \"shape\": [\r\n", + " 1,\r\n", + " 16\r\n", + " ],\r\n", + " \"datatype\": \"INT32\"\r\n", + " },\r\n", + " {\r\n", + " \"data\": [\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0,\r\n", + " 0\r\n", + " ],\r\n", + " \"name\": \"OUTPUT1\",\r\n", + " \"shape\": [\r\n", + " 1,\r\n", + " 16\r\n", + " ],\r\n", + " \"datatype\": \"INT32\"\r\n", + " }\r\n", + " ]\r\n", + "}\r\n" ] } ], "source": [ - "!seldon pipeline infer tfsimple-pipeline --inference-host ${MESH_IP}:80 \\\n", + "!seldon pipeline infer tfsimple --inference-host ${MESH_IP}:80 \\\n", " '{\"outputs\":[{\"name\":\"OUTPUT0\"}], \"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 ." ] }, @@ -428,7 +426,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 18, "id": "9e9bee26-3c1c-44b0-9889-587767cf933e", "metadata": {}, "outputs": [ @@ -436,24 +434,24 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\n", - " \"inputs\": [\n", - " {\n", - " \"name\": \"predict\",\n", - " \"data\": [\n", - " 0.38606369295833043,\n", - " 0.006894049558299753,\n", - " 0.6104082981607108,\n", - " 0.3958954239450676\n", - " ],\n", - " \"datatype\": \"FP64\",\n", - " \"shape\": [\n", - " 1,\n", - " 4\n", - " ]\n", - " }\n", - " ]\n", - "}\n" + "{\r\n", + " \"inputs\": [\r\n", + " {\r\n", + " \"name\": \"predict\",\r\n", + " \"data\": [\r\n", + " 0.38606369295833043,\r\n", + " 0.006894049558299753,\r\n", + " 0.6104082981607108,\r\n", + " 0.3958954239450676\r\n", + " ],\r\n", + " \"datatype\": \"FP64\",\r\n", + " \"shape\": [\r\n", + " 1,\r\n", + " 4\r\n", + " ]\r\n", + " }\r\n", + " ]\r\n", + "}\r\n" ] } ], @@ -463,7 +461,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 19, "id": "a3b60a8f-80b5-4803-82b9-9d68605480d7", "metadata": {}, "outputs": [ @@ -471,11 +469,21 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-10-10 10:12:51,214 [mlserver] INFO - Using asyncio event-loop policy: uvloop\n", - "2022-10-10 10:12:51,217 [mlserver] INFO - Server url: 172.19.255.12\n", - "2022-10-10 10:12:51,217 [mlserver] INFO - input file path: batch-inputs/iris-input.txt\n", - "2022-10-10 10:12:51,217 [mlserver] INFO - output file path: /tmp/iris-output.txt\n", - "2022-10-10 10:12:51,408 [mlserver] INFO - Time taken: 0.19 seconds\n" + "2022-11-16 18:24:17,272 [mlserver] INFO - Using asyncio event-loop policy: uvloop\n", + "2022-11-16 18:24:17,273 [mlserver] INFO - server url: 172.19.255.1\n", + "2022-11-16 18:24:17,273 [mlserver] INFO - model name: iris\n", + "2022-11-16 18:24:17,273 [mlserver] INFO - request headers: {}\n", + "2022-11-16 18:24:17,273 [mlserver] INFO - input file path: batch-inputs/iris-input.txt\n", + "2022-11-16 18:24:17,273 [mlserver] INFO - output file path: /tmp/iris-output.txt\n", + "2022-11-16 18:24:17,273 [mlserver] INFO - workers: 5\n", + "2022-11-16 18:24:17,273 [mlserver] INFO - retries: 3\n", + "2022-11-16 18:24:17,273 [mlserver] INFO - batch interval: 0.0\n", + "2022-11-16 18:24:17,274 [mlserver] INFO - batch jitter: 0.0\n", + "2022-11-16 18:24:17,274 [mlserver] INFO - connection timeout: 60\n", + "2022-11-16 18:24:17,274 [mlserver] INFO - micro-batch size: 1\n", + "2022-11-16 18:24:17,420 [mlserver] INFO - Finalizer: processed instances: 100\n", + "2022-11-16 18:24:17,421 [mlserver] INFO - Total processed instances: 100\n", + "2022-11-16 18:24:17,421 [mlserver] INFO - Time taken: 0.15 seconds\n" ] } ], @@ -486,7 +494,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 20, "id": "d3b7ef85-6435-4041-9857-2f843091118a", "metadata": {}, "outputs": [ @@ -494,11 +502,21 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-10-10 10:12:53,067 [mlserver] INFO - Using asyncio event-loop policy: uvloop\n", - "2022-10-10 10:12:53,071 [mlserver] INFO - Server url: 172.19.255.12\n", - "2022-10-10 10:12:53,071 [mlserver] INFO - input file path: batch-inputs/iris-input.txt\n", - "2022-10-10 10:12:53,071 [mlserver] INFO - output file path: /tmp/iris-pipeline-output.txt\n", - "2022-10-10 10:12:53,374 [mlserver] INFO - Time taken: 0.30 seconds\n" + "2022-11-16 18:25:18,651 [mlserver] INFO - Using asyncio event-loop policy: uvloop\n", + "2022-11-16 18:25:18,653 [mlserver] INFO - server url: 172.19.255.1\n", + "2022-11-16 18:25:18,653 [mlserver] INFO - model name: iris-pipeline.pipeline\n", + "2022-11-16 18:25:18,653 [mlserver] INFO - request headers: {}\n", + "2022-11-16 18:25:18,653 [mlserver] INFO - input file path: batch-inputs/iris-input.txt\n", + "2022-11-16 18:25:18,653 [mlserver] INFO - output file path: /tmp/iris-pipeline-output.txt\n", + "2022-11-16 18:25:18,653 [mlserver] INFO - workers: 5\n", + "2022-11-16 18:25:18,653 [mlserver] INFO - retries: 3\n", + "2022-11-16 18:25:18,653 [mlserver] INFO - batch interval: 0.0\n", + "2022-11-16 18:25:18,653 [mlserver] INFO - batch jitter: 0.0\n", + "2022-11-16 18:25:18,653 [mlserver] INFO - connection timeout: 60\n", + "2022-11-16 18:25:18,653 [mlserver] INFO - micro-batch size: 1\n", + "2022-11-16 18:25:18,963 [mlserver] INFO - Finalizer: processed instances: 100\n", + "2022-11-16 18:25:18,963 [mlserver] INFO - Total processed instances: 100\n", + "2022-11-16 18:25:18,963 [mlserver] INFO - Time taken: 0.31 seconds\n" ] } ], @@ -509,7 +527,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 21, "id": "2fd223f2-9b91-47c2-99a6-e0f16879b44e", "metadata": {}, "outputs": [ @@ -517,29 +535,28 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\n", - " \"model_name\": \"iris_1\",\n", - " \"model_version\": \"1\",\n", - " \"id\": \"75470ffc-e56f-4e41-9b3f-c0b5c236833f\",\n", - " \"parameters\": {\n", - " \"content_type\": null,\n", - " \"headers\": null,\n", - " \"batch_index\": 0\n", - " },\n", - " \"outputs\": [\n", - " {\n", - " \"name\": \"predict\",\n", - " \"shape\": [\n", - " 1\n", - " ],\n", - " \"datatype\": \"INT64\",\n", - " \"parameters\": null,\n", - " \"data\": [\n", - " 0\n", - " ]\n", - " }\n", - " ]\n", - "}\n" + "{\r\n", + " \"model_name\": \"iris_1\",\r\n", + " \"model_version\": \"1\",\r\n", + " \"id\": \"b6946102-680d-4b99-b3ec-2488113e8b18\",\r\n", + " \"parameters\": {\r\n", + " \"batch_index\": 1,\r\n", + " \"inference_id\": \"b6946102-680d-4b99-b3ec-2488113e8b18\"\r\n", + " },\r\n", + " \"outputs\": [\r\n", + " {\r\n", + " \"name\": \"predict\",\r\n", + " \"shape\": [\r\n", + " 1,\r\n", + " 1\r\n", + " ],\r\n", + " \"datatype\": \"INT64\",\r\n", + " \"data\": [\r\n", + " 0\r\n", + " ]\r\n", + " }\r\n", + " ]\r\n", + "}\r\n" ] } ], @@ -549,7 +566,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 22, "id": "c14358ae-6206-4f67-84e6-2baa6a54c7db", "metadata": {}, "outputs": [ @@ -557,24 +574,26 @@ "name": "stdout", "output_type": "stream", "text": [ - "\u001b[1;39m{\n", - " \u001b[0m\u001b[34;1m\"model_name\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"\"\u001b[0m\u001b[1;39m,\n", - " \u001b[0m\u001b[34;1m\"outputs\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m[\n", - " \u001b[1;39m{\n", - " \u001b[0m\u001b[34;1m\"data\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m[\n", - " \u001b[0;39m0\u001b[0m\u001b[1;39m\n", - " \u001b[1;39m]\u001b[0m\u001b[1;39m,\n", - " \u001b[0m\u001b[34;1m\"name\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"predict\"\u001b[0m\u001b[1;39m,\n", - " \u001b[0m\u001b[34;1m\"shape\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m[\n", - " \u001b[0;39m1\u001b[0m\u001b[1;39m\n", - " \u001b[1;39m]\u001b[0m\u001b[1;39m,\n", - " \u001b[0m\u001b[34;1m\"datatype\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"INT64\"\u001b[0m\u001b[1;39m\n", - " \u001b[1;39m}\u001b[0m\u001b[1;39m\n", - " \u001b[1;39m]\u001b[0m\u001b[1;39m,\n", - " \u001b[0m\u001b[34;1m\"parameters\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m{\n", - " \u001b[0m\u001b[34;1m\"batch_index\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;39m0\u001b[0m\u001b[1;39m\n", - " \u001b[1;39m}\u001b[0m\u001b[1;39m\n", - "\u001b[1;39m}\u001b[0m\n" + "\u001b[1;39m{\r\n", + " \u001b[0m\u001b[34;1m\"model_name\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"\"\u001b[0m\u001b[1;39m,\r\n", + " \u001b[0m\u001b[34;1m\"id\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"0016feb9-781d-44c9-85ff-da65afd6842f\"\u001b[0m\u001b[1;39m,\r\n", + " \u001b[0m\u001b[34;1m\"parameters\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m{\r\n", + " \u001b[0m\u001b[34;1m\"batch_index\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;39m0\u001b[0m\u001b[1;39m\r\n", + " \u001b[1;39m}\u001b[0m\u001b[1;39m,\r\n", + " \u001b[0m\u001b[34;1m\"outputs\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m[\r\n", + " \u001b[1;39m{\r\n", + " \u001b[0m\u001b[34;1m\"name\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"predict\"\u001b[0m\u001b[1;39m,\r\n", + " \u001b[0m\u001b[34;1m\"shape\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m[\r\n", + " \u001b[0;39m1\u001b[0m\u001b[1;39m,\r\n", + " \u001b[0;39m1\u001b[0m\u001b[1;39m\r\n", + " \u001b[1;39m]\u001b[0m\u001b[1;39m,\r\n", + " \u001b[0m\u001b[34;1m\"datatype\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"INT64\"\u001b[0m\u001b[1;39m,\r\n", + " \u001b[0m\u001b[34;1m\"data\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m[\r\n", + " \u001b[0;39m0\u001b[0m\u001b[1;39m\r\n", + " \u001b[1;39m]\u001b[0m\u001b[1;39m\r\n", + " \u001b[1;39m}\u001b[0m\u001b[1;39m\r\n", + " \u001b[1;39m]\u001b[0m\u001b[1;39m\r\n", + "\u001b[1;39m}\u001b[0m\r\n" ] } ], @@ -592,7 +611,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 23, "id": "5ae725ef-bf07-42f7-8c57-d4e99ae99a87", "metadata": {}, "outputs": [ @@ -600,62 +619,62 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\n", - " \"inputs\": [\n", - " {\n", - " \"name\": \"INPUT0\",\n", - " \"data\": [\n", - " 75,\n", - " 39,\n", - " 9,\n", - " 44,\n", - " 32,\n", - " 97,\n", - " 99,\n", - " 40,\n", - " 13,\n", - " 27,\n", - " 25,\n", - " 36,\n", - " 18,\n", - " 77,\n", - " 62,\n", - " 60\n", - " ],\n", - " \"datatype\": \"INT32\",\n", - " \"shape\": [\n", - " 1,\n", - " 16\n", - " ]\n", - " },\n", - " {\n", - " \"name\": \"INPUT1\",\n", - " \"data\": [\n", - " 39,\n", - " 7,\n", - " 14,\n", - " 58,\n", - " 13,\n", - " 88,\n", - " 98,\n", - " 66,\n", - " 97,\n", - " 57,\n", - " 49,\n", - " 3,\n", - " 49,\n", - " 63,\n", - " 37,\n", - " 12\n", - " ],\n", - " \"datatype\": \"INT32\",\n", - " \"shape\": [\n", - " 1,\n", - " 16\n", - " ]\n", - " }\n", - " ]\n", - "}\n" + "{\r\n", + " \"inputs\": [\r\n", + " {\r\n", + " \"name\": \"INPUT0\",\r\n", + " \"data\": [\r\n", + " 75,\r\n", + " 39,\r\n", + " 9,\r\n", + " 44,\r\n", + " 32,\r\n", + " 97,\r\n", + " 99,\r\n", + " 40,\r\n", + " 13,\r\n", + " 27,\r\n", + " 25,\r\n", + " 36,\r\n", + " 18,\r\n", + " 77,\r\n", + " 62,\r\n", + " 60\r\n", + " ],\r\n", + " \"datatype\": \"INT32\",\r\n", + " \"shape\": [\r\n", + " 1,\r\n", + " 16\r\n", + " ]\r\n", + " },\r\n", + " {\r\n", + " \"name\": \"INPUT1\",\r\n", + " \"data\": [\r\n", + " 39,\r\n", + " 7,\r\n", + " 14,\r\n", + " 58,\r\n", + " 13,\r\n", + " 88,\r\n", + " 98,\r\n", + " 66,\r\n", + " 97,\r\n", + " 57,\r\n", + " 49,\r\n", + " 3,\r\n", + " 49,\r\n", + " 63,\r\n", + " 37,\r\n", + " 12\r\n", + " ],\r\n", + " \"datatype\": \"INT32\",\r\n", + " \"shape\": [\r\n", + " 1,\r\n", + " 16\r\n", + " ]\r\n", + " }\r\n", + " ]\r\n", + "}\r\n" ] } ], @@ -665,7 +684,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 24, "id": "5c5f360a-0c2c-4759-b30d-6e907aa5c75e", "metadata": {}, "outputs": [ @@ -673,22 +692,32 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-10-10 10:12:55,454 [mlserver] INFO - Using asyncio event-loop policy: uvloop\n", - "2022-10-10 10:12:55,457 [mlserver] INFO - Server url: 172.19.255.12\n", - "2022-10-10 10:12:55,457 [mlserver] INFO - input file path: batch-inputs/tfsimple-input.txt\n", - "2022-10-10 10:12:55,457 [mlserver] INFO - output file path: /tmp/tfsimple-output.txt\n", - "2022-10-10 10:12:55,628 [mlserver] INFO - Time taken: 0.17 seconds\n" + "2022-11-16 18:26:08,522 [mlserver] INFO - Using asyncio event-loop policy: uvloop\n", + "2022-11-16 18:26:08,523 [mlserver] INFO - server url: 172.19.255.1\n", + "2022-11-16 18:26:08,523 [mlserver] INFO - model name: tfsimple1\n", + "2022-11-16 18:26:08,523 [mlserver] INFO - request headers: {}\n", + "2022-11-16 18:26:08,523 [mlserver] INFO - input file path: batch-inputs/tfsimple-input.txt\n", + "2022-11-16 18:26:08,523 [mlserver] INFO - output file path: /tmp/tfsimple-output.txt\n", + "2022-11-16 18:26:08,523 [mlserver] INFO - workers: 5\n", + "2022-11-16 18:26:08,523 [mlserver] INFO - retries: 3\n", + "2022-11-16 18:26:08,523 [mlserver] INFO - batch interval: 0.0\n", + "2022-11-16 18:26:08,523 [mlserver] INFO - batch jitter: 0.0\n", + "2022-11-16 18:26:08,523 [mlserver] INFO - connection timeout: 60\n", + "2022-11-16 18:26:08,523 [mlserver] INFO - micro-batch size: 1\n", + "2022-11-16 18:26:08,620 [mlserver] INFO - Finalizer: processed instances: 100\n", + "2022-11-16 18:26:08,620 [mlserver] INFO - Total processed instances: 100\n", + "2022-11-16 18:26:08,620 [mlserver] INFO - Time taken: 0.10 seconds\n" ] } ], "source": [ "%%bash\n", - "mlserver infer -u ${MESH_IP} -m tfsimple -i batch-inputs/tfsimple-input.txt -o /tmp/tfsimple-output.txt --workers 5 -b" + "mlserver infer -u ${MESH_IP} -m tfsimple1 -i batch-inputs/tfsimple-input.txt -o /tmp/tfsimple-output.txt --workers 5 -b" ] }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 25, "id": "753bc0ad-2fa0-47d8-a5cc-428cba326806", "metadata": {}, "outputs": [ @@ -696,22 +725,32 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-10-10 10:12:57,269 [mlserver] INFO - Using asyncio event-loop policy: uvloop\n", - "2022-10-10 10:12:57,273 [mlserver] INFO - Server url: 172.19.255.12\n", - "2022-10-10 10:12:57,273 [mlserver] INFO - input file path: batch-inputs/tfsimple-input.txt\n", - "2022-10-10 10:12:57,273 [mlserver] INFO - output file path: /tmp/tfsimple-pipeline-output.txt\n", - "2022-10-10 10:12:57,592 [mlserver] INFO - Time taken: 0.32 seconds\n" + "2022-11-16 18:26:48,819 [mlserver] INFO - Using asyncio event-loop policy: uvloop\n", + "2022-11-16 18:26:48,820 [mlserver] INFO - server url: 172.19.255.1\n", + "2022-11-16 18:26:48,820 [mlserver] INFO - model name: tfsimple.pipeline\n", + "2022-11-16 18:26:48,820 [mlserver] INFO - request headers: {}\n", + "2022-11-16 18:26:48,820 [mlserver] INFO - input file path: batch-inputs/tfsimple-input.txt\n", + "2022-11-16 18:26:48,820 [mlserver] INFO - output file path: /tmp/tfsimple-pipeline-output.txt\n", + "2022-11-16 18:26:48,820 [mlserver] INFO - workers: 5\n", + "2022-11-16 18:26:48,820 [mlserver] INFO - retries: 3\n", + "2022-11-16 18:26:48,820 [mlserver] INFO - batch interval: 0.0\n", + "2022-11-16 18:26:48,820 [mlserver] INFO - batch jitter: 0.0\n", + "2022-11-16 18:26:48,820 [mlserver] INFO - connection timeout: 60\n", + "2022-11-16 18:26:48,820 [mlserver] INFO - micro-batch size: 1\n", + "2022-11-16 18:26:49,110 [mlserver] INFO - Finalizer: processed instances: 100\n", + "2022-11-16 18:26:49,110 [mlserver] INFO - Total processed instances: 100\n", + "2022-11-16 18:26:49,111 [mlserver] INFO - Time taken: 0.29 seconds\n" ] } ], "source": [ "%%bash\n", - "mlserver infer -u ${MESH_IP} -m tfsimple-pipeline.pipeline -i batch-inputs/tfsimple-input.txt -o /tmp/tfsimple-pipeline-output.txt --workers 5" + "mlserver infer -u ${MESH_IP} -m tfsimple.pipeline -i batch-inputs/tfsimple-input.txt -o /tmp/tfsimple-pipeline-output.txt --workers 5" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 26, "id": "0f8a3641-c8a3-41c5-af4b-2647655fb10d", "metadata": {}, "outputs": [ @@ -719,70 +758,71 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\n", - " \"id\": \"ac7e8eb2-3e13-4b8d-9e9d-9633b12964c3\",\n", - " \"model_name\": \"tfsimple_1\",\n", - " \"model_version\": \"1\",\n", - " \"outputs\": [\n", - " {\n", - " \"name\": \"OUTPUT0\",\n", - " \"datatype\": \"INT32\",\n", - " \"shape\": [\n", - " 1,\n", - " 16\n", - " ],\n", - " \"parameters\": {},\n", - " \"data\": [\n", - " 114,\n", - " 46,\n", - " 23,\n", - " 102,\n", - " 45,\n", - " 185,\n", - " 197,\n", - " 106,\n", - " 110,\n", - " 84,\n", - " 74,\n", - " 39,\n", - " 67,\n", - " 140,\n", - " 99,\n", - " 72\n", - " ]\n", - " },\n", - " {\n", - " \"name\": \"OUTPUT1\",\n", - " \"datatype\": \"INT32\",\n", - " \"shape\": [\n", - " 1,\n", - " 16\n", - " ],\n", - " \"parameters\": {},\n", - " \"data\": [\n", - " 36,\n", - " 32,\n", - " -5,\n", - " -14,\n", - " 19,\n", - " 9,\n", - " 1,\n", - " -26,\n", - " -84,\n", - " -30,\n", - " -24,\n", - " 33,\n", - " -31,\n", - " 14,\n", - " 25,\n", - " 48\n", - " ]\n", - " }\n", - " ],\n", - " \"parameters\": {\n", - " \"batch_index\": 0\n", - " }\n", - "}\n" + "{\r\n", + " \"model_name\": \"tfsimple1_1\",\r\n", + " \"model_version\": \"1\",\r\n", + " \"id\": \"c472917d-de5a-4d45-909b-1ed5f939ea23\",\r\n", + " \"parameters\": {\r\n", + " \"batch_index\": 0,\r\n", + " \"inference_id\": \"c472917d-de5a-4d45-909b-1ed5f939ea23\"\r\n", + " },\r\n", + " \"outputs\": [\r\n", + " {\r\n", + " \"name\": \"OUTPUT0\",\r\n", + " \"shape\": [\r\n", + " 1,\r\n", + " 16\r\n", + " ],\r\n", + " \"datatype\": \"INT32\",\r\n", + " \"parameters\": {},\r\n", + " \"data\": [\r\n", + " 114,\r\n", + " 46,\r\n", + " 23,\r\n", + " 102,\r\n", + " 45,\r\n", + " 185,\r\n", + " 197,\r\n", + " 106,\r\n", + " 110,\r\n", + " 84,\r\n", + " 74,\r\n", + " 39,\r\n", + " 67,\r\n", + " 140,\r\n", + " 99,\r\n", + " 72\r\n", + " ]\r\n", + " },\r\n", + " {\r\n", + " \"name\": \"OUTPUT1\",\r\n", + " \"shape\": [\r\n", + " 1,\r\n", + " 16\r\n", + " ],\r\n", + " \"datatype\": \"INT32\",\r\n", + " \"parameters\": {},\r\n", + " \"data\": [\r\n", + " 36,\r\n", + " 32,\r\n", + " -5,\r\n", + " -14,\r\n", + " 19,\r\n", + " 9,\r\n", + " 1,\r\n", + " -26,\r\n", + " -84,\r\n", + " -30,\r\n", + " -24,\r\n", + " 33,\r\n", + " -31,\r\n", + " 14,\r\n", + " 25,\r\n", + " 48\r\n", + " ]\r\n", + " }\r\n", + " ]\r\n", + "}\r\n" ] } ], @@ -792,7 +832,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 27, "id": "d17f03fa-08bc-42aa-95e8-8427e609e045", "metadata": {}, "outputs": [ @@ -800,66 +840,67 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\n", - " \"model_name\": \"\",\n", - " \"outputs\": [\n", - " {\n", - " \"data\": [\n", - " 63,\n", - " 75,\n", - " 152,\n", - " 77,\n", - " 159,\n", - " 124,\n", - " 92,\n", - " 42,\n", - " 93,\n", - " 155,\n", - " 101,\n", - " 151,\n", - " 103,\n", - " 109,\n", - " 139,\n", - " 105\n", - " ],\n", - " \"name\": \"OUTPUT0\",\n", - " \"shape\": [\n", - " 1,\n", - " 16\n", - " ],\n", - " \"datatype\": \"INT32\"\n", - " },\n", - " {\n", - " \"data\": [\n", - " 13,\n", - " -21,\n", - " 14,\n", - " 39,\n", - " 33,\n", - " 38,\n", - " -42,\n", - " -26,\n", - " -33,\n", - " -37,\n", - " -31,\n", - " -47,\n", - " -41,\n", - " 75,\n", - " 57,\n", - " 37\n", - " ],\n", - " \"name\": \"OUTPUT1\",\n", - " \"shape\": [\n", - " 1,\n", - " 16\n", - " ],\n", - " \"datatype\": \"INT32\"\n", - " }\n", - " ],\n", - " \"parameters\": {\n", - " \"batch_index\": 4\n", - " }\n", - "}\n" + "{\r\n", + " \"model_name\": \"\",\r\n", + " \"id\": \"1cee209f-be47-401b-b7e7-5ce5e5c78b40\",\r\n", + " \"parameters\": {\r\n", + " \"batch_index\": 1\r\n", + " },\r\n", + " \"outputs\": [\r\n", + " {\r\n", + " \"name\": \"OUTPUT0\",\r\n", + " \"shape\": [\r\n", + " 1,\r\n", + " 16\r\n", + " ],\r\n", + " \"datatype\": \"INT32\",\r\n", + " \"data\": [\r\n", + " 115,\r\n", + " 69,\r\n", + " 97,\r\n", + " 112,\r\n", + " 73,\r\n", + " 106,\r\n", + " 58,\r\n", + " 182,\r\n", + " 114,\r\n", + " 66,\r\n", + " 64,\r\n", + " 110,\r\n", + " 100,\r\n", + " 24,\r\n", + " 22,\r\n", + " 77\r\n", + " ]\r\n", + " },\r\n", + " {\r\n", + " \"name\": \"OUTPUT1\",\r\n", + " \"shape\": [\r\n", + " 1,\r\n", + " 16\r\n", + " ],\r\n", + " \"datatype\": \"INT32\",\r\n", + " \"data\": [\r\n", + " -77,\r\n", + " 33,\r\n", + " 25,\r\n", + " -52,\r\n", + " -49,\r\n", + " -88,\r\n", + " -48,\r\n", + " 0,\r\n", + " -50,\r\n", + " 26,\r\n", + " -44,\r\n", + " 46,\r\n", + " -2,\r\n", + " 18,\r\n", + " -6,\r\n", + " -47\r\n", + " ]\r\n", + " }\r\n", + " ]\r\n", + "}\r\n" ] } ], @@ -877,7 +918,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 28, "id": "b8d20578-5e4a-445a-a947-f09c8327033c", "metadata": {}, "outputs": [ @@ -897,7 +938,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 29, "id": "5de7287b-577f-409f-af56-03aac9ec1f2d", "metadata": {}, "outputs": [ @@ -914,13 +955,21 @@ "!kubectl delete -f models/tfsimple1.yaml -n ${NAMESPACE}\n", "!kubectl delete -f pipelines/tfsimple.yaml -n ${NAMESPACE}" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "91bcec77", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "mlserver-dev", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "mlserver-dev" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -932,7 +981,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/samples/k8s-batch-examples.md b/samples/k8s-batch-examples.md index 20e94547f9..d677d567b7 100644 --- a/samples/k8s-batch-examples.md +++ b/samples/k8s-batch-examples.md @@ -3,7 +3,7 @@ ```python import os -os.environ["NAMESPACE"] = "seldon" +os.environ["NAMESPACE"] = "seldon-mesh" ``` @@ -18,7 +18,7 @@ MESH_IP - '172.19.255.12' + '172.19.255.1' @@ -29,15 +29,15 @@ MESH_IP !cat models/sklearn-iris-gs.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Model - metadata: - name: iris - spec: - storageUri: "gs://seldon-models/mlserver/iris" - requirements: - - sklearn - memory: 100Ki + apiVersion: mlops.seldon.io/v1alpha1 + kind: Model + metadata: + name: iris + spec: + storageUri: "gs://seldon-models/mlserver/iris" + requirements: + - sklearn + memory: 100Ki @@ -45,16 +45,16 @@ MESH_IP !cat pipelines/iris.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Pipeline - metadata: - name: iris-pipeline - spec: - steps: - - name: iris - output: - steps: - - iris + apiVersion: mlops.seldon.io/v1alpha1 + kind: Pipeline + metadata: + name: iris-pipeline + spec: + steps: + - name: iris + output: + steps: + - iris @@ -62,15 +62,15 @@ MESH_IP !cat models/tfsimple1.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Model - metadata: - name: tfsimple1 - spec: - storageUri: "gs://seldon-models/triton/simple" - requirements: - - tensorflow - memory: 100Ki + apiVersion: mlops.seldon.io/v1alpha1 + kind: Model + metadata: + name: tfsimple1 + spec: + storageUri: "gs://seldon-models/triton/simple" + requirements: + - tensorflow + memory: 100Ki @@ -78,16 +78,16 @@ MESH_IP !cat pipelines/tfsimple.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Pipeline - metadata: - name: tfsimple - spec: - steps: - - name: tfsimple1 - output: - steps: - - tfsimple1 + apiVersion: mlops.seldon.io/v1alpha1 + kind: Pipeline + metadata: + name: tfsimple + spec: + steps: + - name: tfsimple1 + output: + steps: + - tfsimple1 @@ -115,11 +115,9 @@ MESH_IP ``` model.mlops.seldon.io/iris condition met - model.mlops.seldon.io/tfsimple condition met model.mlops.seldon.io/tfsimple1 condition met pipeline.mlops.seldon.io/iris-pipeline condition met pipeline.mlops.seldon.io/tfsimple condition met - pipeline.mlops.seldon.io/tfsimple-pipeline condition met model.mlops.seldon.io/tfsimple1 condition met pipeline.mlops.seldon.io/tfsimple condition met @@ -132,28 +130,28 @@ MESH_IP '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' | jq -M . ``` - { - "model_name": "iris_1", - "model_version": "1", - "id": "3e60ef91-4422-4989-85c6-05d54a0c7473", - "parameters": { - "content_type": null, - "headers": null - }, - "outputs": [ - { - "name": "predict", - "shape": [ - 1 - ], - "datatype": "INT64", - "parameters": null, - "data": [ - 2 - ] - } - ] - } + { + "model_name": "iris_1", + "model_version": "1", + "id": "a67233c2-2f8c-4fbc-a87e-4e4d3d034c9f", + "parameters": { + "content_type": null, + "headers": null + }, + "outputs": [ + { + "name": "predict", + "shape": [ + 1 + ], + "datatype": "INT64", + "parameters": null, + "data": [ + 2 + ] + } + ] + } @@ -162,126 +160,126 @@ MESH_IP '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' | jq -M . ``` - { - "model_name": "", - "outputs": [ - { - "data": [ - 2 - ], - "name": "predict", - "shape": [ - 1 - ], - "datatype": "INT64" - } - ] - } + { + "model_name": "", + "outputs": [ + { + "data": [ + 2 + ], + "name": "predict", + "shape": [ + 1 + ], + "datatype": "INT64" + } + ] + } ```python -!seldon model infer tfsimple --inference-host ${MESH_IP}:80 \ +!seldon model infer tfsimple1 --inference-host ${MESH_IP}:80 \ '{"outputs":[{"name":"OUTPUT0"}], "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 . ``` - { - "model_name": "tfsimple_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 - ] - } - ] - } + { + "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 + ] + } + ] + } ```python -!seldon pipeline infer tfsimple-pipeline --inference-host ${MESH_IP}:80 \ +!seldon pipeline infer tfsimple --inference-host ${MESH_IP}:80 \ '{"outputs":[{"name":"OUTPUT0"}], "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 . ``` - { - "model_name": "", - "outputs": [ - { - "data": [ - 2, - 4, - 6, - 8, - 10, - 12, - 14, - 16, - 18, - 20, - 22, - 24, - 26, - 28, - 30, - 32 - ], - "name": "OUTPUT0", - "shape": [ - 1, - 16 - ], - "datatype": "INT32" - }, - { - "data": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "name": "OUTPUT1", - "shape": [ - 1, - 16 - ], - "datatype": "INT32" - } - ] - } + { + "model_name": "", + "outputs": [ + { + "data": [ + 2, + 4, + 6, + 8, + 10, + 12, + 14, + 16, + 18, + 20, + 22, + 24, + 26, + 28, + 30, + 32 + ], + "name": "OUTPUT0", + "shape": [ + 1, + 16 + ], + "datatype": "INT32" + }, + { + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "name": "OUTPUT1", + "shape": [ + 1, + 16 + ], + "datatype": "INT32" + } + ] + } ## MLServer Iris Batch Job @@ -291,24 +289,24 @@ MESH_IP !cat batch-inputs/iris-input.txt | head -n 1 | jq -M . ``` - { - "inputs": [ - { - "name": "predict", - "data": [ - 0.38606369295833043, - 0.006894049558299753, - 0.6104082981607108, - 0.3958954239450676 - ], - "datatype": "FP64", - "shape": [ - 1, - 4 - ] - } - ] - } + { + "inputs": [ + { + "name": "predict", + "data": [ + 0.38606369295833043, + 0.006894049558299753, + 0.6104082981607108, + 0.3958954239450676 + ], + "datatype": "FP64", + "shape": [ + 1, + 4 + ] + } + ] + } @@ -317,11 +315,21 @@ MESH_IP mlserver infer -u ${MESH_IP} -m iris -i batch-inputs/iris-input.txt -o /tmp/iris-output.txt --workers 5 ``` - 2022-10-10 10:12:51,214 [mlserver] INFO - Using asyncio event-loop policy: uvloop - 2022-10-10 10:12:51,217 [mlserver] INFO - Server url: 172.19.255.12 - 2022-10-10 10:12:51,217 [mlserver] INFO - input file path: batch-inputs/iris-input.txt - 2022-10-10 10:12:51,217 [mlserver] INFO - output file path: /tmp/iris-output.txt - 2022-10-10 10:12:51,408 [mlserver] INFO - Time taken: 0.19 seconds + 2022-11-16 18:24:17,272 [mlserver] INFO - Using asyncio event-loop policy: uvloop + 2022-11-16 18:24:17,273 [mlserver] INFO - server url: 172.19.255.1 + 2022-11-16 18:24:17,273 [mlserver] INFO - model name: iris + 2022-11-16 18:24:17,273 [mlserver] INFO - request headers: {} + 2022-11-16 18:24:17,273 [mlserver] INFO - input file path: batch-inputs/iris-input.txt + 2022-11-16 18:24:17,273 [mlserver] INFO - output file path: /tmp/iris-output.txt + 2022-11-16 18:24:17,273 [mlserver] INFO - workers: 5 + 2022-11-16 18:24:17,273 [mlserver] INFO - retries: 3 + 2022-11-16 18:24:17,273 [mlserver] INFO - batch interval: 0.0 + 2022-11-16 18:24:17,274 [mlserver] INFO - batch jitter: 0.0 + 2022-11-16 18:24:17,274 [mlserver] INFO - connection timeout: 60 + 2022-11-16 18:24:17,274 [mlserver] INFO - micro-batch size: 1 + 2022-11-16 18:24:17,420 [mlserver] INFO - Finalizer: processed instances: 100 + 2022-11-16 18:24:17,421 [mlserver] INFO - Total processed instances: 100 + 2022-11-16 18:24:17,421 [mlserver] INFO - Time taken: 0.15 seconds @@ -330,11 +338,21 @@ mlserver infer -u ${MESH_IP} -m iris -i batch-inputs/iris-input.txt -o /tmp/iris mlserver infer -u ${MESH_IP} -m iris-pipeline.pipeline -i batch-inputs/iris-input.txt -o /tmp/iris-pipeline-output.txt --workers 5 ``` - 2022-10-10 10:12:53,067 [mlserver] INFO - Using asyncio event-loop policy: uvloop - 2022-10-10 10:12:53,071 [mlserver] INFO - Server url: 172.19.255.12 - 2022-10-10 10:12:53,071 [mlserver] INFO - input file path: batch-inputs/iris-input.txt - 2022-10-10 10:12:53,071 [mlserver] INFO - output file path: /tmp/iris-pipeline-output.txt - 2022-10-10 10:12:53,374 [mlserver] INFO - Time taken: 0.30 seconds + 2022-11-16 18:25:18,651 [mlserver] INFO - Using asyncio event-loop policy: uvloop + 2022-11-16 18:25:18,653 [mlserver] INFO - server url: 172.19.255.1 + 2022-11-16 18:25:18,653 [mlserver] INFO - model name: iris-pipeline.pipeline + 2022-11-16 18:25:18,653 [mlserver] INFO - request headers: {} + 2022-11-16 18:25:18,653 [mlserver] INFO - input file path: batch-inputs/iris-input.txt + 2022-11-16 18:25:18,653 [mlserver] INFO - output file path: /tmp/iris-pipeline-output.txt + 2022-11-16 18:25:18,653 [mlserver] INFO - workers: 5 + 2022-11-16 18:25:18,653 [mlserver] INFO - retries: 3 + 2022-11-16 18:25:18,653 [mlserver] INFO - batch interval: 0.0 + 2022-11-16 18:25:18,653 [mlserver] INFO - batch jitter: 0.0 + 2022-11-16 18:25:18,653 [mlserver] INFO - connection timeout: 60 + 2022-11-16 18:25:18,653 [mlserver] INFO - micro-batch size: 1 + 2022-11-16 18:25:18,963 [mlserver] INFO - Finalizer: processed instances: 100 + 2022-11-16 18:25:18,963 [mlserver] INFO - Total processed instances: 100 + 2022-11-16 18:25:18,963 [mlserver] INFO - Time taken: 0.31 seconds @@ -342,29 +360,28 @@ mlserver infer -u ${MESH_IP} -m iris-pipeline.pipeline -i batch-inputs/iris-inpu !cat /tmp/iris-output.txt | head -n 1 | jq -M . ``` - { - "model_name": "iris_1", - "model_version": "1", - "id": "75470ffc-e56f-4e41-9b3f-c0b5c236833f", - "parameters": { - "content_type": null, - "headers": null, - "batch_index": 0 - }, - "outputs": [ - { - "name": "predict", - "shape": [ - 1 - ], - "datatype": "INT64", - "parameters": null, - "data": [ - 0 - ] - } - ] - } + { + "model_name": "iris_1", + "model_version": "1", + "id": "b6946102-680d-4b99-b3ec-2488113e8b18", + "parameters": { + "batch_index": 1, + "inference_id": "b6946102-680d-4b99-b3ec-2488113e8b18" + }, + "outputs": [ + { + "name": "predict", + "shape": [ + 1, + 1 + ], + "datatype": "INT64", + "data": [ + 0 + ] + } + ] + } @@ -372,24 +389,26 @@ mlserver infer -u ${MESH_IP} -m iris-pipeline.pipeline -i batch-inputs/iris-inpu !cat /tmp/iris-pipeline-output.txt | head -n 1 | jq . ``` - { - "model_name": "", - "outputs": [ - { - "data": [ - 0 - ], - "name": "predict", - "shape": [ - 1 - ], - "datatype": "INT64" - } - ], - "parameters": { - "batch_index": 0 - } - } + { + "model_name": "", + "id": "0016feb9-781d-44c9-85ff-da65afd6842f", + "parameters": { + "batch_index": 0 + }, + "outputs": [ + { + "name": "predict", + "shape": [ + 1, + 1 + ], + "datatype": "INT64", + "data": [ + 0 + ] + } + ] + } ## Triton TFSimple Batch Job @@ -399,88 +418,108 @@ mlserver infer -u ${MESH_IP} -m iris-pipeline.pipeline -i batch-inputs/iris-inpu !cat batch-inputs/tfsimple-input.txt | head -n 1 | jq -M . ``` - { - "inputs": [ - { - "name": "INPUT0", - "data": [ - 75, - 39, - 9, - 44, - 32, - 97, - 99, - 40, - 13, - 27, - 25, - 36, - 18, - 77, - 62, - 60 - ], - "datatype": "INT32", - "shape": [ - 1, - 16 - ] - }, - { - "name": "INPUT1", - "data": [ - 39, - 7, - 14, - 58, - 13, - 88, - 98, - 66, - 97, - 57, - 49, - 3, - 49, - 63, - 37, - 12 - ], - "datatype": "INT32", - "shape": [ - 1, - 16 - ] - } - ] - } + { + "inputs": [ + { + "name": "INPUT0", + "data": [ + 75, + 39, + 9, + 44, + 32, + 97, + 99, + 40, + 13, + 27, + 25, + 36, + 18, + 77, + 62, + 60 + ], + "datatype": "INT32", + "shape": [ + 1, + 16 + ] + }, + { + "name": "INPUT1", + "data": [ + 39, + 7, + 14, + 58, + 13, + 88, + 98, + 66, + 97, + 57, + 49, + 3, + 49, + 63, + 37, + 12 + ], + "datatype": "INT32", + "shape": [ + 1, + 16 + ] + } + ] + } ```bash %%bash -mlserver infer -u ${MESH_IP} -m tfsimple -i batch-inputs/tfsimple-input.txt -o /tmp/tfsimple-output.txt --workers 5 -b +mlserver infer -u ${MESH_IP} -m tfsimple1 -i batch-inputs/tfsimple-input.txt -o /tmp/tfsimple-output.txt --workers 5 -b ``` - 2022-10-10 10:12:55,454 [mlserver] INFO - Using asyncio event-loop policy: uvloop - 2022-10-10 10:12:55,457 [mlserver] INFO - Server url: 172.19.255.12 - 2022-10-10 10:12:55,457 [mlserver] INFO - input file path: batch-inputs/tfsimple-input.txt - 2022-10-10 10:12:55,457 [mlserver] INFO - output file path: /tmp/tfsimple-output.txt - 2022-10-10 10:12:55,628 [mlserver] INFO - Time taken: 0.17 seconds + 2022-11-16 18:26:08,522 [mlserver] INFO - Using asyncio event-loop policy: uvloop + 2022-11-16 18:26:08,523 [mlserver] INFO - server url: 172.19.255.1 + 2022-11-16 18:26:08,523 [mlserver] INFO - model name: tfsimple1 + 2022-11-16 18:26:08,523 [mlserver] INFO - request headers: {} + 2022-11-16 18:26:08,523 [mlserver] INFO - input file path: batch-inputs/tfsimple-input.txt + 2022-11-16 18:26:08,523 [mlserver] INFO - output file path: /tmp/tfsimple-output.txt + 2022-11-16 18:26:08,523 [mlserver] INFO - workers: 5 + 2022-11-16 18:26:08,523 [mlserver] INFO - retries: 3 + 2022-11-16 18:26:08,523 [mlserver] INFO - batch interval: 0.0 + 2022-11-16 18:26:08,523 [mlserver] INFO - batch jitter: 0.0 + 2022-11-16 18:26:08,523 [mlserver] INFO - connection timeout: 60 + 2022-11-16 18:26:08,523 [mlserver] INFO - micro-batch size: 1 + 2022-11-16 18:26:08,620 [mlserver] INFO - Finalizer: processed instances: 100 + 2022-11-16 18:26:08,620 [mlserver] INFO - Total processed instances: 100 + 2022-11-16 18:26:08,620 [mlserver] INFO - Time taken: 0.10 seconds ```bash %%bash -mlserver infer -u ${MESH_IP} -m tfsimple-pipeline.pipeline -i batch-inputs/tfsimple-input.txt -o /tmp/tfsimple-pipeline-output.txt --workers 5 +mlserver infer -u ${MESH_IP} -m tfsimple.pipeline -i batch-inputs/tfsimple-input.txt -o /tmp/tfsimple-pipeline-output.txt --workers 5 ``` - 2022-10-10 10:12:57,269 [mlserver] INFO - Using asyncio event-loop policy: uvloop - 2022-10-10 10:12:57,273 [mlserver] INFO - Server url: 172.19.255.12 - 2022-10-10 10:12:57,273 [mlserver] INFO - input file path: batch-inputs/tfsimple-input.txt - 2022-10-10 10:12:57,273 [mlserver] INFO - output file path: /tmp/tfsimple-pipeline-output.txt - 2022-10-10 10:12:57,592 [mlserver] INFO - Time taken: 0.32 seconds + 2022-11-16 18:26:48,819 [mlserver] INFO - Using asyncio event-loop policy: uvloop + 2022-11-16 18:26:48,820 [mlserver] INFO - server url: 172.19.255.1 + 2022-11-16 18:26:48,820 [mlserver] INFO - model name: tfsimple.pipeline + 2022-11-16 18:26:48,820 [mlserver] INFO - request headers: {} + 2022-11-16 18:26:48,820 [mlserver] INFO - input file path: batch-inputs/tfsimple-input.txt + 2022-11-16 18:26:48,820 [mlserver] INFO - output file path: /tmp/tfsimple-pipeline-output.txt + 2022-11-16 18:26:48,820 [mlserver] INFO - workers: 5 + 2022-11-16 18:26:48,820 [mlserver] INFO - retries: 3 + 2022-11-16 18:26:48,820 [mlserver] INFO - batch interval: 0.0 + 2022-11-16 18:26:48,820 [mlserver] INFO - batch jitter: 0.0 + 2022-11-16 18:26:48,820 [mlserver] INFO - connection timeout: 60 + 2022-11-16 18:26:48,820 [mlserver] INFO - micro-batch size: 1 + 2022-11-16 18:26:49,110 [mlserver] INFO - Finalizer: processed instances: 100 + 2022-11-16 18:26:49,110 [mlserver] INFO - Total processed instances: 100 + 2022-11-16 18:26:49,111 [mlserver] INFO - Time taken: 0.29 seconds @@ -488,70 +527,71 @@ mlserver infer -u ${MESH_IP} -m tfsimple-pipeline.pipeline -i batch-inputs/tfsim !cat /tmp/tfsimple-output.txt | head -n 1 | jq -M . ``` - { - "id": "ac7e8eb2-3e13-4b8d-9e9d-9633b12964c3", - "model_name": "tfsimple_1", - "model_version": "1", - "outputs": [ - { - "name": "OUTPUT0", - "datatype": "INT32", - "shape": [ - 1, - 16 - ], - "parameters": {}, - "data": [ - 114, - 46, - 23, - 102, - 45, - 185, - 197, - 106, - 110, - 84, - 74, - 39, - 67, - 140, - 99, - 72 - ] - }, - { - "name": "OUTPUT1", - "datatype": "INT32", - "shape": [ - 1, - 16 - ], - "parameters": {}, - "data": [ - 36, - 32, - -5, - -14, - 19, - 9, - 1, - -26, - -84, - -30, - -24, - 33, - -31, - 14, - 25, - 48 - ] - } - ], - "parameters": { - "batch_index": 0 - } - } + { + "model_name": "tfsimple1_1", + "model_version": "1", + "id": "c472917d-de5a-4d45-909b-1ed5f939ea23", + "parameters": { + "batch_index": 0, + "inference_id": "c472917d-de5a-4d45-909b-1ed5f939ea23" + }, + "outputs": [ + { + "name": "OUTPUT0", + "shape": [ + 1, + 16 + ], + "datatype": "INT32", + "parameters": {}, + "data": [ + 114, + 46, + 23, + 102, + 45, + 185, + 197, + 106, + 110, + 84, + 74, + 39, + 67, + 140, + 99, + 72 + ] + }, + { + "name": "OUTPUT1", + "shape": [ + 1, + 16 + ], + "datatype": "INT32", + "parameters": {}, + "data": [ + 36, + 32, + -5, + -14, + 19, + 9, + 1, + -26, + -84, + -30, + -24, + 33, + -31, + 14, + 25, + 48 + ] + } + ] + } @@ -559,66 +599,67 @@ mlserver infer -u ${MESH_IP} -m tfsimple-pipeline.pipeline -i batch-inputs/tfsim !cat /tmp/tfsimple-pipeline-output.txt | head -n 1 | jq -M . ``` - { - "model_name": "", - "outputs": [ - { - "data": [ - 63, - 75, - 152, - 77, - 159, - 124, - 92, - 42, - 93, - 155, - 101, - 151, - 103, - 109, - 139, - 105 - ], - "name": "OUTPUT0", - "shape": [ - 1, - 16 - ], - "datatype": "INT32" - }, - { - "data": [ - 13, - -21, - 14, - 39, - 33, - 38, - -42, - -26, - -33, - -37, - -31, - -47, - -41, - 75, - 57, - 37 - ], - "name": "OUTPUT1", - "shape": [ - 1, - 16 - ], - "datatype": "INT32" - } - ], - "parameters": { - "batch_index": 4 - } - } + { + "model_name": "", + "id": "1cee209f-be47-401b-b7e7-5ce5e5c78b40", + "parameters": { + "batch_index": 1 + }, + "outputs": [ + { + "name": "OUTPUT0", + "shape": [ + 1, + 16 + ], + "datatype": "INT32", + "data": [ + 115, + 69, + 97, + 112, + 73, + 106, + 58, + 182, + 114, + 66, + 64, + 110, + 100, + 24, + 22, + 77 + ] + }, + { + "name": "OUTPUT1", + "shape": [ + 1, + 16 + ], + "datatype": "INT32", + "data": [ + -77, + 33, + 25, + -52, + -49, + -88, + -48, + 0, + -50, + 26, + -44, + 46, + -2, + 18, + -6, + -47 + ] + } + ] + } ## Cleanup @@ -642,3 +683,8 @@ mlserver infer -u ${MESH_IP} -m tfsimple-pipeline.pipeline -i batch-inputs/tfsim model.mlops.seldon.io "tfsimple1" deleted pipeline.mlops.seldon.io "tfsimple" deleted + + +```python + +``` diff --git a/samples/k8s-examples.ipynb b/samples/k8s-examples.ipynb index a230c607ab..f7133e57af 100644 --- a/samples/k8s-examples.ipynb +++ b/samples/k8s-examples.ipynb @@ -28,7 +28,7 @@ { "data": { "text/plain": [ - "'172.21.255.9'" + "'172.19.255.1'" ] }, "execution_count": 2, @@ -54,7 +54,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 3, "id": "operating-console", "metadata": {}, "outputs": [ @@ -80,7 +80,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 4, "id": "exempt-bumper", "metadata": { "scrolled": true @@ -100,7 +100,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 5, "id": "beneficial-logan", "metadata": {}, "outputs": [ @@ -118,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 6, "id": "prepared-duration", "metadata": {}, "outputs": [ @@ -129,12 +129,12 @@ "{\r\n", " \"conditions\": [\r\n", " {\r\n", - " \"lastTransitionTime\": \"2022-09-07T14:44:59Z\",\r\n", + " \"lastTransitionTime\": \"2022-11-16T18:11:41Z\",\r\n", " \"status\": \"True\",\r\n", " \"type\": \"ModelReady\"\r\n", " },\r\n", " {\r\n", - " \"lastTransitionTime\": \"2022-09-07T14:44:59Z\",\r\n", + " \"lastTransitionTime\": \"2022-11-16T18:11:41Z\",\r\n", " \"status\": \"True\",\r\n", " \"type\": \"Ready\"\r\n", " }\r\n", @@ -150,7 +150,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 7, "id": "67900afd", "metadata": {}, "outputs": [ @@ -161,7 +161,7 @@ "{\r\n", "\t\"model_name\": \"iris_1\",\r\n", "\t\"model_version\": \"1\",\r\n", - "\t\"id\": \"06c8b42d-820d-42b2-b054-7d7669ca9421\",\r\n", + "\t\"id\": \"de1b3d19-3fcb-4865-b59b-615a5b5f1e69\",\r\n", "\t\"parameters\": {\r\n", "\t\t\"content_type\": null,\r\n", "\t\t\"headers\": null\r\n", @@ -190,7 +190,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 8, "id": "a1848c7d", "metadata": {}, "outputs": [ @@ -226,7 +226,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 9, "id": "attended-vanilla", "metadata": { "scrolled": true @@ -239,12 +239,12 @@ "{\r\n", " \"conditions\": [\r\n", " {\r\n", - " \"lastTransitionTime\": \"2022-09-07T14:44:26Z\",\r\n", + " \"lastTransitionTime\": \"2022-11-16T18:06:01Z\",\r\n", " \"status\": \"True\",\r\n", " \"type\": \"Ready\"\r\n", " },\r\n", " {\r\n", - " \"lastTransitionTime\": \"2022-09-07T14:44:26Z\",\r\n", + " \"lastTransitionTime\": \"2022-11-16T18:06:01Z\",\r\n", " \"reason\": \"StatefulSet replicas matches desired replicas\",\r\n", " \"status\": \"True\",\r\n", " \"type\": \"StatefulSetReady\"\r\n", @@ -261,7 +261,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 10, "id": "precious-development", "metadata": {}, "outputs": [ @@ -287,7 +287,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 11, "id": "daily-stretch", "metadata": {}, "outputs": [ @@ -312,7 +312,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 12, "id": "experienced-egypt", "metadata": {}, "outputs": [ @@ -337,7 +337,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 13, "id": "utility-sweden", "metadata": {}, "outputs": [ @@ -357,7 +357,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 14, "id": "african-blair", "metadata": {}, "outputs": [ @@ -365,8 +365,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "model.mlops.seldon.io/iris condition met\r\n", - "model.mlops.seldon.io/iris2 condition met\r\n" + "model.mlops.seldon.io/iris condition met\n", + "model.mlops.seldon.io/iris2 condition met\n" ] } ], @@ -376,7 +376,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 15, "id": "trained-steering", "metadata": {}, "outputs": [ @@ -391,9 +391,9 @@ "spec:\r\n", " default: iris\r\n", " candidates:\r\n", - " - modelName: iris\r\n", + " - name: iris\r\n", " weight: 50\r\n", - " - modelName: iris2\r\n", + " - name: iris2\r\n", " weight: 50\r\n" ] } @@ -404,7 +404,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 16, "id": "saving-links", "metadata": {}, "outputs": [ @@ -422,7 +422,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 17, "id": "finnish-rider", "metadata": {}, "outputs": [ @@ -440,7 +440,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 18, "id": "effective-athens", "metadata": {}, "outputs": [ @@ -448,7 +448,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::25 :iris_1::25]\r\n" + "Success: map[:iris2_1::27 :iris_1::23]\r\n" ] } ], @@ -459,7 +459,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 19, "id": "widespread-middle", "metadata": {}, "outputs": [ @@ -489,7 +489,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 20, "id": "1b1f0a00", "metadata": {}, "outputs": [ @@ -525,7 +525,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 28, "id": "776122d9", "metadata": {}, "outputs": [ @@ -545,7 +545,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 29, "id": "2499e435", "metadata": {}, "outputs": [ @@ -553,8 +553,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "model.mlops.seldon.io/tfsimple1 condition met\r\n", - "model.mlops.seldon.io/tfsimple2 condition met\r\n" + "model.mlops.seldon.io/tfsimple1 condition met\n", + "model.mlops.seldon.io/tfsimple2 condition met\n" ] } ], @@ -564,7 +564,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 30, "id": "70c78cee", "metadata": {}, "outputs": [ @@ -597,7 +597,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 31, "id": "69033959", "metadata": {}, "outputs": [ @@ -615,7 +615,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 32, "id": "1d6f2f47", "metadata": {}, "outputs": [ @@ -633,7 +633,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 33, "id": "6fb5a35c", "metadata": {}, "outputs": [ @@ -699,10 +699,6 @@ " ]\r\n", " }\r\n", " }\r\n", - " ],\r\n", - " \"rawOutputContents\": [\r\n", - " \"AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==\",\r\n", - " \"AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==\"\r\n", " ]\r\n", "}\r\n" ] @@ -715,7 +711,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 34, "id": "2487f322", "metadata": {}, "outputs": [ @@ -733,7 +729,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 35, "id": "58f3b20c", "metadata": {}, "outputs": [ @@ -761,7 +757,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 36, "id": "f3c791fc", "metadata": {}, "outputs": [ @@ -807,7 +803,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 37, "id": "779ebd6b", "metadata": {}, "outputs": [ @@ -829,7 +825,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 38, "id": "79a7088d", "metadata": {}, "outputs": [ @@ -837,9 +833,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "model.mlops.seldon.io/tfsimple1 condition met\r\n", - "model.mlops.seldon.io/tfsimple2 condition met\r\n", - "model.mlops.seldon.io/tfsimple3 condition met\r\n" + "model.mlops.seldon.io/tfsimple1 condition met\n", + "model.mlops.seldon.io/tfsimple2 condition met\n", + "model.mlops.seldon.io/tfsimple3 condition met\n" ] } ], @@ -849,7 +845,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 39, "id": "c6a0e53e", "metadata": {}, "outputs": [ @@ -884,7 +880,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 40, "id": "1ff21deb", "metadata": {}, "outputs": [ @@ -902,7 +898,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 41, "id": "9984ebf6", "metadata": {}, "outputs": [ @@ -920,7 +916,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 42, "id": "06c0f069", "metadata": {}, "outputs": [ @@ -986,10 +982,6 @@ " ]\r\n", " }\r\n", " }\r\n", - " ],\r\n", - " \"rawOutputContents\": [\r\n", - " \"AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==\",\r\n", - " \"AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==\"\r\n", " ]\r\n", "}\r\n" ] @@ -1002,7 +994,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 43, "id": "cd63243f", "metadata": {}, "outputs": [ @@ -1020,7 +1012,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 44, "id": "a825bfe6", "metadata": {}, "outputs": [ @@ -1050,7 +1042,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 45, "id": "2c21f9c9", "metadata": {}, "outputs": [ @@ -1075,7 +1067,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 46, "id": "505d06ef", "metadata": {}, "outputs": [ @@ -1093,7 +1085,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 47, "id": "46f83c79", "metadata": {}, "outputs": [ @@ -1111,7 +1103,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 48, "id": "00f5c247", "metadata": {}, "outputs": [ @@ -1122,12 +1114,12 @@ "{\r\n", " \"conditions\": [\r\n", " {\r\n", - " \"lastTransitionTime\": \"2022-08-04T11:59:29Z\",\r\n", + " \"lastTransitionTime\": \"2022-11-16T18:16:34Z\",\r\n", " \"status\": \"True\",\r\n", " \"type\": \"ModelReady\"\r\n", " },\r\n", " {\r\n", - " \"lastTransitionTime\": \"2022-08-04T11:59:29Z\",\r\n", + " \"lastTransitionTime\": \"2022-11-16T18:16:34Z\",\r\n", " \"status\": \"True\",\r\n", " \"type\": \"Ready\"\r\n", " }\r\n", @@ -1143,7 +1135,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 49, "id": "02d28f57", "metadata": {}, "outputs": [ @@ -1154,7 +1146,7 @@ "{\r\n", "\t\"model_name\": \"income_1\",\r\n", "\t\"model_version\": \"1\",\r\n", - "\t\"id\": \"389eebf2-069b-4a4b-8ae1-005402493469\",\r\n", + "\t\"id\": \"11e439cf-c967-44fd-aa13-baefd9c4d407\",\r\n", "\t\"parameters\": {\r\n", "\t\t\"content_type\": null,\r\n", "\t\t\"headers\": null\r\n", @@ -1183,7 +1175,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 50, "id": "52ec12eb", "metadata": {}, "outputs": [ @@ -1209,7 +1201,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 51, "id": "2e028f78", "metadata": {}, "outputs": [ @@ -1227,7 +1219,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 52, "id": "8b8035b5", "metadata": {}, "outputs": [ @@ -1246,7 +1238,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 53, "id": "67489d73", "metadata": {}, "outputs": [ @@ -1257,12 +1249,12 @@ "{\r\n", " \"conditions\": [\r\n", " {\r\n", - " \"lastTransitionTime\": \"2022-08-04T11:59:53Z\",\r\n", + " \"lastTransitionTime\": \"2022-11-16T18:16:51Z\",\r\n", " \"status\": \"True\",\r\n", " \"type\": \"ModelReady\"\r\n", " },\r\n", " {\r\n", - " \"lastTransitionTime\": \"2022-08-04T11:59:53Z\",\r\n", + " \"lastTransitionTime\": \"2022-11-16T18:16:51Z\",\r\n", " \"status\": \"True\",\r\n", " \"type\": \"Ready\"\r\n", " }\r\n", @@ -1278,7 +1270,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 54, "id": "4f6cbcac", "metadata": {}, "outputs": [ @@ -1289,7 +1281,7 @@ "{\r\n", "\t\"model_name\": \"income-explainer_1\",\r\n", "\t\"model_version\": \"1\",\r\n", - "\t\"id\": \"02b6d055-e587-4485-a36c-d09b5830748e\",\r\n", + "\t\"id\": \"7aa0f8ec-a68a-4141-a757-56ebd39f2845\",\r\n", "\t\"parameters\": {\r\n", "\t\t\"content_type\": null,\r\n", "\t\t\"headers\": null\r\n", @@ -1306,7 +1298,7 @@ "\t\t\t\t\"headers\": null\r\n", "\t\t\t},\r\n", "\t\t\t\"data\": [\r\n", - "\t\t\t\t\"{\\\"meta\\\": {\\\"name\\\": \\\"AnchorTabular\\\", \\\"type\\\": [\\\"blackbox\\\"], \\\"explanations\\\": [\\\"local\\\"], \\\"params\\\": {\\\"seed\\\": 1, \\\"disc_perc\\\": [25, 50, 75], \\\"threshold\\\": 0.95, \\\"delta\\\": 0.1, \\\"tau\\\": 0.15, \\\"batch_size\\\": 100, \\\"coverage_samples\\\": 10000, \\\"beam_size\\\": 1, \\\"stop_on_first\\\": false, \\\"max_anchor_size\\\": null, \\\"min_samples_start\\\": 100, \\\"n_covered_ex\\\": 10, \\\"binary_cache_size\\\": 10000, \\\"cache_margin\\\": 1000, \\\"verbose\\\": false, \\\"verbose_every\\\": 1, \\\"kwargs\\\": {}}, \\\"version\\\": \\\"0.7.0\\\"}, \\\"data\\\": {\\\"anchor\\\": [\\\"Marital Status = Never-Married\\\", \\\"Relationship = Own-child\\\", \\\"Capital Gain <= 0.00\\\"], \\\"precision\\\": 0.9938650306748467, \\\"coverage\\\": 0.06853582554517133, \\\"raw\\\": {\\\"feature\\\": [3, 5, 8], \\\"mean\\\": [0.7913148371531966, 0.9178082191780822, 0.9938650306748467], \\\"precision\\\": [0.7913148371531966, 0.9178082191780822, 0.9938650306748467], \\\"coverage\\\": [0.3037383177570093, 0.07165109034267912, 0.06853582554517133], \\\"examples\\\": [{\\\"covered_true\\\": [[66, 0, 1, 1, 0, 0, 4, 1, 0, 0, 6, 9], [36, 2, 1, 1, 5, 1, 4, 0, 0, 0, 60, 9], [40, 4, 1, 1, 8, 0, 4, 1, 0, 0, 75, 9], [42, 4, 1, 1, 6, 4, 4, 1, 0, 0, 45, 0], [49, 2, 5, 1, 5, 0, 4, 1, 0, 0, 40, 9], [37, 4, 1, 1, 5, 0, 4, 1, 0, 0, 55, 9], [61, 4, 5, 1, 6, 0, 4, 1, 3103, 0, 50, 9], [54, 4, 1, 1, 7, 0, 4, 1, 0, 0, 40, 9], [35, 2, 1, 1, 5, 0, 4, 1, 0, 0, 40, 9], [24, 4, 1, 1, 6, 1, 4, 1, 0, 0, 47, 9]], \\\"covered_false\\\": [[38, 6, 5, 1, 5, 0, 2, 1, 99999, 0, 60, 9], [40, 4, 1, 1, 7, 5, 1, 0, 7688, 0, 52, 6], [43, 4, 5, 1, 5, 1, 4, 1, 0, 0, 50, 9], [51, 4, 1, 1, 8, 1, 0, 1, 0, 0, 50, 9], [42, 4, 1, 1, 8, 0, 4, 1, 0, 2415, 60, 9], [22, 4, 1, 1, 5, 1, 0, 0, 14344, 0, 40, 9], [46, 4, 5, 1, 8, 1, 4, 0, 27828, 0, 50, 9], [50, 4, 1, 1, 8, 0, 4, 1, 7298, 0, 50, 9], [43, 1, 1, 1, 8, 1, 4, 1, 0, 0, 40, 9], [56, 6, 5, 1, 2, 0, 4, 1, 0, 0, 50, 9]], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}, {\\\"covered_true\\\": [[36, 4, 1, 1, 6, 3, 4, 1, 0, 1902, 45, 9], [55, 4, 2, 1, 8, 3, 4, 1, 0, 0, 60, 9], [46, 4, 2, 1, 5, 3, 4, 1, 0, 0, 70, 9], [45, 2, 5, 1, 5, 3, 4, 0, 0, 0, 45, 9], [55, 5, 5, 1, 8, 3, 4, 1, 0, 0, 60, 9], [24, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9], [58, 6, 1, 1, 8, 3, 4, 1, 0, 0, 50, 9], [34, 4, 5, 1, 4, 3, 2, 0, 0, 0, 40, 0], [30, 4, 1, 1, 4, 3, 4, 1, 0, 0, 60, 4], [39, 4, 1, 1, 6, 3, 4, 1, 0, 0, 40, 1]], \\\"covered_false\\\": [[45, 2, 1, 1, 2, 3, 1, 1, 7298, 0, 40, 9], [42, 1, 5, 1, 8, 3, 4, 0, 14084, 0, 60, 9], [46, 4, 1, 1, 2, 3, 4, 1, 15024, 0, 40, 9], [36, 4, 5, 1, 8, 3, 4, 1, 15024, 0, 50, 9], [47, 4, 1, 1, 8, 3, 4, 1, 15024, 0, 50, 9], [42, 2, 1, 1, 1, 3, 4, 0, 99999, 0, 40, 9], [55, 4, 5, 1, 5, 3, 4, 1, 15024, 0, 50, 0], [48, 1, 5, 1, 8, 3, 4, 0, 10520, 0, 50, 9]], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}, {\\\"covered_true\\\": [[27, 4, 5, 1, 8, 3, 4, 0, 0, 0, 25, 9], [45, 1, 1, 1, 8, 3, 4, 0, 0, 0, 40, 9], [32, 4, 1, 1, 5, 3, 4, 1, 0, 0, 50, 9], [81, 6, 1, 1, 5, 3, 4, 0, 0, 1668, 3, 4], [44, 2, 1, 1, 5, 3, 4, 1, 0, 0, 50, 9], [44, 7, 5, 1, 8, 3, 4, 1, 0, 0, 40, 9], [41, 4, 1, 1, 5, 3, 4, 1, 0, 0, 40, 9], [48, 7, 2, 1, 5, 3, 4, 1, 0, 0, 50, 9], [32, 4, 1, 1, 6, 3, 4, 1, 0, 0, 40, 9], [68, 4, 5, 1, 5, 3, 4, 1, 0, 0, 18, 0]], \\\"covered_false\\\": [[67, 5, 1, 1, 8, 3, 4, 1, 0, 2392, 75, 9]], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}], \\\"all_precision\\\": 0, \\\"num_preds\\\": 1000000, \\\"success\\\": true, \\\"names\\\": [\\\"Marital Status = Never-Married\\\", \\\"Relationship = Own-child\\\", \\\"Capital Gain <= 0.00\\\"], \\\"prediction\\\": [0], \\\"instance\\\": [47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0], \\\"instances\\\": [[47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0]]}}}\"\r\n", + "\t\t\t\t\"{\\\"meta\\\": {\\\"name\\\": \\\"AnchorTabular\\\", \\\"type\\\": [\\\"blackbox\\\"], \\\"explanations\\\": [\\\"local\\\"], \\\"params\\\": {\\\"seed\\\": 1, \\\"disc_perc\\\": [25, 50, 75], \\\"threshold\\\": 0.95, \\\"delta\\\": 0.1, \\\"tau\\\": 0.15, \\\"batch_size\\\": 100, \\\"coverage_samples\\\": 10000, \\\"beam_size\\\": 1, \\\"stop_on_first\\\": false, \\\"max_anchor_size\\\": null, \\\"min_samples_start\\\": 100, \\\"n_covered_ex\\\": 10, \\\"binary_cache_size\\\": 10000, \\\"cache_margin\\\": 1000, \\\"verbose\\\": false, \\\"verbose_every\\\": 1, \\\"kwargs\\\": {}}, \\\"version\\\": \\\"0.8.0\\\"}, \\\"data\\\": {\\\"anchor\\\": [\\\"Marital Status = Never-Married\\\", \\\"Occupation = Admin\\\", \\\"Capital Gain <= 0.00\\\", \\\"Capital Loss <= 0.00\\\"], \\\"precision\\\": 0.9888392857142857, \\\"coverage\\\": 0.03760569648420116, \\\"raw\\\": {\\\"feature\\\": [3, 4, 8, 9], \\\"mean\\\": [0.7713498622589532, 0.9002217294900222, 0.9636363636363636, 0.9888392857142857], \\\"precision\\\": [0.7713498622589532, 0.9002217294900222, 0.9636363636363636, 0.9888392857142857], \\\"coverage\\\": [0.3037383177570093, 0.040943480195816645, 0.03871829105473965, 0.03760569648420116], \\\"examples\\\": [{\\\"covered_true\\\": [[39, 4, 2, 1, 5, 1, 4, 1, 0, 0, 45, 9], [56, 4, 5, 1, 8, 0, 4, 1, 0, 0, 40, 9], [62, 6, 1, 1, 5, 0, 4, 1, 0, 0, 60, 9], [48, 4, 1, 1, 6, 0, 4, 1, 0, 0, 45, 9], [29, 4, 1, 1, 1, 1, 4, 0, 0, 0, 40, 9], [46, 1, 1, 1, 5, 1, 4, 1, 0, 0, 40, 9], [55, 4, 2, 1, 5, 0, 4, 1, 0, 0, 40, 9], [37, 4, 1, 1, 8, 0, 4, 1, 0, 0, 50, 9], [30, 4, 1, 1, 8, 0, 4, 1, 0, 0, 50, 9], [39, 4, 5, 1, 1, 1, 4, 1, 0, 0, 40, 0]], \\\"covered_false\\\": [[25, 5, 1, 1, 6, 1, 4, 1, 0, 0, 45, 9], [54, 4, 5, 1, 8, 0, 4, 1, 0, 0, 45, 9], [38, 4, 5, 1, 8, 0, 4, 1, 0, 0, 60, 9], [50, 4, 1, 1, 6, 1, 4, 1, 0, 0, 45, 9], [43, 4, 1, 1, 5, 5, 4, 0, 15024, 0, 50, 9], [46, 2, 1, 1, 5, 1, 4, 0, 0, 1408, 40, 9], [42, 4, 1, 1, 4, 0, 4, 1, 7298, 0, 45, 9], [46, 4, 1, 1, 8, 0, 4, 1, 15024, 0, 45, 9], [49, 7, 5, 1, 6, 0, 4, 1, 99999, 0, 80, 9], [47, 4, 1, 1, 8, 0, 4, 1, 0, 0, 60, 9]], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}, {\\\"covered_true\\\": [[46, 4, 1, 1, 1, 0, 4, 1, 0, 0, 35, 9], [49, 7, 2, 1, 1, 4, 4, 1, 0, 0, 50, 9], [45, 4, 1, 1, 1, 5, 1, 0, 5178, 0, 40, 7], [63, 0, 1, 1, 1, 0, 4, 1, 0, 0, 40, 9], [47, 4, 1, 1, 1, 0, 4, 1, 0, 0, 60, 9], [24, 4, 1, 1, 1, 1, 4, 1, 0, 0, 30, 9], [40, 4, 5, 1, 1, 3, 4, 0, 0, 0, 40, 9], [50, 4, 5, 1, 1, 0, 4, 1, 0, 0, 50, 9], [55, 1, 5, 1, 1, 0, 4, 1, 0, 0, 60, 9], [46, 1, 5, 1, 1, 0, 4, 1, 0, 0, 40, 1]], \\\"covered_false\\\": [[63, 4, 1, 1, 1, 5, 4, 0, 7688, 0, 36, 9], [46, 2, 2, 1, 1, 5, 4, 0, 0, 1902, 52, 9], [32, 4, 5, 1, 1, 1, 4, 1, 0, 2824, 55, 9], [56, 4, 1, 1, 1, 0, 4, 1, 5178, 0, 44, 9], [40, 4, 2, 1, 1, 0, 4, 1, 0, 0, 40, 9], [45, 4, 5, 1, 1, 0, 4, 1, 15024, 0, 60, 9], [44, 2, 5, 1, 1, 0, 4, 1, 15024, 0, 35, 9], [58, 4, 1, 1, 1, 0, 4, 1, 7688, 0, 50, 9], [40, 5, 5, 1, 1, 5, 4, 0, 15024, 0, 30, 6]], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}, {\\\"covered_true\\\": [[52, 7, 1, 1, 1, 0, 4, 1, 0, 0, 40, 9], [55, 4, 1, 1, 1, 0, 4, 1, 0, 0, 40, 9], [32, 6, 1, 1, 1, 4, 2, 0, 0, 0, 30, 9], [24, 4, 1, 1, 1, 1, 4, 1, 0, 0, 55, 9], [44, 4, 1, 1, 1, 5, 4, 0, 0, 0, 20, 9], [34, 4, 1, 1, 1, 3, 4, 1, 0, 0, 40, 9], [39, 4, 1, 1, 1, 4, 4, 0, 0, 0, 50, 9], [40, 6, 1, 1, 1, 0, 4, 1, 0, 0, 45, 9], [31, 2, 1, 1, 1, 1, 4, 1, 0, 0, 45, 9], [43, 4, 5, 1, 1, 4, 4, 0, 0, 2547, 40, 9]], \\\"covered_false\\\": [[51, 0, 2, 1, 1, 1, 4, 1, 0, 2824, 40, 9], [46, 4, 2, 1, 1, 0, 4, 1, 0, 2415, 55, 9], [44, 5, 5, 1, 1, 0, 4, 1, 0, 2415, 55, 9], [68, 7, 2, 1, 1, 0, 4, 1, 0, 2377, 60, 9], [61, 7, 2, 1, 1, 0, 4, 1, 0, 0, 40, 0]], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}, {\\\"covered_true\\\": [[47, 4, 1, 1, 1, 0, 4, 1, 0, 0, 40, 8], [32, 4, 1, 1, 1, 3, 4, 0, 0, 0, 40, 9], [38, 1, 5, 1, 1, 0, 4, 1, 0, 0, 40, 6], [31, 4, 1, 1, 1, 1, 4, 0, 0, 0, 42, 9], [37, 4, 1, 1, 1, 0, 4, 1, 0, 0, 45, 9], [47, 4, 1, 1, 1, 0, 4, 1, 0, 0, 50, 9], [22, 7, 1, 1, 1, 0, 4, 1, 0, 0, 20, 9], [66, 4, 1, 1, 1, 0, 4, 1, 0, 0, 99, 9], [23, 4, 1, 1, 1, 3, 2, 1, 0, 0, 10, 9], [40, 4, 1, 1, 1, 0, 4, 1, 0, 0, 45, 9]], \\\"covered_false\\\": [[33, 4, 2, 1, 1, 0, 4, 1, 0, 0, 60, 9], [47, 1, 2, 1, 1, 0, 4, 1, 0, 0, 40, 9], [46, 4, 1, 1, 1, 1, 2, 0, 0, 0, 40, 9], [52, 5, 2, 1, 1, 0, 4, 1, 0, 0, 65, 9]], \\\"uncovered_true\\\": [], \\\"uncovered_false\\\": []}], \\\"all_precision\\\": 0, \\\"num_preds\\\": 1000000, \\\"success\\\": true, \\\"names\\\": [\\\"Marital Status = Never-Married\\\", \\\"Occupation = Admin\\\", \\\"Capital Gain <= 0.00\\\", \\\"Capital Loss <= 0.00\\\"], \\\"prediction\\\": [0], \\\"instance\\\": [47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0], \\\"instances\\\": [[47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0]]}}}\"\r\n", "\t\t\t]\r\n", "\t\t}\r\n", "\t]\r\n", @@ -1321,7 +1313,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 55, "id": "da7f239d", "metadata": {}, "outputs": [ @@ -1573,7 +1565,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/samples/k8s-examples.md b/samples/k8s-examples.md index a0b9b84ca9..5def137024 100644 --- a/samples/k8s-examples.md +++ b/samples/k8s-examples.md @@ -19,7 +19,7 @@ MESH_IP - '172.21.255.9' + '172.19.255.1' @@ -65,12 +65,12 @@ MESH_IP { "conditions": [ { - "lastTransitionTime": "2022-09-07T14:44:59Z", + "lastTransitionTime": "2022-11-16T18:11:41Z", "status": "True", "type": "ModelReady" }, { - "lastTransitionTime": "2022-09-07T14:44:59Z", + "lastTransitionTime": "2022-11-16T18:11:41Z", "status": "True", "type": "Ready" } @@ -88,7 +88,7 @@ MESH_IP { "model_name": "iris_1", "model_version": "1", - "id": "06c8b42d-820d-42b2-b054-7d7669ca9421", + "id": "de1b3d19-3fcb-4865-b59b-615a5b5f1e69", "parameters": { "content_type": null, "headers": null @@ -143,12 +143,12 @@ MESH_IP { "conditions": [ { - "lastTransitionTime": "2022-09-07T14:44:26Z", + "lastTransitionTime": "2022-11-16T18:06:01Z", "status": "True", "type": "Ready" }, { - "lastTransitionTime": "2022-09-07T14:44:26Z", + "lastTransitionTime": "2022-11-16T18:06:01Z", "reason": "StatefulSet replicas matches desired replicas", "status": "True", "type": "StatefulSetReady" @@ -213,8 +213,8 @@ MESH_IP !kubectl wait --for condition=ready --timeout=300s model --all -n ${NAMESPACE} ``` - model.mlops.seldon.io/iris condition met - model.mlops.seldon.io/iris2 condition met + model.mlops.seldon.io/iris condition met + model.mlops.seldon.io/iris2 condition met @@ -229,9 +229,9 @@ MESH_IP spec: default: iris candidates: - - modelName: iris + - name: iris weight: 50 - - modelName: iris2 + - name: iris2 weight: 50 @@ -257,7 +257,7 @@ MESH_IP '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris2_1::25 :iris_1::25] + Success: map[:iris2_1::27 :iris_1::23] @@ -315,8 +315,8 @@ MESH_IP !kubectl wait --for condition=ready --timeout=300s model --all -n ${NAMESPACE} ``` - model.mlops.seldon.io/tfsimple1 condition met - model.mlops.seldon.io/tfsimple2 condition met + model.mlops.seldon.io/tfsimple1 condition met + model.mlops.seldon.io/tfsimple2 condition met @@ -422,10 +422,6 @@ MESH_IP ] } } - ], - "rawOutputContents": [ - "AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==", - "AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==" ] } @@ -503,9 +499,9 @@ MESH_IP !kubectl wait --for condition=ready --timeout=300s model --all -n ${NAMESPACE} ``` - model.mlops.seldon.io/tfsimple1 condition met - model.mlops.seldon.io/tfsimple2 condition met - model.mlops.seldon.io/tfsimple3 condition met + model.mlops.seldon.io/tfsimple1 condition met + model.mlops.seldon.io/tfsimple2 condition met + model.mlops.seldon.io/tfsimple3 condition met @@ -613,10 +609,6 @@ MESH_IP ] } } - ], - "rawOutputContents": [ - "AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==", - "AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==" ] } @@ -682,12 +674,12 @@ MESH_IP { "conditions": [ { - "lastTransitionTime": "2022-08-04T11:59:29Z", + "lastTransitionTime": "2022-11-16T18:16:34Z", "status": "True", "type": "ModelReady" }, { - "lastTransitionTime": "2022-08-04T11:59:29Z", + "lastTransitionTime": "2022-11-16T18:16:34Z", "status": "True", "type": "Ready" } @@ -705,7 +697,7 @@ MESH_IP { "model_name": "income_1", "model_version": "1", - "id": "389eebf2-069b-4a4b-8ae1-005402493469", + "id": "11e439cf-c967-44fd-aa13-baefd9c4d407", "parameters": { "content_type": null, "headers": null @@ -767,12 +759,12 @@ MESH_IP { "conditions": [ { - "lastTransitionTime": "2022-08-04T11:59:53Z", + "lastTransitionTime": "2022-11-16T18:16:51Z", "status": "True", "type": "ModelReady" }, { - "lastTransitionTime": "2022-08-04T11:59:53Z", + "lastTransitionTime": "2022-11-16T18:16:51Z", "status": "True", "type": "Ready" } @@ -790,7 +782,7 @@ MESH_IP { "model_name": "income-explainer_1", "model_version": "1", - "id": "02b6d055-e587-4485-a36c-d09b5830748e", + "id": "7aa0f8ec-a68a-4141-a757-56ebd39f2845", "parameters": { "content_type": null, "headers": null @@ -807,7 +799,7 @@ MESH_IP "headers": null }, "data": [ - "{\"meta\": {\"name\": \"AnchorTabular\", \"type\": [\"blackbox\"], \"explanations\": [\"local\"], \"params\": {\"seed\": 1, \"disc_perc\": [25, 50, 75], \"threshold\": 0.95, \"delta\": 0.1, \"tau\": 0.15, \"batch_size\": 100, \"coverage_samples\": 10000, \"beam_size\": 1, \"stop_on_first\": false, \"max_anchor_size\": null, \"min_samples_start\": 100, \"n_covered_ex\": 10, \"binary_cache_size\": 10000, \"cache_margin\": 1000, \"verbose\": false, \"verbose_every\": 1, \"kwargs\": {}}, \"version\": \"0.7.0\"}, \"data\": {\"anchor\": [\"Marital Status = Never-Married\", \"Relationship = Own-child\", \"Capital Gain <= 0.00\"], \"precision\": 0.9938650306748467, \"coverage\": 0.06853582554517133, \"raw\": {\"feature\": [3, 5, 8], \"mean\": [0.7913148371531966, 0.9178082191780822, 0.9938650306748467], \"precision\": [0.7913148371531966, 0.9178082191780822, 0.9938650306748467], \"coverage\": [0.3037383177570093, 0.07165109034267912, 0.06853582554517133], \"examples\": [{\"covered_true\": [[66, 0, 1, 1, 0, 0, 4, 1, 0, 0, 6, 9], [36, 2, 1, 1, 5, 1, 4, 0, 0, 0, 60, 9], [40, 4, 1, 1, 8, 0, 4, 1, 0, 0, 75, 9], [42, 4, 1, 1, 6, 4, 4, 1, 0, 0, 45, 0], [49, 2, 5, 1, 5, 0, 4, 1, 0, 0, 40, 9], [37, 4, 1, 1, 5, 0, 4, 1, 0, 0, 55, 9], [61, 4, 5, 1, 6, 0, 4, 1, 3103, 0, 50, 9], [54, 4, 1, 1, 7, 0, 4, 1, 0, 0, 40, 9], [35, 2, 1, 1, 5, 0, 4, 1, 0, 0, 40, 9], [24, 4, 1, 1, 6, 1, 4, 1, 0, 0, 47, 9]], \"covered_false\": [[38, 6, 5, 1, 5, 0, 2, 1, 99999, 0, 60, 9], [40, 4, 1, 1, 7, 5, 1, 0, 7688, 0, 52, 6], [43, 4, 5, 1, 5, 1, 4, 1, 0, 0, 50, 9], [51, 4, 1, 1, 8, 1, 0, 1, 0, 0, 50, 9], [42, 4, 1, 1, 8, 0, 4, 1, 0, 2415, 60, 9], [22, 4, 1, 1, 5, 1, 0, 0, 14344, 0, 40, 9], [46, 4, 5, 1, 8, 1, 4, 0, 27828, 0, 50, 9], [50, 4, 1, 1, 8, 0, 4, 1, 7298, 0, 50, 9], [43, 1, 1, 1, 8, 1, 4, 1, 0, 0, 40, 9], [56, 6, 5, 1, 2, 0, 4, 1, 0, 0, 50, 9]], \"uncovered_true\": [], \"uncovered_false\": []}, {\"covered_true\": [[36, 4, 1, 1, 6, 3, 4, 1, 0, 1902, 45, 9], [55, 4, 2, 1, 8, 3, 4, 1, 0, 0, 60, 9], [46, 4, 2, 1, 5, 3, 4, 1, 0, 0, 70, 9], [45, 2, 5, 1, 5, 3, 4, 0, 0, 0, 45, 9], [55, 5, 5, 1, 8, 3, 4, 1, 0, 0, 60, 9], [24, 4, 1, 1, 8, 3, 4, 1, 0, 0, 40, 9], [58, 6, 1, 1, 8, 3, 4, 1, 0, 0, 50, 9], [34, 4, 5, 1, 4, 3, 2, 0, 0, 0, 40, 0], [30, 4, 1, 1, 4, 3, 4, 1, 0, 0, 60, 4], [39, 4, 1, 1, 6, 3, 4, 1, 0, 0, 40, 1]], \"covered_false\": [[45, 2, 1, 1, 2, 3, 1, 1, 7298, 0, 40, 9], [42, 1, 5, 1, 8, 3, 4, 0, 14084, 0, 60, 9], [46, 4, 1, 1, 2, 3, 4, 1, 15024, 0, 40, 9], [36, 4, 5, 1, 8, 3, 4, 1, 15024, 0, 50, 9], [47, 4, 1, 1, 8, 3, 4, 1, 15024, 0, 50, 9], [42, 2, 1, 1, 1, 3, 4, 0, 99999, 0, 40, 9], [55, 4, 5, 1, 5, 3, 4, 1, 15024, 0, 50, 0], [48, 1, 5, 1, 8, 3, 4, 0, 10520, 0, 50, 9]], \"uncovered_true\": [], \"uncovered_false\": []}, {\"covered_true\": [[27, 4, 5, 1, 8, 3, 4, 0, 0, 0, 25, 9], [45, 1, 1, 1, 8, 3, 4, 0, 0, 0, 40, 9], [32, 4, 1, 1, 5, 3, 4, 1, 0, 0, 50, 9], [81, 6, 1, 1, 5, 3, 4, 0, 0, 1668, 3, 4], [44, 2, 1, 1, 5, 3, 4, 1, 0, 0, 50, 9], [44, 7, 5, 1, 8, 3, 4, 1, 0, 0, 40, 9], [41, 4, 1, 1, 5, 3, 4, 1, 0, 0, 40, 9], [48, 7, 2, 1, 5, 3, 4, 1, 0, 0, 50, 9], [32, 4, 1, 1, 6, 3, 4, 1, 0, 0, 40, 9], [68, 4, 5, 1, 5, 3, 4, 1, 0, 0, 18, 0]], \"covered_false\": [[67, 5, 1, 1, 8, 3, 4, 1, 0, 2392, 75, 9]], \"uncovered_true\": [], \"uncovered_false\": []}], \"all_precision\": 0, \"num_preds\": 1000000, \"success\": true, \"names\": [\"Marital Status = Never-Married\", \"Relationship = Own-child\", \"Capital Gain <= 0.00\"], \"prediction\": [0], \"instance\": [47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0], \"instances\": [[47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0]]}}}" + "{\"meta\": {\"name\": \"AnchorTabular\", \"type\": [\"blackbox\"], \"explanations\": [\"local\"], \"params\": {\"seed\": 1, \"disc_perc\": [25, 50, 75], \"threshold\": 0.95, \"delta\": 0.1, \"tau\": 0.15, \"batch_size\": 100, \"coverage_samples\": 10000, \"beam_size\": 1, \"stop_on_first\": false, \"max_anchor_size\": null, \"min_samples_start\": 100, \"n_covered_ex\": 10, \"binary_cache_size\": 10000, \"cache_margin\": 1000, \"verbose\": false, \"verbose_every\": 1, \"kwargs\": {}}, \"version\": \"0.8.0\"}, \"data\": {\"anchor\": [\"Marital Status = Never-Married\", \"Occupation = Admin\", \"Capital Gain <= 0.00\", \"Capital Loss <= 0.00\"], \"precision\": 0.9888392857142857, \"coverage\": 0.03760569648420116, \"raw\": {\"feature\": [3, 4, 8, 9], \"mean\": [0.7713498622589532, 0.9002217294900222, 0.9636363636363636, 0.9888392857142857], \"precision\": [0.7713498622589532, 0.9002217294900222, 0.9636363636363636, 0.9888392857142857], \"coverage\": [0.3037383177570093, 0.040943480195816645, 0.03871829105473965, 0.03760569648420116], \"examples\": [{\"covered_true\": [[39, 4, 2, 1, 5, 1, 4, 1, 0, 0, 45, 9], [56, 4, 5, 1, 8, 0, 4, 1, 0, 0, 40, 9], [62, 6, 1, 1, 5, 0, 4, 1, 0, 0, 60, 9], [48, 4, 1, 1, 6, 0, 4, 1, 0, 0, 45, 9], [29, 4, 1, 1, 1, 1, 4, 0, 0, 0, 40, 9], [46, 1, 1, 1, 5, 1, 4, 1, 0, 0, 40, 9], [55, 4, 2, 1, 5, 0, 4, 1, 0, 0, 40, 9], [37, 4, 1, 1, 8, 0, 4, 1, 0, 0, 50, 9], [30, 4, 1, 1, 8, 0, 4, 1, 0, 0, 50, 9], [39, 4, 5, 1, 1, 1, 4, 1, 0, 0, 40, 0]], \"covered_false\": [[25, 5, 1, 1, 6, 1, 4, 1, 0, 0, 45, 9], [54, 4, 5, 1, 8, 0, 4, 1, 0, 0, 45, 9], [38, 4, 5, 1, 8, 0, 4, 1, 0, 0, 60, 9], [50, 4, 1, 1, 6, 1, 4, 1, 0, 0, 45, 9], [43, 4, 1, 1, 5, 5, 4, 0, 15024, 0, 50, 9], [46, 2, 1, 1, 5, 1, 4, 0, 0, 1408, 40, 9], [42, 4, 1, 1, 4, 0, 4, 1, 7298, 0, 45, 9], [46, 4, 1, 1, 8, 0, 4, 1, 15024, 0, 45, 9], [49, 7, 5, 1, 6, 0, 4, 1, 99999, 0, 80, 9], [47, 4, 1, 1, 8, 0, 4, 1, 0, 0, 60, 9]], \"uncovered_true\": [], \"uncovered_false\": []}, {\"covered_true\": [[46, 4, 1, 1, 1, 0, 4, 1, 0, 0, 35, 9], [49, 7, 2, 1, 1, 4, 4, 1, 0, 0, 50, 9], [45, 4, 1, 1, 1, 5, 1, 0, 5178, 0, 40, 7], [63, 0, 1, 1, 1, 0, 4, 1, 0, 0, 40, 9], [47, 4, 1, 1, 1, 0, 4, 1, 0, 0, 60, 9], [24, 4, 1, 1, 1, 1, 4, 1, 0, 0, 30, 9], [40, 4, 5, 1, 1, 3, 4, 0, 0, 0, 40, 9], [50, 4, 5, 1, 1, 0, 4, 1, 0, 0, 50, 9], [55, 1, 5, 1, 1, 0, 4, 1, 0, 0, 60, 9], [46, 1, 5, 1, 1, 0, 4, 1, 0, 0, 40, 1]], \"covered_false\": [[63, 4, 1, 1, 1, 5, 4, 0, 7688, 0, 36, 9], [46, 2, 2, 1, 1, 5, 4, 0, 0, 1902, 52, 9], [32, 4, 5, 1, 1, 1, 4, 1, 0, 2824, 55, 9], [56, 4, 1, 1, 1, 0, 4, 1, 5178, 0, 44, 9], [40, 4, 2, 1, 1, 0, 4, 1, 0, 0, 40, 9], [45, 4, 5, 1, 1, 0, 4, 1, 15024, 0, 60, 9], [44, 2, 5, 1, 1, 0, 4, 1, 15024, 0, 35, 9], [58, 4, 1, 1, 1, 0, 4, 1, 7688, 0, 50, 9], [40, 5, 5, 1, 1, 5, 4, 0, 15024, 0, 30, 6]], \"uncovered_true\": [], \"uncovered_false\": []}, {\"covered_true\": [[52, 7, 1, 1, 1, 0, 4, 1, 0, 0, 40, 9], [55, 4, 1, 1, 1, 0, 4, 1, 0, 0, 40, 9], [32, 6, 1, 1, 1, 4, 2, 0, 0, 0, 30, 9], [24, 4, 1, 1, 1, 1, 4, 1, 0, 0, 55, 9], [44, 4, 1, 1, 1, 5, 4, 0, 0, 0, 20, 9], [34, 4, 1, 1, 1, 3, 4, 1, 0, 0, 40, 9], [39, 4, 1, 1, 1, 4, 4, 0, 0, 0, 50, 9], [40, 6, 1, 1, 1, 0, 4, 1, 0, 0, 45, 9], [31, 2, 1, 1, 1, 1, 4, 1, 0, 0, 45, 9], [43, 4, 5, 1, 1, 4, 4, 0, 0, 2547, 40, 9]], \"covered_false\": [[51, 0, 2, 1, 1, 1, 4, 1, 0, 2824, 40, 9], [46, 4, 2, 1, 1, 0, 4, 1, 0, 2415, 55, 9], [44, 5, 5, 1, 1, 0, 4, 1, 0, 2415, 55, 9], [68, 7, 2, 1, 1, 0, 4, 1, 0, 2377, 60, 9], [61, 7, 2, 1, 1, 0, 4, 1, 0, 0, 40, 0]], \"uncovered_true\": [], \"uncovered_false\": []}, {\"covered_true\": [[47, 4, 1, 1, 1, 0, 4, 1, 0, 0, 40, 8], [32, 4, 1, 1, 1, 3, 4, 0, 0, 0, 40, 9], [38, 1, 5, 1, 1, 0, 4, 1, 0, 0, 40, 6], [31, 4, 1, 1, 1, 1, 4, 0, 0, 0, 42, 9], [37, 4, 1, 1, 1, 0, 4, 1, 0, 0, 45, 9], [47, 4, 1, 1, 1, 0, 4, 1, 0, 0, 50, 9], [22, 7, 1, 1, 1, 0, 4, 1, 0, 0, 20, 9], [66, 4, 1, 1, 1, 0, 4, 1, 0, 0, 99, 9], [23, 4, 1, 1, 1, 3, 2, 1, 0, 0, 10, 9], [40, 4, 1, 1, 1, 0, 4, 1, 0, 0, 45, 9]], \"covered_false\": [[33, 4, 2, 1, 1, 0, 4, 1, 0, 0, 60, 9], [47, 1, 2, 1, 1, 0, 4, 1, 0, 0, 40, 9], [46, 4, 1, 1, 1, 1, 2, 0, 0, 0, 40, 9], [52, 5, 2, 1, 1, 0, 4, 1, 0, 0, 65, 9]], \"uncovered_true\": [], \"uncovered_false\": []}], \"all_precision\": 0, \"num_preds\": 1000000, \"success\": true, \"names\": [\"Marital Status = Never-Married\", \"Occupation = Admin\", \"Capital Gain <= 0.00\", \"Capital Loss <= 0.00\"], \"prediction\": [0], \"instance\": [47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0], \"instances\": [[47.0, 4.0, 1.0, 1.0, 1.0, 3.0, 4.0, 1.0, 0.0, 0.0, 40.0, 9.0]]}}}" ] } ] diff --git a/samples/k8s-tritonclient-aio.ipynb b/samples/k8s-tritonclient-aio.ipynb index db8a6e4cc1..aeb11102e4 100644 --- a/samples/k8s-tritonclient-aio.ipynb +++ b/samples/k8s-tritonclient-aio.ipynb @@ -6,7 +6,10 @@ "source": [ "## Tritonclient Examples with Seldon Core V2 (Asyncio)\n", "\n", - "- Note: for compatibility of Tritonclient check this issue https://github.com/SeldonIO/seldon-core-v2/issues/471" + "- Note: for compatibility of Tritonclient check this issue https://github.com/SeldonIO/seldon-core-v2/issues/471\n", + "\n", + "Requirements:\n", + " * `pip install tritonclient`" ] }, { @@ -27,7 +30,7 @@ { "data": { "text/plain": [ - "'172.19.255.14'" + "'172.19.255.1'" ] }, "execution_count": 2, @@ -69,15 +72,15 @@ "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Model\n", - "metadata:\n", - " name: iris\n", - "spec:\n", - " storageUri: \"gs://seldon-models/mlserver/iris\"\n", - " requirements:\n", - " - sklearn\n", - " memory: 100Ki\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Model\r\n", + "metadata:\r\n", + " name: iris\r\n", + "spec:\r\n", + " storageUri: \"gs://seldon-models/mlserver/iris\"\r\n", + " requirements:\r\n", + " - sklearn\r\n", + " memory: 100Ki\r\n" ] } ], @@ -94,16 +97,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Pipeline\n", - "metadata:\n", - " name: iris-pipeline\n", - "spec:\n", - " steps:\n", - " - name: iris\n", - " output:\n", - " steps:\n", - " - iris\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Pipeline\r\n", + "metadata:\r\n", + " name: iris-pipeline\r\n", + "spec:\r\n", + " steps:\r\n", + " - name: iris\r\n", + " output:\r\n", + " steps:\r\n", + " - iris\r\n" ] } ], @@ -113,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 39, "metadata": {}, "outputs": [ { @@ -132,7 +135,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 40, "metadata": {}, "outputs": [ { @@ -158,7 +161,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 41, "metadata": {}, "outputs": [ { @@ -192,7 +195,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 42, "metadata": {}, "outputs": [ { @@ -201,7 +204,7 @@ "array([2])" ] }, - "execution_count": 8, + "execution_count": 42, "metadata": {}, "output_type": "execute_result" } @@ -229,7 +232,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 43, "metadata": {}, "outputs": [ { @@ -238,7 +241,7 @@ "array([2])" ] }, - "execution_count": 9, + "execution_count": 43, "metadata": {}, "output_type": "execute_result" } @@ -264,11 +267,121 @@ "### GRPC Transport Protocol" ] }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [], + "source": [ + "import tritonclient.grpc.aio as grpcclient\n", + "import numpy as np\n", + "\n", + "\n", + "grpc_triton_client = grpcclient.InferenceServerClient(\n", + " url=f\"{MESH_IP}:80\",\n", + " verbose=False,\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "model ready: True\n", + "name: \"iris_1\"\n", + "\n" + ] + } + ], + "source": [ + "model_name = \"iris\"\n", + "headers = {\"seldon-model\": model_name}\n", + "\n", + "print(\"model ready:\", await grpc_triton_client.is_model_ready(model_name, headers=headers))\n", + "print(await grpc_triton_client.get_model_metadata(model_name, headers=headers))" + ] + }, { "cell_type": "markdown", "metadata": {}, "source": [ - "// Not supported with MLServer currently. " + "#### Against Model" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([2])" + ] + }, + "execution_count": 46, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "model_name = \"iris\"\n", + "headers = {\"seldon-model\": model_name}\n", + "\n", + "inputs = [\n", + " grpcclient.InferInput(\"predict\", (1, 4), \"FP64\"),\n", + "]\n", + "inputs[0].set_data_from_numpy(np.array([[1, 2, 3, 4]]).astype(\"float64\"))\n", + "\n", + "outputs = [grpcclient.InferRequestedOutput(\"predict\")]\n", + "\n", + "\n", + "result = await grpc_triton_client.infer(model_name, inputs, outputs=outputs, headers=headers)\n", + "result.as_numpy(\"predict\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Against Pipeline" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([2])" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "model_name = \"iris-pipeline.pipeline\"\n", + "headers = {\"seldon-model\": model_name}\n", + "\n", + "inputs = [\n", + " grpcclient.InferInput(\"predict\", (1, 4), \"FP64\"),\n", + "]\n", + "inputs[0].set_data_from_numpy(np.array([[1, 2, 3, 4]]).astype(\"float64\"))\n", + "\n", + "outputs = [grpcclient.InferRequestedOutput(\"predict\")]\n", + "\n", + "\n", + "result = await grpc_triton_client.infer(model_name, inputs, outputs=outputs, headers=headers)\n", + "result.as_numpy(\"predict\")" ] }, { @@ -280,7 +393,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 48, "metadata": {}, "outputs": [], "source": [ @@ -289,7 +402,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 49, "metadata": {}, "outputs": [ { @@ -322,22 +435,22 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Model\n", - "metadata:\n", - " name: tfsimple1\n", - "spec:\n", - " storageUri: \"gs://seldon-models/triton/simple\"\n", - " requirements:\n", - " - tensorflow\n", - " memory: 100Ki\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Model\r\n", + "metadata:\r\n", + " name: tfsimple1\r\n", + "spec:\r\n", + " storageUri: \"gs://seldon-models/triton/simple\"\r\n", + " requirements:\r\n", + " - tensorflow\r\n", + " memory: 100Ki\r\n" ] } ], @@ -347,23 +460,23 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Pipeline\n", - "metadata:\n", - " name: tfsimple\n", - "spec:\n", - " steps:\n", - " - name: tfsimple1\n", - " output:\n", - " steps:\n", - " - tfsimple1\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Pipeline\r\n", + "metadata:\r\n", + " name: tfsimple\r\n", + "spec:\r\n", + " steps:\r\n", + " - name: tfsimple1\r\n", + " output:\r\n", + " steps:\r\n", + " - tfsimple1\r\n" ] } ], @@ -373,7 +486,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 30, "metadata": {}, "outputs": [ { @@ -392,7 +505,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -418,7 +531,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 32, "metadata": {}, "outputs": [ { @@ -452,7 +565,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 33, "metadata": {}, "outputs": [ { @@ -462,7 +575,7 @@ " dtype=int32)" ] }, - "execution_count": 17, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -486,7 +599,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 34, "metadata": {}, "outputs": [ { @@ -496,7 +609,7 @@ " dtype=int32)" ] }, - "execution_count": 18, + "execution_count": 34, "metadata": {}, "output_type": "execute_result" } @@ -527,7 +640,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 35, "metadata": {}, "outputs": [ { @@ -537,7 +650,7 @@ " dtype=int32)" ] }, - "execution_count": 19, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -561,7 +674,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 38, "metadata": {}, "outputs": [], "source": [ @@ -774,6 +887,13 @@ "!kubectl delete -f models/tfsimple1.yaml -n seldon-mesh\n", "!kubectl delete -f pipelines/tfsimple.yaml -n seldon-mesh" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -792,7 +912,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.9.13" }, "vscode": { "interpreter": { diff --git a/samples/k8s-tritonclient-aio.md b/samples/k8s-tritonclient-aio.md index 431fa2d661..81731212ab 100644 --- a/samples/k8s-tritonclient-aio.md +++ b/samples/k8s-tritonclient-aio.md @@ -2,6 +2,9 @@ - Note: for compatibility of Tritonclient check this issue https://github.com/SeldonIO/seldon-core-v2/issues/471 +Requirements: + * `pip install tritonclient` + ```python import os @@ -20,7 +23,7 @@ MESH_IP - '172.19.255.14' + '172.19.255.1' @@ -36,15 +39,15 @@ MESH_IP !cat models/sklearn-iris-gs.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Model - metadata: - name: iris - spec: - storageUri: "gs://seldon-models/mlserver/iris" - requirements: - - sklearn - memory: 100Ki + apiVersion: mlops.seldon.io/v1alpha1 + kind: Model + metadata: + name: iris + spec: + storageUri: "gs://seldon-models/mlserver/iris" + requirements: + - sklearn + memory: 100Ki @@ -52,16 +55,16 @@ MESH_IP !cat pipelines/iris.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Pipeline - metadata: - name: iris-pipeline - spec: - steps: - - name: iris - output: - steps: - - iris + apiVersion: mlops.seldon.io/v1alpha1 + kind: Pipeline + metadata: + name: iris-pipeline + spec: + steps: + - name: iris + output: + steps: + - iris @@ -154,7 +157,83 @@ result.as_numpy("predict") ### GRPC Transport Protocol -// Not supported with MLServer currently. + +```python +import tritonclient.grpc.aio as grpcclient +import numpy as np + + +grpc_triton_client = grpcclient.InferenceServerClient( + url=f"{MESH_IP}:80", + verbose=False, +) +``` + + +```python +model_name = "iris" +headers = {"seldon-model": model_name} + +print("model ready:", await grpc_triton_client.is_model_ready(model_name, headers=headers)) +print(await grpc_triton_client.get_model_metadata(model_name, headers=headers)) +``` + + model ready: True + name: "iris_1" + + + +#### Against Model + + +```python +model_name = "iris" +headers = {"seldon-model": model_name} + +inputs = [ + grpcclient.InferInput("predict", (1, 4), "FP64"), +] +inputs[0].set_data_from_numpy(np.array([[1, 2, 3, 4]]).astype("float64")) + +outputs = [grpcclient.InferRequestedOutput("predict")] + + +result = await grpc_triton_client.infer(model_name, inputs, outputs=outputs, headers=headers) +result.as_numpy("predict") +``` + + + + + array([2]) + + + +#### Against Pipeline + + +```python +model_name = "iris-pipeline.pipeline" +headers = {"seldon-model": model_name} + +inputs = [ + grpcclient.InferInput("predict", (1, 4), "FP64"), +] +inputs[0].set_data_from_numpy(np.array([[1, 2, 3, 4]]).astype("float64")) + +outputs = [grpcclient.InferRequestedOutput("predict")] + + +result = await grpc_triton_client.infer(model_name, inputs, outputs=outputs, headers=headers) +result.as_numpy("predict") +``` + + + + + array([2]) + + ### Cleanup @@ -182,15 +261,15 @@ await http_triton_client.close() !cat models/tfsimple1.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Model - metadata: - name: tfsimple1 - spec: - storageUri: "gs://seldon-models/triton/simple" - requirements: - - tensorflow - memory: 100Ki + apiVersion: mlops.seldon.io/v1alpha1 + kind: Model + metadata: + name: tfsimple1 + spec: + storageUri: "gs://seldon-models/triton/simple" + requirements: + - tensorflow + memory: 100Ki @@ -198,16 +277,16 @@ await http_triton_client.close() !cat pipelines/tfsimple.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Pipeline - metadata: - name: tfsimple - spec: - steps: - - name: tfsimple1 - output: - steps: - - tfsimple1 + apiVersion: mlops.seldon.io/v1alpha1 + kind: Pipeline + metadata: + name: tfsimple + spec: + steps: + - name: tfsimple1 + output: + steps: + - tfsimple1 @@ -481,3 +560,8 @@ await grpc_triton_client.close() model.mlops.seldon.io "tfsimple1" deleted pipeline.mlops.seldon.io "tfsimple" deleted + + +```python + +``` diff --git a/samples/k8s-tritonclient.ipynb b/samples/k8s-tritonclient.ipynb index 98e3398087..2d13d0e572 100644 --- a/samples/k8s-tritonclient.ipynb +++ b/samples/k8s-tritonclient.ipynb @@ -11,7 +11,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -21,16 +21,16 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'172.19.255.14'" + "'172.19.255.1'" ] }, - "execution_count": 2, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -62,22 +62,22 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Model\n", - "metadata:\n", - " name: iris\n", - "spec:\n", - " storageUri: \"gs://seldon-models/mlserver/iris\"\n", - " requirements:\n", - " - sklearn\n", - " memory: 100Ki\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Model\r\n", + "metadata:\r\n", + " name: iris\r\n", + "spec:\r\n", + " storageUri: \"gs://seldon-models/mlserver/iris\"\r\n", + " requirements:\r\n", + " - sklearn\r\n", + " memory: 100Ki\r\n" ] } ], @@ -87,23 +87,23 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Pipeline\n", - "metadata:\n", - " name: iris-pipeline\n", - "spec:\n", - " steps:\n", - " - name: iris\n", - " output:\n", - " steps:\n", - " - iris\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Pipeline\r\n", + "metadata:\r\n", + " name: iris-pipeline\r\n", + "spec:\r\n", + " steps:\r\n", + " - name: iris\r\n", + " output:\r\n", + " steps:\r\n", + " - iris\r\n" ] } ], @@ -113,7 +113,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -132,7 +132,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -158,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -185,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -194,7 +194,7 @@ "array([2])" ] }, - "execution_count": 8, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -215,7 +215,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -224,13 +224,13 @@ "array([2])" ] }, - "execution_count": 9, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "# Agaist pipeline\n", + "# Against pipeline\n", "\n", "binary_data = False\n", "\n", @@ -250,11 +250,121 @@ "### GRPC Transport Protocol" ] }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "import tritonclient.grpc as grpcclient\n", + "import numpy as np\n", + "\n", + "\n", + "grpc_triton_client = grpcclient.InferenceServerClient(\n", + " url=f\"{MESH_IP}:80\",\n", + " verbose=False,\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "model ready: True\n", + "name: \"iris_1\"\n", + "\n" + ] + } + ], + "source": [ + "model_name = \"iris\"\n", + "headers = {\"seldon-model\": model_name}\n", + "\n", + "print(\"model ready:\", grpc_triton_client.is_model_ready(model_name, headers=headers))\n", + "print(grpc_triton_client.get_model_metadata(model_name, headers=headers))" + ] + }, { "cell_type": "markdown", "metadata": {}, "source": [ - "// Not supported with MLServer currently. " + "#### Against Model" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([2])" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "model_name = \"iris\"\n", + "headers = {\"seldon-model\": model_name}\n", + "\n", + "inputs = [\n", + " grpcclient.InferInput(\"predict\", (1, 4), \"FP64\"),\n", + "]\n", + "inputs[0].set_data_from_numpy(np.array([[1, 2, 3, 4]]).astype(\"float64\"))\n", + "\n", + "outputs = [grpcclient.InferRequestedOutput(\"predict\")]\n", + "\n", + "\n", + "result = grpc_triton_client.infer(model_name, inputs, outputs=outputs, headers=headers)\n", + "result.as_numpy(\"predict\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Against Pipeline" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([2])" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "model_name = \"iris-pipeline.pipeline\"\n", + "headers = {\"seldon-model\": model_name}\n", + "\n", + "inputs = [\n", + " grpcclient.InferInput(\"predict\", (1, 4), \"FP64\"),\n", + "]\n", + "inputs[0].set_data_from_numpy(np.array([[1, 2, 3, 4]]).astype(\"float64\"))\n", + "\n", + "outputs = [grpcclient.InferRequestedOutput(\"predict\")]\n", + "\n", + "\n", + "result = grpc_triton_client.infer(model_name, inputs, outputs=outputs, headers=headers)\n", + "result.as_numpy(\"predict\")" ] }, { @@ -275,22 +385,22 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Model\n", - "metadata:\n", - " name: tfsimple1\n", - "spec:\n", - " storageUri: \"gs://seldon-models/triton/simple\"\n", - " requirements:\n", - " - tensorflow\n", - " memory: 100Ki\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Model\r\n", + "metadata:\r\n", + " name: tfsimple1\r\n", + "spec:\r\n", + " storageUri: \"gs://seldon-models/triton/simple\"\r\n", + " requirements:\r\n", + " - tensorflow\r\n", + " memory: 100Ki\r\n" ] } ], @@ -300,23 +410,23 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "apiVersion: mlops.seldon.io/v1alpha1\n", - "kind: Pipeline\n", - "metadata:\n", - " name: tfsimple\n", - "spec:\n", - " steps:\n", - " - name: tfsimple1\n", - " output:\n", - " steps:\n", - " - tfsimple1\n" + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Pipeline\r\n", + "metadata:\r\n", + " name: tfsimple\r\n", + "spec:\r\n", + " steps:\r\n", + " - name: tfsimple1\r\n", + " output:\r\n", + " steps:\r\n", + " - tfsimple1\r\n" ] } ], @@ -326,7 +436,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -345,7 +455,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -371,7 +481,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -398,7 +508,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -408,7 +518,7 @@ " dtype=int32)" ] }, - "execution_count": 15, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -434,7 +544,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -444,7 +554,7 @@ " dtype=int32)" ] }, - "execution_count": 16, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -470,7 +580,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 21, "metadata": {}, "outputs": [ { @@ -480,7 +590,7 @@ " dtype=int32)" ] }, - "execution_count": 17, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -506,7 +616,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -539,7 +649,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -555,7 +665,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 24, "metadata": {}, "outputs": [ { @@ -604,7 +714,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -614,7 +724,7 @@ " dtype=int32)" ] }, - "execution_count": 21, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -641,7 +751,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -651,7 +761,7 @@ " dtype=int32)" ] }, - "execution_count": 22, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -685,7 +795,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -704,7 +814,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -720,6 +830,13 @@ "!kubectl delete -f models/tfsimple1.yaml -n ${NAMESPACE}\n", "!kubectl delete -f pipelines/tfsimple.yaml -n ${NAMESPACE}" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -738,7 +855,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.9.13" }, "vscode": { "interpreter": { diff --git a/samples/k8s-tritonclient.md b/samples/k8s-tritonclient.md index b2dc67cd2c..52396a7a0b 100644 --- a/samples/k8s-tritonclient.md +++ b/samples/k8s-tritonclient.md @@ -20,7 +20,7 @@ MESH_IP - '172.19.255.14' + '172.19.255.1' @@ -36,15 +36,15 @@ MESH_IP !cat models/sklearn-iris-gs.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Model - metadata: - name: iris - spec: - storageUri: "gs://seldon-models/mlserver/iris" - requirements: - - sklearn - memory: 100Ki + apiVersion: mlops.seldon.io/v1alpha1 + kind: Model + metadata: + name: iris + spec: + storageUri: "gs://seldon-models/mlserver/iris" + requirements: + - sklearn + memory: 100Ki @@ -52,16 +52,16 @@ MESH_IP !cat pipelines/iris.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Pipeline - metadata: - name: iris-pipeline - spec: - steps: - - name: iris - output: - steps: - - iris + apiVersion: mlops.seldon.io/v1alpha1 + kind: Pipeline + metadata: + name: iris-pipeline + spec: + steps: + - name: iris + output: + steps: + - iris @@ -128,7 +128,7 @@ result.as_numpy("predict") ```python -# Agaist pipeline +# Against pipeline binary_data = False @@ -150,7 +150,83 @@ result.as_numpy("predict") ### GRPC Transport Protocol -// Not supported with MLServer currently. + +```python +import tritonclient.grpc as grpcclient +import numpy as np + + +grpc_triton_client = grpcclient.InferenceServerClient( + url=f"{MESH_IP}:80", + verbose=False, +) +``` + + +```python +model_name = "iris" +headers = {"seldon-model": model_name} + +print("model ready:", grpc_triton_client.is_model_ready(model_name, headers=headers)) +print(grpc_triton_client.get_model_metadata(model_name, headers=headers)) +``` + + model ready: True + name: "iris_1" + + + +#### Against Model + + +```python +model_name = "iris" +headers = {"seldon-model": model_name} + +inputs = [ + grpcclient.InferInput("predict", (1, 4), "FP64"), +] +inputs[0].set_data_from_numpy(np.array([[1, 2, 3, 4]]).astype("float64")) + +outputs = [grpcclient.InferRequestedOutput("predict")] + + +result = grpc_triton_client.infer(model_name, inputs, outputs=outputs, headers=headers) +result.as_numpy("predict") +``` + + + + + array([2]) + + + +#### Against Pipeline + + +```python +model_name = "iris-pipeline.pipeline" +headers = {"seldon-model": model_name} + +inputs = [ + grpcclient.InferInput("predict", (1, 4), "FP64"), +] +inputs[0].set_data_from_numpy(np.array([[1, 2, 3, 4]]).astype("float64")) + +outputs = [grpcclient.InferRequestedOutput("predict")] + + +result = grpc_triton_client.infer(model_name, inputs, outputs=outputs, headers=headers) +result.as_numpy("predict") +``` + + + + + array([2]) + + ## With Tritonserver @@ -163,15 +239,15 @@ result.as_numpy("predict") !cat models/tfsimple1.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Model - metadata: - name: tfsimple1 - spec: - storageUri: "gs://seldon-models/triton/simple" - requirements: - - tensorflow - memory: 100Ki + apiVersion: mlops.seldon.io/v1alpha1 + kind: Model + metadata: + name: tfsimple1 + spec: + storageUri: "gs://seldon-models/triton/simple" + requirements: + - tensorflow + memory: 100Ki @@ -179,16 +255,16 @@ result.as_numpy("predict") !cat pipelines/tfsimple.yaml ``` - apiVersion: mlops.seldon.io/v1alpha1 - kind: Pipeline - metadata: - name: tfsimple - spec: - steps: - - name: tfsimple1 - output: - steps: - - tfsimple1 + apiVersion: mlops.seldon.io/v1alpha1 + kind: Pipeline + metadata: + name: tfsimple + spec: + steps: + - name: tfsimple1 + output: + steps: + - tfsimple1 @@ -470,3 +546,8 @@ result.as_numpy("OUTPUT0") model.mlops.seldon.io "tfsimple1" deleted pipeline.mlops.seldon.io "tfsimple" deleted + + +```python + +``` diff --git a/samples/local-examples.ipynb b/samples/local-examples.ipynb index a779f144fd..252824781c 100644 --- a/samples/local-examples.ipynb +++ b/samples/local-examples.ipynb @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 28, "id": "8b4be911", "metadata": {}, "outputs": [ @@ -54,7 +54,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 29, "id": "checked-cream", "metadata": {}, "outputs": [ @@ -80,7 +80,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 30, "id": "interracial-secret", "metadata": {}, "outputs": [ @@ -106,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 31, "id": "upper-cholesterol", "metadata": {}, "outputs": [ @@ -117,7 +117,7 @@ "{\r\n", "\t\"model_name\": \"iris_1\",\r\n", "\t\"model_version\": \"1\",\r\n", - "\t\"id\": \"0cae46c3-9c74-4e0b-b291-0d724c52c94c\",\r\n", + "\t\"id\": \"e08dda16-776e-40e9-b556-273d8bf851ae\",\r\n", "\t\"parameters\": {\r\n", "\t\t\"content_type\": null,\r\n", "\t\t\"headers\": null\r\n", @@ -154,7 +154,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 32, "id": "right-talent", "metadata": {}, "outputs": [ @@ -198,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 33, "id": "ceramic-illness", "metadata": {}, "outputs": [ @@ -226,7 +226,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 34, "id": "34165288", "metadata": {}, "outputs": [ @@ -260,7 +260,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 35, "id": "726f2dd0", "metadata": {}, "outputs": [ @@ -286,7 +286,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 36, "id": "2d9b631f", "metadata": {}, "outputs": [ @@ -312,7 +312,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 37, "id": "f812f531", "metadata": {}, "outputs": [ @@ -380,7 +380,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 38, "id": "7abd240a", "metadata": {}, "outputs": [ @@ -464,7 +464,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 39, "id": "f86c494a", "metadata": {}, "outputs": [ @@ -552,7 +552,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 40, "id": "f7405940", "metadata": {}, "outputs": [ @@ -580,7 +580,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 41, "id": "dfc5a4fd", "metadata": {}, "outputs": [ @@ -605,7 +605,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 42, "id": "8837f315", "metadata": {}, "outputs": [ @@ -638,7 +638,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 43, "id": "elect-samba", "metadata": {}, "outputs": [ @@ -666,7 +666,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 44, "id": "floral-moisture", "metadata": {}, "outputs": [ @@ -684,13 +684,13 @@ " \"modelReplicaState\": {\n", " \"0\": {\n", " \"state\": \"Available\",\n", - " \"lastChangeTimestamp\": \"2022-10-12T14:10:36.434248012Z\"\n", + " \"lastChangeTimestamp\": \"2022-11-15T10:45:30.088668539Z\"\n", " }\n", " },\n", " \"state\": {\n", " \"state\": \"ModelAvailable\",\n", " \"availableReplicas\": 1,\n", - " \"lastChangeTimestamp\": \"2022-10-12T14:10:36.434248012Z\"\n", + " \"lastChangeTimestamp\": \"2022-11-15T10:45:30.088668539Z\"\n", " },\n", " \"modelDefn\": {\n", " \"meta\": {\n", @@ -704,8 +704,7 @@ " ]\n", " },\n", " \"deploymentSpec\": {\n", - " \"replicas\": 1,\n", - " \"minReplicas\": 1\n", + " \"replicas\": 1\n", " }\n", " }\n", " }\n", @@ -721,13 +720,13 @@ " \"modelReplicaState\": {\n", " \"0\": {\n", " \"state\": \"Available\",\n", - " \"lastChangeTimestamp\": \"2022-10-12T14:10:37.091062717Z\"\n", + " \"lastChangeTimestamp\": \"2022-11-15T10:45:30.088816590Z\"\n", " }\n", " },\n", " \"state\": {\n", " \"state\": \"ModelAvailable\",\n", " \"availableReplicas\": 1,\n", - " \"lastChangeTimestamp\": \"2022-10-12T14:10:37.091062717Z\"\n", + " \"lastChangeTimestamp\": \"2022-11-15T10:45:30.088816590Z\"\n", " },\n", " \"modelDefn\": {\n", " \"meta\": {\n", @@ -741,8 +740,7 @@ " ]\n", " },\n", " \"deploymentSpec\": {\n", - " \"replicas\": 1,\n", - " \"minReplicas\": 1\n", + " \"replicas\": 1\n", " }\n", " }\n", " }\n", @@ -766,7 +764,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 45, "id": "10fe4447", "metadata": {}, "outputs": [ @@ -802,7 +800,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 46, "id": "differential-array", "metadata": {}, "outputs": [ @@ -828,7 +826,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 47, "id": "overhead-banks", "metadata": {}, "outputs": [ @@ -861,7 +859,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 48, "id": "finite-significance", "metadata": {}, "outputs": [ @@ -869,7 +867,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::42 :iris_1::58]\r\n" + "Success: map[:iris2_1::41 :iris_1::59]\r\n" ] } ], @@ -888,7 +886,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 49, "id": "85357805", "metadata": {}, "outputs": [ @@ -897,9 +895,9 @@ "output_type": "stream", "text": [ "{\r\n", - "\t\"model_name\": \"iris2_1\",\r\n", + "\t\"model_name\": \"iris_1\",\r\n", "\t\"model_version\": \"1\",\r\n", - "\t\"id\": \"b73cf845-cf52-453e-a456-946ba696c4a1\",\r\n", + "\t\"id\": \"35a7fce6-db28-4229-ba35-dd2c1db02505\",\r\n", "\t\"parameters\": {\r\n", "\t\t\"content_type\": null,\r\n", "\t\t\"headers\": null\r\n", @@ -937,7 +935,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 50, "id": "1ffb00b4", "metadata": {}, "outputs": [ @@ -945,7 +943,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::50]\r\n" + "Success: map[:iris_1::50]\r\n" ] } ], @@ -956,7 +954,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 51, "id": "81a10627", "metadata": {}, "outputs": [ @@ -964,7 +962,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris2_1::50]\r\n" + "Success: map[:iris_1::50]\r\n" ] } ], @@ -983,7 +981,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 52, "id": "downtown-construction", "metadata": {}, "outputs": [ @@ -1009,7 +1007,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 53, "id": "b085568e", "metadata": {}, "outputs": [ @@ -1017,7 +1015,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[:iris_1::100]\r\n" + "Success: map[:iris_1::100]\r\n" ] } ], @@ -1036,7 +1034,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 54, "id": "077bbce8", "metadata": {}, "outputs": [ @@ -1079,7 +1077,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/samples/local-examples.md b/samples/local-examples.md index 1c6a05d4b0..692d98a289 100644 --- a/samples/local-examples.md +++ b/samples/local-examples.md @@ -52,7 +52,7 @@ Do a REST inference call { "model_name": "iris_1", "model_version": "1", - "id": "0cae46c3-9c74-4e0b-b291-0d724c52c94c", + "id": "e08dda16-776e-40e9-b556-273d8bf851ae", "parameters": { "content_type": null, "headers": null @@ -417,13 +417,13 @@ Wait for both models to be ready. "modelReplicaState": { "0": { "state": "Available", - "lastChangeTimestamp": "2022-10-12T14:10:36.434248012Z" + "lastChangeTimestamp": "2022-11-15T10:45:30.088668539Z" } }, "state": { "state": "ModelAvailable", "availableReplicas": 1, - "lastChangeTimestamp": "2022-10-12T14:10:36.434248012Z" + "lastChangeTimestamp": "2022-11-15T10:45:30.088668539Z" }, "modelDefn": { "meta": { @@ -437,8 +437,7 @@ Wait for both models to be ready. ] }, "deploymentSpec": { - "replicas": 1, - "minReplicas": 1 + "replicas": 1 } } } @@ -454,13 +453,13 @@ Wait for both models to be ready. "modelReplicaState": { "0": { "state": "Available", - "lastChangeTimestamp": "2022-10-12T14:10:37.091062717Z" + "lastChangeTimestamp": "2022-11-15T10:45:30.088816590Z" } }, "state": { "state": "ModelAvailable", "availableReplicas": 1, - "lastChangeTimestamp": "2022-10-12T14:10:37.091062717Z" + "lastChangeTimestamp": "2022-11-15T10:45:30.088816590Z" }, "modelDefn": { "meta": { @@ -474,8 +473,7 @@ Wait for both models to be ready. ] }, "deploymentSpec": { - "replicas": 1, - "minReplicas": 1 + "replicas": 1 } } } @@ -538,7 +536,7 @@ Run a set of calls and record which route the traffic took. There should be roug '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris2_1::42 :iris_1::58] + Success: map[:iris2_1::41 :iris_1::59] Run one more request @@ -550,9 +548,9 @@ Run one more request ``` { - "model_name": "iris2_1", + "model_name": "iris_1", "model_version": "1", - "id": "b73cf845-cf52-453e-a456-946ba696c4a1", + "id": "35a7fce6-db28-4229-ba35-dd2c1db02505", "parameters": { "content_type": null, "headers": null @@ -582,7 +580,7 @@ We will test REST and gRPC. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris2_1::50] + Success: map[:iris_1::50] @@ -591,7 +589,7 @@ We will test REST and gRPC. '{"model_name":"iris","inputs":[{"name":"input","contents":{"fp32_contents":[1,2,3,4]},"datatype":"FP32","shape":[1,4]}]}' ``` - map[:iris2_1::50] + Success: map[:iris_1::50] Stop the experiment @@ -612,7 +610,7 @@ Show the requests all go to original model now. '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` - map[:iris_1::100] + Success: map[:iris_1::100] Unload both models. diff --git a/samples/metrics.ipynb b/samples/metrics.ipynb index e1c7bf0750..4885632f8a 100644 --- a/samples/metrics.ipynb +++ b/samples/metrics.ipynb @@ -27,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 2, "id": "f93e80df", "metadata": {}, "outputs": [], @@ -67,7 +67,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 8, "id": "checked-cream", "metadata": {}, "outputs": [ @@ -87,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 9, "id": "upper-cholesterol", "metadata": {}, "outputs": [ @@ -106,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 10, "id": "right-talent", "metadata": {}, "outputs": [ @@ -125,7 +125,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 11, "id": "77205b71", "metadata": {}, "outputs": [ @@ -144,7 +144,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 12, "id": "ceramic-illness", "metadata": {}, "outputs": [ @@ -178,7 +178,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 13, "id": "726f2dd0", "metadata": {}, "outputs": [ @@ -198,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 14, "id": "7abd240a", "metadata": {}, "outputs": [ @@ -217,7 +217,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 15, "id": "f86c494a", "metadata": {}, "outputs": [ @@ -236,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 16, "id": "2f0f940f", "metadata": {}, "outputs": [ @@ -255,7 +255,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 17, "id": "f7405940", "metadata": {}, "outputs": [ @@ -281,7 +281,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 18, "id": "d540b7f0", "metadata": {}, "outputs": [ @@ -294,7 +294,7 @@ "{}\n", "{}\n", "{}\n", - "{\"pipelineName\":\"tfsimples\", \"versions\":[{\"pipeline\":{\"name\":\"tfsimples\", \"uid\":\"cdoio8uusu8s73cdcap0\", \"version\":4, \"steps\":[{\"name\":\"tfsimple1\"}, {\"name\":\"tfsimple2\", \"inputs\":[\"tfsimple1.outputs\"], \"tensorMap\":{\"tfsimple1.outputs.OUTPUT0\":\"INPUT0\", \"tfsimple1.outputs.OUTPUT1\":\"INPUT1\"}}], \"output\":{\"steps\":[\"tfsimple2.outputs\"]}, \"kubernetesMeta\":{}}, \"state\":{\"pipelineVersion\":4, \"status\":\"PipelineReady\", \"reason\":\"created pipeline\", \"lastChangeTimestamp\":\"2022-11-13T17:40:51.458541810Z\"}}]}\n" + "{\"pipelineName\":\"tfsimples\", \"versions\":[{\"pipeline\":{\"name\":\"tfsimples\", \"uid\":\"cdqji39qa12c739ab3o0\", \"version\":2, \"steps\":[{\"name\":\"tfsimple1\"}, {\"name\":\"tfsimple2\", \"inputs\":[\"tfsimple1.outputs\"], \"tensorMap\":{\"tfsimple1.outputs.OUTPUT0\":\"INPUT0\", \"tfsimple1.outputs.OUTPUT1\":\"INPUT1\"}}], \"output\":{\"steps\":[\"tfsimple2.outputs\"]}, \"kubernetesMeta\":{}}, \"state\":{\"pipelineVersion\":2, \"status\":\"PipelineReady\", \"reason\":\"created pipeline\", \"lastChangeTimestamp\":\"2022-11-16T19:25:01.255955114Z\"}}]}\n" ] } ], @@ -309,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 19, "id": "1c78ca44", "metadata": {}, "outputs": [ @@ -328,7 +328,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 20, "id": "7f48b7c2", "metadata": {}, "outputs": [ @@ -346,7 +346,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 21, "id": "2a35f0ee", "metadata": {}, "outputs": [ diff --git a/samples/metrics.md b/samples/metrics.md index 4ed5362073..c863fb6743 100644 --- a/samples/metrics.md +++ b/samples/metrics.md @@ -23,17 +23,17 @@ def scrape_metrics(host): family.name: family for family in text_string_to_metric_families(data) } - def print_sample(family, label, value): +def print_sample(family, label, value): for sample in family.samples: if sample.labels[label] == value: print(sample) - def get_model_infer_count(host, model_name): +def get_model_infer_count(host, model_name): metrics = scrape_metrics(host) family = metrics["seldon_model_infer"] print_sample(family, "model", model_name) - def get_pipeline_infer_count(host, pipeline_name): +def get_pipeline_infer_count(host, pipeline_name): metrics = scrape_metrics(host) family = metrics["seldon_pipeline_infer"] print_sample(family, "pipeline", pipeline_name) @@ -42,135 +42,149 @@ def scrape_metrics(host): ### MLServer Model -```bash -seldon model load -f ./models/sklearn-iris-gs.yaml -seldon model status iris -w ModelAvailable | jq -M . +```python +!seldon model load -f ./models/sklearn-iris-gs.yaml +!seldon model status iris -w ModelAvailable | jq -M . ``` -```json + {} {} -``` -```bash -seldon model infer iris -i 50 \ + + +```python +!seldon model infer iris -i 50 \ '{"inputs": [{"name": "predict", "shape": [1, 4], "datatype": "FP32", "data": [[1, 2, 3, 4]]}]}' ``` -```json + Success: map[:iris_1::50] -``` -```bash -seldon model infer iris --inference-mode grpc -i 100 \ + + +```python +!seldon model infer iris --inference-mode grpc -i 100 \ '{"model_name":"iris","inputs":[{"name":"input","contents":{"fp32_contents":[1,2,3,4]},"datatype":"FP32","shape":[1,4]}]}' ``` -```json + Success: map[:iris_1::100] -``` + + ```python get_model_infer_count(mlserver_metrics_host,"iris") ``` -```json + Sample(name='seldon_model_infer_total', labels={'code': '200', 'method_type': 'rest', 'model': 'iris', 'model_internal': 'iris_1', 'server': 'mlserver', 'server_replica': '0'}, value=50.0, timestamp=None, exemplar=None) Sample(name='seldon_model_infer_total', labels={'code': 'OK', 'method_type': 'grpc', 'model': 'iris', 'model_internal': 'iris_1', 'server': 'mlserver', 'server_replica': '0'}, value=100.0, timestamp=None, exemplar=None) -``` -```bash -seldon model unload iris + + +```python +!seldon model unload iris ``` -```json + {} -``` + + ### Triton Model Load the model. -```bash -seldon model load -f ./models/tfsimple1.yaml -seldon model status tfsimple1 -w ModelAvailable | jq -M . +```python +!seldon model load -f ./models/tfsimple1.yaml +!seldon model status tfsimple1 -w ModelAvailable | jq -M . ``` -```json + {} {} -``` -```bash -seldon model infer tfsimple1 -i 50\ + + +```python +!seldon model infer tfsimple1 -i 50\ '{"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]}]}' ``` -```json + Success: map[:tfsimple1_1::50] -``` -```bash -seldon model infer tfsimple1 --inference-mode grpc -i 100 \ + + +```python +!seldon model infer tfsimple1 --inference-mode grpc -i 100 \ '{"model_name":"tfsimple1","inputs":[{"name":"INPUT0","contents":{"int_contents":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},"datatype":"INT32","shape":[1,16]},{"name":"INPUT1","contents":{"int_contents":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},"datatype":"INT32","shape":[1,16]}]}' ``` -```json + Success: map[:tfsimple1_1::100] -``` + + ```python get_model_infer_count(triton_metrics_host,"tfsimple1") ``` -```json + Sample(name='seldon_model_infer_total', labels={'code': '200', 'method_type': 'rest', 'model': 'tfsimple1', 'model_internal': 'tfsimple1_1', 'server': 'triton', 'server_replica': '0'}, value=50.0, timestamp=None, exemplar=None) Sample(name='seldon_model_infer_total', labels={'code': 'OK', 'method_type': 'grpc', 'model': 'tfsimple1', 'model_internal': 'tfsimple1_1', 'server': 'triton', 'server_replica': '0'}, value=100.0, timestamp=None, exemplar=None) -``` -```bash -seldon model unload tfsimple1 + + +```python +!seldon model unload tfsimple1 ``` -```json + {} -``` + + ### Pipeline -```bash -seldon model load -f ./models/tfsimple1.yaml -seldon model load -f ./models/tfsimple2.yaml -seldon model status tfsimple1 -w ModelAvailable | jq -M . -seldon model status tfsimple2 -w ModelAvailable | jq -M . -seldon pipeline load -f ./pipelines/tfsimples.yaml -seldon pipeline status tfsimples -w PipelineReady +```python +!seldon model load -f ./models/tfsimple1.yaml +!seldon model load -f ./models/tfsimple2.yaml +!seldon model status tfsimple1 -w ModelAvailable | jq -M . +!seldon model status tfsimple2 -w ModelAvailable | jq -M . +!seldon pipeline load -f ./pipelines/tfsimples.yaml +!seldon pipeline status tfsimples -w PipelineReady ``` -```json + {} {} {} {} {} - {"pipelineName":"tfsimples", "versions":[{"pipeline":{"name":"tfsimples", "uid":"cdoio8uusu8s73cdcap0", "version":4, "steps":[{"name":"tfsimple1"}, {"name":"tfsimple2", "inputs":["tfsimple1.outputs"], "tensorMap":{"tfsimple1.outputs.OUTPUT0":"INPUT0", "tfsimple1.outputs.OUTPUT1":"INPUT1"}}], "output":{"steps":["tfsimple2.outputs"]}, "kubernetesMeta":{}}, "state":{"pipelineVersion":4, "status":"PipelineReady", "reason":"created pipeline", "lastChangeTimestamp":"2022-11-13T17:40:51.458541810Z"}}]} -``` + {"pipelineName":"tfsimples", "versions":[{"pipeline":{"name":"tfsimples", "uid":"cdqji39qa12c739ab3o0", "version":2, "steps":[{"name":"tfsimple1"}, {"name":"tfsimple2", "inputs":["tfsimple1.outputs"], "tensorMap":{"tfsimple1.outputs.OUTPUT0":"INPUT0", "tfsimple1.outputs.OUTPUT1":"INPUT1"}}], "output":{"steps":["tfsimple2.outputs"]}, "kubernetesMeta":{}}, "state":{"pipelineVersion":2, "status":"PipelineReady", "reason":"created pipeline", "lastChangeTimestamp":"2022-11-16T19:25:01.255955114Z"}}]} -```bash -seldon pipeline infer tfsimples -i 50 \ + + +```python +!seldon pipeline infer tfsimples -i 50 \ '{"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]}]}' ``` -```json + Success: map[:tfsimple1_1::50 :tfsimple2_1::50 :tfsimples.pipeline::50] -``` + + ```python get_pipeline_infer_count(pipeline_metrics_host,"tfsimples") ``` -```json + Sample(name='seldon_pipeline_infer_total', labels={'code': '200', 'method_type': 'rest', 'pipeline': 'tfsimples', 'server': 'pipeline-gateway'}, value=50.0, timestamp=None, exemplar=None) -``` -```bash -seldon model unload tfsimple1 -seldon model unload tfsimple2 -seldon pipeline unload tfsimples + + +```python +!seldon model unload tfsimple1 +!seldon model unload tfsimple2 +!seldon pipeline unload tfsimples ``` -```json + {} {} {} -``` + + ```python diff --git a/samples/pipeline-errors.ipynb b/samples/pipeline-errors.ipynb index b62a673d7b..236d795911 100644 --- a/samples/pipeline-errors.ipynb +++ b/samples/pipeline-errors.ipynb @@ -151,8 +151,8 @@ " {\r\n", " \"pipeline\": {\r\n", " \"name\": \"tfsimples\",\r\n", - " \"uid\": \"cdnuod36qvvc73dlvs5g\",\r\n", - " \"version\": 3,\r\n", + " \"uid\": \"cdqjic9qa12c739ab3og\",\r\n", + " \"version\": 1,\r\n", " \"steps\": [\r\n", " {\r\n", " \"name\": \"tfsimple1\"\r\n", @@ -176,10 +176,10 @@ " \"kubernetesMeta\": {}\r\n", " },\r\n", " \"state\": {\r\n", - " \"pipelineVersion\": 3,\r\n", + " \"pipelineVersion\": 1,\r\n", " \"status\": \"PipelineReady\",\r\n", " \"reason\": \"created pipeline\",\r\n", - " \"lastChangeTimestamp\": \"2022-11-12T18:55:48.413295092Z\"\r\n", + " \"lastChangeTimestamp\": \"2022-11-16T19:25:37.908093300Z\"\r\n", " }\r\n", " }\r\n", " ]\r\n", @@ -193,7 +193,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "87f10a5c", "metadata": {}, "outputs": [ @@ -268,7 +268,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 8, "id": "e27d4f8d", "metadata": {}, "outputs": [ @@ -287,7 +287,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 9, "id": "5c33133e", "metadata": {}, "outputs": [ @@ -365,7 +365,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 10, "id": "ea07d3f3", "metadata": {}, "outputs": [ @@ -384,9 +384,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "e017099a", "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{}\n", + "{}\n", + "{}\n" + ] + } + ], + "source": [ + "!seldon pipeline unload tfsimples\n", + "!seldon model unload tfsimple1\n", + "!seldon model unload tfsimple2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "db3dc8f4", + "metadata": {}, "outputs": [], "source": [] } diff --git a/samples/pipeline-errors.md b/samples/pipeline-errors.md index 92a487627f..0dfb92c25f 100644 --- a/samples/pipeline-errors.md +++ b/samples/pipeline-errors.md @@ -2,11 +2,11 @@ -```bash -cat ./models/tfsimple1.yaml -cat ./models/tfsimple2.yaml +```python +!cat ./models/tfsimple1.yaml +!cat ./models/tfsimple2.yaml ``` -```yaml + apiVersion: mlops.seldon.io/v1alpha1 kind: Model metadata: @@ -25,30 +25,33 @@ cat ./models/tfsimple2.yaml requirements: - tensorflow memory: 100Ki -``` -```bash -seldon model load -f ./models/tfsimple1.yaml -seldon model load -f ./models/tfsimple2.yaml + + +```python +!seldon model load -f ./models/tfsimple1.yaml +!seldon model load -f ./models/tfsimple2.yaml ``` -```json + {} {} -``` -```bash -seldon model status tfsimple1 -w ModelAvailable | jq -M . -seldon model status tfsimple2 -w ModelAvailable | jq -M . + + +```python +!seldon model status tfsimple1 -w ModelAvailable | jq -M . +!seldon model status tfsimple2 -w ModelAvailable | jq -M . ``` -```json + {} {} -``` -```bash -cat ./pipelines/tfsimples.yaml + + +```python +!cat ./pipelines/tfsimples.yaml ``` -```yaml + apiVersion: mlops.seldon.io/v1alpha1 kind: Pipeline metadata: @@ -65,27 +68,29 @@ cat ./pipelines/tfsimples.yaml output: steps: - tfsimple2 -``` -```bash -seldon pipeline load -f ./pipelines/tfsimples.yaml + + +```python +!seldon pipeline load -f ./pipelines/tfsimples.yaml ``` -```json + {} -``` -```bash -seldon pipeline status tfsimples -w PipelineReady| jq -M . + + +```python +!seldon pipeline status tfsimples -w PipelineReady| jq -M . ``` -```json + { "pipelineName": "tfsimples", "versions": [ { "pipeline": { "name": "tfsimples", - "uid": "cdnuod36qvvc73dlvs5g", - "version": 3, + "uid": "cdqjic9qa12c739ab3og", + "version": 1, "steps": [ { "name": "tfsimple1" @@ -109,21 +114,22 @@ seldon pipeline status tfsimples -w PipelineReady| jq -M . "kubernetesMeta": {} }, "state": { - "pipelineVersion": 3, + "pipelineVersion": 1, "status": "PipelineReady", "reason": "created pipeline", - "lastChangeTimestamp": "2022-11-12T18:55:48.413295092Z" + "lastChangeTimestamp": "2022-11-16T19:25:37.908093300Z" } } ] } -``` -```bash -seldon pipeline infer tfsimples \ + + +```python +!seldon pipeline infer tfsimples \ '{"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]}]}' ``` -```json + { "model_name": "", "outputs": [ @@ -181,21 +187,23 @@ seldon pipeline infer tfsimples \ } ] } -``` -```bash -seldon pipeline infer tfsimples \ + + +```python +!seldon pipeline infer tfsimples \ '{"inputs":[{"name":"INPUT0","data":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],"datatype":"INT32","shape":[1,20]},{"name":"INPUT1","data":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],"datatype":"INT32","shape":[1,16]}]}' ``` -```json + Error: V2 server error: 400 tfsimple1 : rpc error: code = InvalidArgument desc = unexpected shape for input 'INPUT0' for model 'tfsimple1_1'. Expected [-1,16], got [1,20] -``` -```bash -seldon pipeline infer tfsimples --inference-mode grpc \ + + +```python +!seldon pipeline infer tfsimples --inference-mode grpc \ '{"model_name":"simple","inputs":[{"name":"INPUT0","contents":{"int_contents":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},"datatype":"INT32","shape":[1,16]},{"name":"INPUT1","contents":{"int_contents":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},"datatype":"INT32","shape":[1,16]}]}' | jq -M . ``` -```json + { "outputs": [ { @@ -256,16 +264,30 @@ seldon pipeline infer tfsimples --inference-mode grpc \ } ] } -``` -```bash -seldon pipeline infer tfsimples --inference-mode grpc \ + + +```python +!seldon pipeline infer tfsimples --inference-mode grpc \ '{"model_name":"simple","inputs":[{"name":"INPUT0","contents":{"int_contents":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},"datatype":"INT32","shape":[1,20]},{"name":"INPUT1","contents":{"int_contents":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},"datatype":"INT32","shape":[1,16]}]}' ``` -```json + Error: rpc error: code = Unknown desc = tfsimple1 : rpc error: code = InvalidArgument desc = unexpected shape for input 'INPUT0' for model 'tfsimple1_1'. Expected [-1,16], got [1,20] + + + +```python +!seldon pipeline unload tfsimples +!seldon model unload tfsimple1 +!seldon model unload tfsimple2 ``` + {} + {} + {} + + + ```python ``` diff --git a/samples/pipeline-examples.ipynb b/samples/pipeline-examples.ipynb index 921dc6bd03..cda698f761 100644 --- a/samples/pipeline-examples.ipynb +++ b/samples/pipeline-examples.ipynb @@ -63,7 +63,7 @@ }, { "cell_type": "code", - "execution_count": 99, + "execution_count": 2, "id": "f9e073d7", "metadata": {}, "outputs": [ @@ -83,7 +83,7 @@ }, { "cell_type": "code", - "execution_count": 100, + "execution_count": 3, "id": "997b4028", "metadata": {}, "outputs": [ @@ -113,7 +113,7 @@ }, { "cell_type": "code", - "execution_count": 101, + "execution_count": 4, "id": "3d017ede", "metadata": {}, "outputs": [ @@ -146,7 +146,7 @@ }, { "cell_type": "code", - "execution_count": 102, + "execution_count": 5, "id": "following-winning", "metadata": {}, "outputs": [ @@ -164,7 +164,7 @@ }, { "cell_type": "code", - "execution_count": 103, + "execution_count": 6, "id": "artistic-kentucky", "metadata": {}, "outputs": [ @@ -178,7 +178,7 @@ " {\r\n", " \"pipeline\": {\r\n", " \"name\": \"tfsimples\",\r\n", - " \"uid\": \"cd3fu3t69ijcc6s8q630\",\r\n", + " \"uid\": \"cdqjijpqa12c739ab3p0\",\r\n", " \"version\": 1,\r\n", " \"steps\": [\r\n", " {\r\n", @@ -206,7 +206,7 @@ " \"pipelineVersion\": 1,\r\n", " \"status\": \"PipelineReady\",\r\n", " \"reason\": \"created pipeline\",\r\n", - " \"lastChangeTimestamp\": \"2022-10-12T17:53:19.943978110Z\"\r\n", + " \"lastChangeTimestamp\": \"2022-11-16T19:26:08.037067065Z\"\r\n", " }\r\n", " }\r\n", " ]\r\n", @@ -220,7 +220,7 @@ }, { "cell_type": "code", - "execution_count": 104, + "execution_count": 7, "id": "87f10a5c", "metadata": {}, "outputs": [ @@ -295,7 +295,7 @@ }, { "cell_type": "code", - "execution_count": 105, + "execution_count": 8, "id": "5c33133e", "metadata": {}, "outputs": [ @@ -381,7 +381,7 @@ }, { "cell_type": "code", - "execution_count": 106, + "execution_count": 9, "id": "126144a5", "metadata": {}, "outputs": [ @@ -389,12 +389,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "seldon.default.model.tfsimple1.inputs\tcd3fu5jf39s357kil0gg\t{\"inputs\":[{\"name\":\"INPUT0\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}},{\"name\":\"INPUT1\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}}]}\r\n", - "seldon.default.model.tfsimple1.outputs\tcd3fu5jf39s357kil0gg\t{\"modelName\":\"tfsimple1_1\",\"modelVersion\":\"1\",\"outputs\":[{\"name\":\"OUTPUT0\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}},{\"name\":\"OUTPUT1\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}]}\r\n", - "seldon.default.model.tfsimple2.inputs\tcd3fu5jf39s357kil0gg\t{\"inputs\":[{\"name\":\"INPUT0\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}},{\"name\":\"INPUT1\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}],\"rawInputContents\":[\"AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==\",\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==\"]}\r\n", - "seldon.default.model.tfsimple2.outputs\tcd3fu5jf39s357kil0gg\t{\"modelName\":\"tfsimple2_1\",\"modelVersion\":\"1\",\"outputs\":[{\"name\":\"OUTPUT0\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}},{\"name\":\"OUTPUT1\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}}]}\r\n", - "seldon.default.pipeline.tfsimples.inputs\tcd3fu5jf39s357kil0gg\t{\"modelName\":\"tfsimples\",\"inputs\":[{\"name\":\"INPUT0\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}},{\"name\":\"INPUT1\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}}]}\r\n", - "seldon.default.pipeline.tfsimples.outputs\tcd3fu5jf39s357kil0gg\t{\"outputs\":[{\"name\":\"OUTPUT0\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}},{\"name\":\"OUTPUT1\",\"datatype\":\"INT32\",\"shape\":[\"1\",\"16\"],\"contents\":{\"intContents\":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}}]}\r\n" + "seldon.default.model.tfsimple1.inputs\tcdqjilab951s73aqg830\t{\"inputs\":[{\"name\":\"INPUT0\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]}}, {\"name\":\"INPUT1\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]}}]}\r\n", + "seldon.default.model.tfsimple1.outputs\tcdqjilab951s73aqg830\t{\"modelName\":\"tfsimple1_1\", \"modelVersion\":\"1\", \"outputs\":[{\"name\":\"OUTPUT0\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}, {\"name\":\"OUTPUT1\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}}]}\r\n", + "seldon.default.model.tfsimple2.inputs\tcdqjilab951s73aqg830\t{\"inputs\":[{\"name\":\"INPUT0\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}, {\"name\":\"INPUT1\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}}], \"rawInputContents\":[\"AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==\", \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==\"]}\r\n", + "seldon.default.model.tfsimple2.outputs\tcdqjilab951s73aqg830\t{\"modelName\":\"tfsimple2_1\", \"modelVersion\":\"1\", \"outputs\":[{\"name\":\"OUTPUT0\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}, {\"name\":\"OUTPUT1\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}]}\r\n", + "seldon.default.pipeline.tfsimples.inputs\tcdqjilab951s73aqg830\t{\"modelName\":\"tfsimples\", \"inputs\":[{\"name\":\"INPUT0\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]}}, {\"name\":\"INPUT1\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]}}]}\r\n", + "seldon.default.pipeline.tfsimples.outputs\tcdqjilab951s73aqg830\t{\"outputs\":[{\"name\":\"OUTPUT0\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}, {\"name\":\"OUTPUT1\", \"datatype\":\"INT32\", \"shape\":[\"1\", \"16\"], \"contents\":{\"intContents\":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}]}\r\n" ] } ], @@ -412,7 +412,7 @@ }, { "cell_type": "code", - "execution_count": 108, + "execution_count": 10, "id": "10b5bca0", "metadata": {}, "outputs": [ @@ -537,7 +537,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 13, "id": "5e41768d", "metadata": {}, "outputs": [ @@ -587,7 +587,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 14, "id": "fcbc23cc", "metadata": {}, "outputs": [ @@ -609,7 +609,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 15, "id": "f8bb2efb", "metadata": {}, "outputs": [ @@ -639,7 +639,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 16, "id": "cd58ecba", "metadata": {}, "outputs": [ @@ -674,7 +674,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 17, "id": "ce9e163b", "metadata": {}, "outputs": [ @@ -692,7 +692,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 18, "id": "7593c77f", "metadata": {}, "outputs": [ @@ -706,7 +706,7 @@ " {\r\n", " \"pipeline\": {\r\n", " \"name\": \"join\",\r\n", - " \"uid\": \"cd3crroe1k2338n6a7mg\",\r\n", + " \"uid\": \"cdqjit1qa12c739ab3pg\",\r\n", " \"version\": 1,\r\n", " \"steps\": [\r\n", " {\r\n", @@ -738,7 +738,7 @@ " \"pipelineVersion\": 1,\r\n", " \"status\": \"PipelineReady\",\r\n", " \"reason\": \"created pipeline\",\r\n", - " \"lastChangeTimestamp\": \"2022-10-12T14:23:43.855021293Z\"\r\n", + " \"lastChangeTimestamp\": \"2022-11-16T19:26:44.706282241Z\"\r\n", " }\r\n", " }\r\n", " ]\r\n", @@ -760,7 +760,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 19, "id": "2151ee4c", "metadata": { "scrolled": true @@ -840,7 +840,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 20, "id": "06575cca", "metadata": {}, "outputs": [ @@ -858,7 +858,7 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": 21, "id": "8bd56a9c", "metadata": {}, "outputs": [ @@ -890,7 +890,7 @@ }, { "cell_type": "code", - "execution_count": 89, + "execution_count": 22, "id": "e3a2c7f3", "metadata": {}, "outputs": [ @@ -940,7 +940,7 @@ }, { "cell_type": "code", - "execution_count": 90, + "execution_count": 23, "id": "2104f9bf", "metadata": {}, "outputs": [ @@ -962,7 +962,7 @@ }, { "cell_type": "code", - "execution_count": 91, + "execution_count": 24, "id": "7af88e3a", "metadata": {}, "outputs": [ @@ -992,7 +992,7 @@ }, { "cell_type": "code", - "execution_count": 92, + "execution_count": 25, "id": "f5bbe84d", "metadata": {}, "outputs": [ @@ -1031,7 +1031,7 @@ }, { "cell_type": "code", - "execution_count": 93, + "execution_count": 26, "id": "829f9b18", "metadata": {}, "outputs": [ @@ -1049,7 +1049,7 @@ }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 27, "id": "ae202d26", "metadata": {}, "outputs": [ @@ -1063,7 +1063,7 @@ " {\r\n", " \"pipeline\": {\r\n", " \"name\": \"tfsimple-conditional\",\r\n", - " \"uid\": \"cd3fo8t69ijcc6s8q62g\",\r\n", + " \"uid\": \"cdqjj21qa12c739ab3q0\",\r\n", " \"version\": 1,\r\n", " \"steps\": [\r\n", " {\r\n", @@ -1101,7 +1101,7 @@ " \"pipelineVersion\": 1,\r\n", " \"status\": \"PipelineReady\",\r\n", " \"reason\": \"created pipeline\",\r\n", - " \"lastChangeTimestamp\": \"2022-10-12T17:40:52.098565458Z\"\r\n", + " \"lastChangeTimestamp\": \"2022-11-16T19:27:04.928498607Z\"\r\n", " }\r\n", " }\r\n", " ]\r\n", @@ -1123,7 +1123,7 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 28, "id": "0d03d5fe", "metadata": {}, "outputs": [ @@ -1168,7 +1168,7 @@ }, { "cell_type": "code", - "execution_count": 96, + "execution_count": 29, "id": "def4e8e1", "metadata": {}, "outputs": [ @@ -1205,7 +1205,7 @@ }, { "cell_type": "code", - "execution_count": 97, + "execution_count": 30, "id": "3042fe42", "metadata": {}, "outputs": [ @@ -1223,7 +1223,7 @@ }, { "cell_type": "code", - "execution_count": 98, + "execution_count": 31, "id": "3bda8710", "metadata": {}, "outputs": [ @@ -1254,7 +1254,7 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 32, "id": "baa2cb5f", "metadata": { "scrolled": true @@ -1294,7 +1294,7 @@ }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 33, "id": "33692146", "metadata": {}, "outputs": [ @@ -1314,7 +1314,7 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 34, "id": "e0493925", "metadata": {}, "outputs": [ @@ -1342,7 +1342,7 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": 35, "id": "c8d27ff3", "metadata": {}, "outputs": [ @@ -1380,7 +1380,7 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 36, "id": "74768602", "metadata": {}, "outputs": [ @@ -1398,7 +1398,7 @@ }, { "cell_type": "code", - "execution_count": 73, + "execution_count": 37, "id": "922b975e", "metadata": {}, "outputs": [ @@ -1412,7 +1412,7 @@ " {\r\n", " \"pipeline\": {\r\n", " \"name\": \"pipeline-inputs\",\r\n", - " \"uid\": \"cd3fgmge1k2338n6a7p0\",\r\n", + " \"uid\": \"cdqjj89qa12c739ab3qg\",\r\n", " \"version\": 1,\r\n", " \"steps\": [\r\n", " {\r\n", @@ -1446,7 +1446,7 @@ " \"pipelineVersion\": 1,\r\n", " \"status\": \"PipelineReady\",\r\n", " \"reason\": \"created pipeline\",\r\n", - " \"lastChangeTimestamp\": \"2022-10-12T17:24:42.901433282Z\"\r\n", + " \"lastChangeTimestamp\": \"2022-11-16T19:27:30.024128982Z\"\r\n", " }\r\n", " }\r\n", " ]\r\n", @@ -1460,7 +1460,7 @@ }, { "cell_type": "code", - "execution_count": 74, + "execution_count": 38, "id": "792680b5", "metadata": {}, "outputs": [ @@ -1512,7 +1512,7 @@ }, { "cell_type": "code", - "execution_count": 75, + "execution_count": 39, "id": "d6fd0d45", "metadata": {}, "outputs": [ @@ -1530,7 +1530,7 @@ }, { "cell_type": "code", - "execution_count": 76, + "execution_count": 40, "id": "3d5bb23c", "metadata": {}, "outputs": [ @@ -1560,7 +1560,7 @@ }, { "cell_type": "code", - "execution_count": 77, + "execution_count": 41, "id": "1a09de5c", "metadata": { "scrolled": true @@ -1598,7 +1598,7 @@ }, { "cell_type": "code", - "execution_count": 78, + "execution_count": 42, "id": "85eb4ef2", "metadata": {}, "outputs": [ @@ -1618,7 +1618,7 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": 43, "id": "d11e29c6", "metadata": {}, "outputs": [ @@ -1646,7 +1646,7 @@ }, { "cell_type": "code", - "execution_count": 80, + "execution_count": 44, "id": "227e06e4", "metadata": {}, "outputs": [ @@ -1686,7 +1686,7 @@ }, { "cell_type": "code", - "execution_count": 81, + "execution_count": 45, "id": "2bce48e8", "metadata": {}, "outputs": [ @@ -1704,7 +1704,7 @@ }, { "cell_type": "code", - "execution_count": 82, + "execution_count": 46, "id": "66c60286", "metadata": {}, "outputs": [ @@ -1718,7 +1718,7 @@ " {\r\n", " \"pipeline\": {\r\n", " \"name\": \"trigger-joins\",\r\n", - " \"uid\": \"cd3fhc8e1k2338n6a7pg\",\r\n", + " \"uid\": \"cdqjjdpqa12c739ab3r0\",\r\n", " \"version\": 1,\r\n", " \"steps\": [\r\n", " {\r\n", @@ -1755,7 +1755,7 @@ " \"pipelineVersion\": 1,\r\n", " \"status\": \"PipelineReady\",\r\n", " \"reason\": \"created pipeline\",\r\n", - " \"lastChangeTimestamp\": \"2022-10-12T17:26:10.325213017Z\"\r\n", + " \"lastChangeTimestamp\": \"2022-11-16T19:27:51.550445363Z\"\r\n", " }\r\n", " }\r\n", " ]\r\n", @@ -1769,7 +1769,7 @@ }, { "cell_type": "code", - "execution_count": 83, + "execution_count": 47, "id": "403fcbd5", "metadata": {}, "outputs": [ @@ -1806,7 +1806,7 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 48, "id": "fdba4c3c", "metadata": {}, "outputs": [ @@ -1843,7 +1843,7 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": 49, "id": "52a2bfd0", "metadata": {}, "outputs": [ @@ -1861,7 +1861,7 @@ }, { "cell_type": "code", - "execution_count": 86, + "execution_count": 50, "id": "914d23f5", "metadata": {}, "outputs": [ @@ -1904,7 +1904,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/samples/pipeline-examples.md b/samples/pipeline-examples.md index e0246385cf..a72fa0a9e8 100644 --- a/samples/pipeline-examples.md +++ b/samples/pipeline-examples.md @@ -103,7 +103,7 @@ The output of the Pipeline is the output from `tfsimple2`. { "pipeline": { "name": "tfsimples", - "uid": "cd3fu3t69ijcc6s8q630", + "uid": "cdqjijpqa12c739ab3p0", "version": 1, "steps": [ { @@ -131,7 +131,7 @@ The output of the Pipeline is the output from `tfsimple2`. "pipelineVersion": 1, "status": "PipelineReady", "reason": "created pipeline", - "lastChangeTimestamp": "2022-10-12T17:53:19.943978110Z" + "lastChangeTimestamp": "2022-11-16T19:26:08.037067065Z" } } ] @@ -278,12 +278,12 @@ We use the Seldon CLI `pipeline inspect` feature to look at the data for all ste !seldon pipeline inspect tfsimples ``` - seldon.default.model.tfsimple1.inputs cd3fu5jf39s357kil0gg {"inputs":[{"name":"INPUT0","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}},{"name":"INPUT1","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}}]} - seldon.default.model.tfsimple1.outputs cd3fu5jf39s357kil0gg {"modelName":"tfsimple1_1","modelVersion":"1","outputs":[{"name":"OUTPUT0","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}},{"name":"OUTPUT1","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}]} - seldon.default.model.tfsimple2.inputs cd3fu5jf39s357kil0gg {"inputs":[{"name":"INPUT0","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}},{"name":"INPUT1","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}],"rawInputContents":["AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==","AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="]} - seldon.default.model.tfsimple2.outputs cd3fu5jf39s357kil0gg {"modelName":"tfsimple2_1","modelVersion":"1","outputs":[{"name":"OUTPUT0","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}},{"name":"OUTPUT1","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}}]} - seldon.default.pipeline.tfsimples.inputs cd3fu5jf39s357kil0gg {"modelName":"tfsimples","inputs":[{"name":"INPUT0","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}},{"name":"INPUT1","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}}]} - seldon.default.pipeline.tfsimples.outputs cd3fu5jf39s357kil0gg {"outputs":[{"name":"OUTPUT0","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}},{"name":"OUTPUT1","datatype":"INT32","shape":["1","16"],"contents":{"intContents":[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]}}]} + seldon.default.model.tfsimple1.inputs cdqjilab951s73aqg830 {"inputs":[{"name":"INPUT0", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]}}, {"name":"INPUT1", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]}}]} + seldon.default.model.tfsimple1.outputs cdqjilab951s73aqg830 {"modelName":"tfsimple1_1", "modelVersion":"1", "outputs":[{"name":"OUTPUT0", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}, {"name":"OUTPUT1", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}}]} + seldon.default.model.tfsimple2.inputs cdqjilab951s73aqg830 {"inputs":[{"name":"INPUT0", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}, {"name":"INPUT1", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}}], "rawInputContents":["AgAAAAQAAAAGAAAACAAAAAoAAAAMAAAADgAAABAAAAASAAAAFAAAABYAAAAYAAAAGgAAABwAAAAeAAAAIAAAAA==", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="]} + seldon.default.model.tfsimple2.outputs cdqjilab951s73aqg830 {"modelName":"tfsimple2_1", "modelVersion":"1", "outputs":[{"name":"OUTPUT0", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}, {"name":"OUTPUT1", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}]} + seldon.default.pipeline.tfsimples.inputs cdqjilab951s73aqg830 {"modelName":"tfsimples", "inputs":[{"name":"INPUT0", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]}}, {"name":"INPUT1", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]}}]} + seldon.default.pipeline.tfsimples.outputs cdqjilab951s73aqg830 {"outputs":[{"name":"OUTPUT0", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}, {"name":"OUTPUT1", "datatype":"INT32", "shape":["1", "16"], "contents":{"intContents":[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]}}]} Next, we look get the output as json and use the `jq` tool to get just one value. @@ -487,7 +487,7 @@ In the pipeline below for the input to `tfsimple3` we join 1 output tensor each { "pipeline": { "name": "join", - "uid": "cd3crroe1k2338n6a7mg", + "uid": "cdqjit1qa12c739ab3pg", "version": 1, "steps": [ { @@ -519,7 +519,7 @@ In the pipeline below for the input to `tfsimple3` we join 1 output tensor each "pipelineVersion": 1, "status": "PipelineReady", "reason": "created pipeline", - "lastChangeTimestamp": "2022-10-12T14:23:43.855021293Z" + "lastChangeTimestamp": "2022-11-16T19:26:44.706282241Z" } } ] @@ -734,7 +734,7 @@ Here we assume the `conditional` model can output two tensors OUTPUT0 and OUTPUT { "pipeline": { "name": "tfsimple-conditional", - "uid": "cd3fo8t69ijcc6s8q62g", + "uid": "cdqjj21qa12c739ab3q0", "version": 1, "steps": [ { @@ -772,7 +772,7 @@ Here we assume the `conditional` model can output two tensors OUTPUT0 and OUTPUT "pipelineVersion": 1, "status": "PipelineReady", "reason": "created pipeline", - "lastChangeTimestamp": "2022-10-12T17:40:52.098565458Z" + "lastChangeTimestamp": "2022-11-16T19:27:04.928498607Z" } } ] @@ -957,7 +957,7 @@ This pipeline shows how we can access pipeline inputs INPUT0 and INPUT1 from dif { "pipeline": { "name": "pipeline-inputs", - "uid": "cd3fgmge1k2338n6a7p0", + "uid": "cdqjj89qa12c739ab3qg", "version": 1, "steps": [ { @@ -991,7 +991,7 @@ This pipeline shows how we can access pipeline inputs INPUT0 and INPUT1 from dif "pipelineVersion": 1, "status": "PipelineReady", "reason": "created pipeline", - "lastChangeTimestamp": "2022-10-12T17:24:42.901433282Z" + "lastChangeTimestamp": "2022-11-16T19:27:30.024128982Z" } } ] @@ -1159,7 +1159,7 @@ Here we required tensors names `ok1` or `ok2` to exist on pipeline inputs to run { "pipeline": { "name": "trigger-joins", - "uid": "cd3fhc8e1k2338n6a7pg", + "uid": "cdqjjdpqa12c739ab3r0", "version": 1, "steps": [ { @@ -1196,7 +1196,7 @@ Here we required tensors names `ok1` or `ok2` to exist on pipeline inputs to run "pipelineVersion": 1, "status": "PipelineReady", "reason": "created pipeline", - "lastChangeTimestamp": "2022-10-12T17:26:10.325213017Z" + "lastChangeTimestamp": "2022-11-16T19:27:51.550445363Z" } } ] diff --git a/samples/pipeline-versions.ipynb b/samples/pipeline-versions.ipynb index 2642cd296c..9d9358db1e 100644 --- a/samples/pipeline-versions.ipynb +++ b/samples/pipeline-versions.ipynb @@ -18,7 +18,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "/home/clive/work/scv2/seldon-core-v2/operator/bin/seldon\r\n" + "/home/clive/seldon/scv2/seldon-core-v2/operator/bin/seldon\r\n" ] } ], @@ -139,7 +139,7 @@ " {\r\n", " \"pipeline\": {\r\n", " \"name\": \"version-test\",\r\n", - " \"uid\": \"cc5mrl9qre8m6toksbcg\",\r\n", + " \"uid\": \"cdqjjkpqa12c739ab3rg\",\r\n", " \"version\": 1,\r\n", " \"steps\": [\r\n", " {\r\n", @@ -157,7 +157,7 @@ " \"pipelineVersion\": 1,\r\n", " \"status\": \"PipelineReady\",\r\n", " \"reason\": \"created pipeline\",\r\n", - " \"lastChangeTimestamp\": \"2022-08-28T13:29:58.003183799Z\"\r\n", + " \"lastChangeTimestamp\": \"2022-11-16T19:28:19.459332175Z\"\r\n", " }\r\n", " }\r\n", " ]\r\n", @@ -171,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 7, "id": "0d03d5fe", "metadata": {}, "outputs": [ @@ -196,9 +196,6 @@ " ]\r\n", " }\r\n", " }\r\n", - " ],\r\n", - " \"rawOutputContents\": [\r\n", - " \"AAAwQQAAQEEAAFBBAABgQQ==\"\r\n", " ]\r\n", "}\r\n" ] @@ -211,7 +208,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 8, "id": "1d9878b5", "metadata": {}, "outputs": [ @@ -238,7 +235,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 9, "id": "a1d77358", "metadata": {}, "outputs": [ @@ -256,7 +253,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 10, "id": "8b92a65c", "metadata": {}, "outputs": [ @@ -270,7 +267,7 @@ " {\r\n", " \"pipeline\": {\r\n", " \"name\": \"version-test\",\r\n", - " \"uid\": \"cc5msjhqre8m6toksbd0\",\r\n", + " \"uid\": \"cdqjjmpqa12c739ab3s0\",\r\n", " \"version\": 2,\r\n", " \"steps\": [\r\n", " {\r\n", @@ -288,7 +285,7 @@ " \"pipelineVersion\": 2,\r\n", " \"status\": \"PipelineReady\",\r\n", " \"reason\": \"created pipeline\",\r\n", - " \"lastChangeTimestamp\": \"2022-08-28T13:31:58.421910021Z\"\r\n", + " \"lastChangeTimestamp\": \"2022-11-16T19:28:27.768169880Z\"\r\n", " }\r\n", " }\r\n", " ]\r\n", @@ -302,7 +299,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 11, "id": "73e78ada", "metadata": {}, "outputs": [ @@ -327,9 +324,6 @@ " ]\r\n", " }\r\n", " }\r\n", - " ],\r\n", - " \"rawOutputContents\": [\r\n", - " \"AAAgQQAAoEEAAPBBAAAgQg==\"\r\n", " ]\r\n", "}\r\n" ] @@ -342,7 +336,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 12, "id": "77c8cb8d", "metadata": {}, "outputs": [ @@ -360,7 +354,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 13, "id": "cec42a5b", "metadata": { "scrolled": true @@ -376,7 +370,7 @@ " {\r\n", " \"pipeline\": {\r\n", " \"name\": \"version-test\",\r\n", - " \"uid\": \"cc5mt1hqre8m6toksbdg\",\r\n", + " \"uid\": \"cdqjjo9qa12c739ab3sg\",\r\n", " \"version\": 3,\r\n", " \"steps\": [\r\n", " {\r\n", @@ -394,7 +388,7 @@ " \"pipelineVersion\": 3,\r\n", " \"status\": \"PipelineReady\",\r\n", " \"reason\": \"created pipeline\",\r\n", - " \"lastChangeTimestamp\": \"2022-08-28T13:32:54.897566298Z\"\r\n", + " \"lastChangeTimestamp\": \"2022-11-16T19:28:33.139405433Z\"\r\n", " }\r\n", " }\r\n", " ]\r\n", @@ -408,7 +402,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 14, "id": "2e54f9b1", "metadata": {}, "outputs": [ @@ -433,9 +427,6 @@ " ]\r\n", " }\r\n", " }\r\n", - " ],\r\n", - " \"rawOutputContents\": [\r\n", - " \"AAAwQQAAQEEAAFBBAABgQQ==\"\r\n", " ]\r\n", "}\r\n" ] @@ -448,7 +439,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 15, "id": "ea766ec6", "metadata": {}, "outputs": [ @@ -466,7 +457,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 16, "id": "5e597644", "metadata": {}, "outputs": [ @@ -509,7 +500,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/samples/pipeline-versions.md b/samples/pipeline-versions.md index 89a477e3d9..589fa1bf65 100644 --- a/samples/pipeline-versions.md +++ b/samples/pipeline-versions.md @@ -6,7 +6,7 @@ !which seldon ``` - /home/clive/work/scv2/seldon-core-v2/operator/bin/seldon + /home/clive/seldon/scv2/seldon-core-v2/operator/bin/seldon ### Model Join @@ -69,7 +69,7 @@ Join two flows of data from two models as input to a third model. { "pipeline": { "name": "version-test", - "uid": "cc5mrl9qre8m6toksbcg", + "uid": "cdqjjkpqa12c739ab3rg", "version": 1, "steps": [ { @@ -87,7 +87,7 @@ Join two flows of data from two models as input to a third model. "pipelineVersion": 1, "status": "PipelineReady", "reason": "created pipeline", - "lastChangeTimestamp": "2022-08-28T13:29:58.003183799Z" + "lastChangeTimestamp": "2022-11-16T19:28:19.459332175Z" } } ] @@ -117,9 +117,6 @@ Join two flows of data from two models as input to a third model. ] } } - ], - "rawOutputContents": [ - "AAAwQQAAQEEAAFBBAABgQQ==" ] } @@ -160,7 +157,7 @@ Join two flows of data from two models as input to a third model. { "pipeline": { "name": "version-test", - "uid": "cc5msjhqre8m6toksbd0", + "uid": "cdqjjmpqa12c739ab3s0", "version": 2, "steps": [ { @@ -178,7 +175,7 @@ Join two flows of data from two models as input to a third model. "pipelineVersion": 2, "status": "PipelineReady", "reason": "created pipeline", - "lastChangeTimestamp": "2022-08-28T13:31:58.421910021Z" + "lastChangeTimestamp": "2022-11-16T19:28:27.768169880Z" } } ] @@ -208,9 +205,6 @@ Join two flows of data from two models as input to a third model. ] } } - ], - "rawOutputContents": [ - "AAAgQQAAoEEAAPBBAAAgQg==" ] } @@ -234,7 +228,7 @@ Join two flows of data from two models as input to a third model. { "pipeline": { "name": "version-test", - "uid": "cc5mt1hqre8m6toksbdg", + "uid": "cdqjjo9qa12c739ab3sg", "version": 3, "steps": [ { @@ -252,7 +246,7 @@ Join two flows of data from two models as input to a third model. "pipelineVersion": 3, "status": "PipelineReady", "reason": "created pipeline", - "lastChangeTimestamp": "2022-08-28T13:32:54.897566298Z" + "lastChangeTimestamp": "2022-11-16T19:28:33.139405433Z" } } ] @@ -282,9 +276,6 @@ Join two flows of data from two models as input to a third model. ] } } - ], - "rawOutputContents": [ - "AAAwQQAAQEEAAFBBAABgQQ==" ] } diff --git a/samples/pipelines/error-empty-input.yaml b/samples/pipelines/error-empty-input.yaml new file mode 100644 index 0000000000..9fa13a19a9 --- /dev/null +++ b/samples/pipelines/error-empty-input.yaml @@ -0,0 +1,13 @@ +apiVersion: mlops.seldon.io/v1alpha1 +kind: Pipeline +metadata: + name: iris-pipeline +spec: + steps: + - name: first + - name: second + inputs: + - + output: + steps: + - iris diff --git a/samples/pipelines/error-empty-trigger.yaml b/samples/pipelines/error-empty-trigger.yaml new file mode 100644 index 0000000000..ec7ad34333 --- /dev/null +++ b/samples/pipelines/error-empty-trigger.yaml @@ -0,0 +1,16 @@ +apiVersion: mlops.seldon.io/v1alpha1 +kind: Pipeline +metadata: + name: iris-pipeline +spec: + steps: + - name: first + - name: second + - name: third + inputs: + - first + triggers: + - + output: + steps: + - iris diff --git a/samples/python-examples.ipynb b/samples/python-examples.ipynb index 8819ced602..6be34ae48f 100644 --- a/samples/python-examples.ipynb +++ b/samples/python-examples.ipynb @@ -20,8 +20,15 @@ "name": "stderr", "output_type": "stream", "text": [ - "2022-05-26 09:57:27.920987: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory\n", - "2022-05-26 09:57:27.921017: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.\n" + "2022-11-16 19:28:57.916579: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX_VNNI FMA\n", + "To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n", + "2022-11-16 19:28:58.079213: I tensorflow/core/util/util.cc:169] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.\n", + "2022-11-16 19:28:58.123952: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory\n", + "2022-11-16 19:28:58.123978: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.\n", + "2022-11-16 19:28:58.159891: E tensorflow/stream_executor/cuda/cuda_blas.cc:2981] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n", + "2022-11-16 19:28:58.870452: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory\n", + "2022-11-16 19:28:58.870490: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory\n", + "2022-11-16 19:28:58.870493: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.\n" ] } ], @@ -45,6 +52,8 @@ "name": "stdout", "output_type": "stream", "text": [ + "Downloading data from https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz\n", + "170498071/170498071 [==============================] - 9s 0us/step\n", "(50000, 32, 32, 3) (50000, 1) (10000, 32, 32, 3) (10000, 1)\n" ] } @@ -73,7 +82,6 @@ "kind: Model\r\n", "metadata:\r\n", " name: cifar10\r\n", - " namespace: seldon-mesh\r\n", "spec:\r\n", " storageUri: \"gs://seldon-models/triton/tf_cifar10\"\r\n", " requirements:\r\n", @@ -87,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 4, "id": "4bddb7ed", "metadata": {}, "outputs": [ @@ -105,7 +113,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 5, "id": "5d5c9181", "metadata": {}, "outputs": [ @@ -123,7 +131,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 6, "id": "838fca72", "metadata": {}, "outputs": [], @@ -135,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 7, "id": "a60c2151", "metadata": {}, "outputs": [], @@ -148,7 +156,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 8, "id": "60d15624", "metadata": {}, "outputs": [ @@ -157,7 +165,7 @@ "output_type": "stream", "text": [ "\n", - "{'model_name': 'cifar10_1', 'model_version': '1', 'outputs': [{'name': 'fc10', 'datatype': 'FP32', 'shape': [2, 10], 'data': [1.4500079359436313e-08, 1.2525738224411498e-09, 1.6298378113788203e-07, 0.11529320478439331, 1.743132713727391e-07, 6.185641723277513e-06, 0.8847001194953918, 6.073898273228906e-09, 7.437883908778531e-08, 4.7317194606932844e-09, 1.2644793514482444e-06, 4.8814308151179375e-09, 1.5153264198985994e-09, 8.490526504090212e-09, 5.51305612273012e-10, 1.1617105055705679e-09, 5.772862743391727e-10, 2.8839471610808687e-07, 0.0006148922257125378, 0.9993835687637329]}]}\n" + "{'model_name': 'cifar10_1', 'model_version': '1', 'outputs': [{'name': 'fc10', 'datatype': 'FP32', 'shape': [2, 10], 'data': [1.4500082023971572e-08, 1.252571490972798e-09, 1.6298334060138586e-07, 0.11529310792684555, 1.7431312926419196e-07, 6.185642178024864e-06, 0.8847002387046814, 6.0738876150878696e-09, 7.437885329864002e-08, 4.731711022998297e-09, 1.2644841262954287e-06, 4.881440140991344e-09, 1.51533230408063e-09, 8.490559366691741e-09, 5.51305612273012e-10, 1.1617149464626664e-09, 5.772873845621973e-10, 2.8839554033766035e-07, 0.0006148957181721926, 0.9993835687637329]}]}\n" ] } ], @@ -169,7 +177,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 9, "id": "2b93057d", "metadata": {}, "outputs": [ @@ -210,7 +218,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/samples/python-examples.md b/samples/python-examples.md index 0f9c27482b..06dd092ecc 100644 --- a/samples/python-examples.md +++ b/samples/python-examples.md @@ -13,8 +13,15 @@ import tensorflow as tf tf.keras.backend.clear_session() ``` - 2022-05-26 09:57:27.920987: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory - 2022-05-26 09:57:27.921017: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. + 2022-11-16 19:28:57.916579: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX_VNNI FMA + To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. + 2022-11-16 19:28:58.079213: I tensorflow/core/util/util.cc:169] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. + 2022-11-16 19:28:58.123952: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory + 2022-11-16 19:28:58.123978: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. + 2022-11-16 19:28:58.159891: E tensorflow/stream_executor/cuda/cuda_blas.cc:2981] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered + 2022-11-16 19:28:58.870452: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory + 2022-11-16 19:28:58.870490: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory + 2022-11-16 19:28:58.870493: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly. @@ -28,6 +35,8 @@ X_test = X_test.astype('float32') / 255 print(X_train.shape, y_train.shape, X_test.shape, y_test.shape) ``` + Downloading data from https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz + 170498071/170498071 [==============================] - 9s 0us/step (50000, 32, 32, 3) (50000, 1) (10000, 32, 32, 3) (10000, 1) @@ -40,7 +49,6 @@ print(X_train.shape, y_train.shape, X_test.shape, y_test.shape) kind: Model metadata: name: cifar10 - namespace: seldon-mesh spec: storageUri: "gs://seldon-models/triton/tf_cifar10" requirements: @@ -86,7 +94,7 @@ print(response_raw.json()) ``` - {'model_name': 'cifar10_1', 'model_version': '1', 'outputs': [{'name': 'fc10', 'datatype': 'FP32', 'shape': [2, 10], 'data': [1.4500079359436313e-08, 1.2525738224411498e-09, 1.6298378113788203e-07, 0.11529320478439331, 1.743132713727391e-07, 6.185641723277513e-06, 0.8847001194953918, 6.073898273228906e-09, 7.437883908778531e-08, 4.7317194606932844e-09, 1.2644793514482444e-06, 4.8814308151179375e-09, 1.5153264198985994e-09, 8.490526504090212e-09, 5.51305612273012e-10, 1.1617105055705679e-09, 5.772862743391727e-10, 2.8839471610808687e-07, 0.0006148922257125378, 0.9993835687637329]}]} + {'model_name': 'cifar10_1', 'model_version': '1', 'outputs': [{'name': 'fc10', 'datatype': 'FP32', 'shape': [2, 10], 'data': [1.4500082023971572e-08, 1.252571490972798e-09, 1.6298334060138586e-07, 0.11529310792684555, 1.7431312926419196e-07, 6.185642178024864e-06, 0.8847002387046814, 6.0738876150878696e-09, 7.437885329864002e-08, 4.731711022998297e-09, 1.2644841262954287e-06, 4.881440140991344e-09, 1.51533230408063e-09, 8.490559366691741e-09, 5.51305612273012e-10, 1.1617149464626664e-09, 5.772873845621973e-10, 2.8839554033766035e-07, 0.0006148957181721926, 0.9993835687637329]}]} diff --git a/samples/rolling-update.ipynb b/samples/rolling-update.ipynb index 3dd121bb47..5f619dc18f 100644 --- a/samples/rolling-update.ipynb +++ b/samples/rolling-update.ipynb @@ -33,7 +33,7 @@ "{\n", "\t\"model_name\": \"iris_1\",\n", "\t\"model_version\": \"1\",\n", - "\t\"id\": \"d17c062e-6c19-43a6-812a-43aa46c2b109\",\n", + "\t\"id\": \"20aee4f5-fbc0-4406-9b2f-04e729f6bc78\",\n", "\t\"parameters\": {\n", "\t\t\"content_type\": null,\n", "\t\t\"headers\": null\n", @@ -73,7 +73,7 @@ "output_type": "stream", "text": [ "{}\n", - "Success: map[:iris_1::362 :iris_2::1782]\n" + "Success: map[:iris_1::428 :iris_2::1958]\n" ] } ], @@ -85,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": 113, + "execution_count": 3, "id": "ceramic-illness", "metadata": {}, "outputs": [ diff --git a/samples/rolling-update.md b/samples/rolling-update.md index c35077e39e..90f3853152 100644 --- a/samples/rolling-update.md +++ b/samples/rolling-update.md @@ -18,7 +18,7 @@ We use a simple sklearn iris classification model and do a rolling update { "model_name": "iris_1", "model_version": "1", - "id": "d17c062e-6c19-43a6-812a-43aa46c2b109", + "id": "20aee4f5-fbc0-4406-9b2f-04e729f6bc78", "parameters": { "content_type": null, "headers": null @@ -47,7 +47,7 @@ We use a simple sklearn iris classification model and do a rolling update ``` {} - Success: map[:iris_1::362 :iris_2::1782] + Success: map[:iris_1::428 :iris_2::1958] diff --git a/samples/trigger_joins.ipynb b/samples/trigger_joins.ipynb index ffaa1f8b75..353cef11d4 100644 --- a/samples/trigger_joins.ipynb +++ b/samples/trigger_joins.ipynb @@ -4,7 +4,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Trigger Joins" + "## Trigger Joins\n", + "\n", + "In this notebook we show use of trigger joins of type \"any\" where we wait for any of the inputs tobe present. We illustrate where we send various combinations of 2 inputs and show we always get an output." ] }, { @@ -115,7 +117,7 @@ " \u001b[1;39m{\r\n", " \u001b[0m\u001b[34;1m\"pipeline\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m{\r\n", " \u001b[0m\u001b[34;1m\"name\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"triggers_join_inputs\"\u001b[0m\u001b[1;39m,\r\n", - " \u001b[0m\u001b[34;1m\"uid\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"cbmbfial0p8os8jr7ds0\"\u001b[0m\u001b[1;39m,\r\n", + " \u001b[0m\u001b[34;1m\"uid\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"cdqjkdhqa12c739ab3t0\"\u001b[0m\u001b[1;39m,\r\n", " \u001b[0m\u001b[34;1m\"version\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;39m1\u001b[0m\u001b[1;39m,\r\n", " \u001b[0m\u001b[34;1m\"steps\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m[\r\n", " \u001b[1;39m{\r\n", @@ -141,8 +143,8 @@ " \u001b[0m\u001b[34;1m\"state\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m{\r\n", " \u001b[0m\u001b[34;1m\"pipelineVersion\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;39m1\u001b[0m\u001b[1;39m,\r\n", " \u001b[0m\u001b[34;1m\"status\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"PipelineReady\"\u001b[0m\u001b[1;39m,\r\n", - " \u001b[0m\u001b[34;1m\"reason\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"Created pipeline\"\u001b[0m\u001b[1;39m,\r\n", - " \u001b[0m\u001b[34;1m\"lastChangeTimestamp\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"2022-08-05T06:25:14.011256855Z\"\u001b[0m\u001b[1;39m\r\n", + " \u001b[0m\u001b[34;1m\"reason\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"created pipeline\"\u001b[0m\u001b[1;39m,\r\n", + " \u001b[0m\u001b[34;1m\"lastChangeTimestamp\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"2022-11-16T19:29:58.778539435Z\"\u001b[0m\u001b[1;39m\r\n", " \u001b[1;39m}\u001b[0m\u001b[1;39m\r\n", " \u001b[1;39m}\u001b[0m\u001b[1;39m\r\n", " \u001b[1;39m]\u001b[0m\u001b[1;39m\r\n", @@ -196,7 +198,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\"outputs\":[{\"name\":\"OUTPUT1\",\"datatype\":\"INT64\",\"shape\":[\"1\"],\"contents\":{\"int64Contents\":[\"2\"]}}],\"rawOutputContents\":[\"AgAAAAAAAAA=\"]}\r\n" + "{\"outputs\":[{\"name\":\"OUTPUT1\", \"datatype\":\"INT64\", \"shape\":[\"1\"], \"contents\":{\"int64Contents\":[\"2\"]}}]}\r\n" ] } ], @@ -215,7 +217,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\"outputs\":[{\"name\":\"OUTPUT1\",\"datatype\":\"INT64\",\"shape\":[\"1\"],\"contents\":{\"int64Contents\":[\"2\"]}}],\"rawOutputContents\":[\"AgAAAAAAAAA=\"]}\r\n" + "{\"outputs\":[{\"name\":\"OUTPUT1\", \"datatype\":\"INT64\", \"shape\":[\"1\"], \"contents\":{\"int64Contents\":[\"2\"]}}]}\r\n" ] } ], @@ -234,7 +236,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\"outputs\":[{\"name\":\"OUTPUT1\",\"datatype\":\"INT64\",\"shape\":[\"1\"],\"contents\":{\"int64Contents\":[\"2\"]}}],\"rawOutputContents\":[\"AgAAAAAAAAA=\"]}\r\n" + "{\"outputs\":[{\"name\":\"OUTPUT1\", \"datatype\":\"INT64\", \"shape\":[\"1\"], \"contents\":{\"int64Contents\":[\"2\"]}}]}\r\n" ] } ], @@ -293,7 +295,7 @@ " \u001b[1;39m{\r\n", " \u001b[0m\u001b[34;1m\"pipeline\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m{\r\n", " \u001b[0m\u001b[34;1m\"name\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"triggers_join_internal\"\u001b[0m\u001b[1;39m,\r\n", - " \u001b[0m\u001b[34;1m\"uid\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"cbmbfm2l0p8os8jr7dsg\"\u001b[0m\u001b[1;39m,\r\n", + " \u001b[0m\u001b[34;1m\"uid\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"cdqjkqpqa12c739ab3tg\"\u001b[0m\u001b[1;39m,\r\n", " \u001b[0m\u001b[34;1m\"version\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;39m1\u001b[0m\u001b[1;39m,\r\n", " \u001b[0m\u001b[34;1m\"steps\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m[\r\n", " \u001b[1;39m{\r\n", @@ -337,8 +339,8 @@ " \u001b[0m\u001b[34;1m\"state\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[1;39m{\r\n", " \u001b[0m\u001b[34;1m\"pipelineVersion\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;39m1\u001b[0m\u001b[1;39m,\r\n", " \u001b[0m\u001b[34;1m\"status\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"PipelineReady\"\u001b[0m\u001b[1;39m,\r\n", - " \u001b[0m\u001b[34;1m\"reason\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"Created pipeline\"\u001b[0m\u001b[1;39m,\r\n", - " \u001b[0m\u001b[34;1m\"lastChangeTimestamp\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"2022-08-05T06:25:29.114592623Z\"\u001b[0m\u001b[1;39m\r\n", + " \u001b[0m\u001b[34;1m\"reason\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"created pipeline\"\u001b[0m\u001b[1;39m,\r\n", + " \u001b[0m\u001b[34;1m\"lastChangeTimestamp\"\u001b[0m\u001b[1;39m: \u001b[0m\u001b[0;32m\"2022-11-16T19:30:51.996346140Z\"\u001b[0m\u001b[1;39m\r\n", " \u001b[1;39m}\u001b[0m\u001b[1;39m\r\n", " \u001b[1;39m}\u001b[0m\u001b[1;39m\r\n", " \u001b[1;39m]\u001b[0m\u001b[1;39m\r\n", @@ -402,7 +404,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\"outputs\":[{\"name\":\"OUTPUT1\",\"datatype\":\"INT64\",\"shape\":[\"1\"],\"contents\":{\"int64Contents\":[\"2\"]}}],\"rawOutputContents\":[\"AgAAAAAAAAA=\"]}\r\n" + "{\"outputs\":[{\"name\":\"OUTPUT1\", \"datatype\":\"INT64\", \"shape\":[\"1\"], \"contents\":{\"int64Contents\":[\"2\"]}}]}\r\n" ] } ], @@ -421,7 +423,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\"outputs\":[{\"name\":\"OUTPUT1\",\"datatype\":\"INT64\",\"shape\":[\"1\"],\"contents\":{\"int64Contents\":[\"2\"]}}],\"rawOutputContents\":[\"AgAAAAAAAAA=\"]}\r\n" + "{\"outputs\":[{\"name\":\"OUTPUT1\", \"datatype\":\"INT64\", \"shape\":[\"1\"], \"contents\":{\"int64Contents\":[\"2\"]}}]}\r\n" ] } ], @@ -440,7 +442,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\"outputs\":[{\"name\":\"OUTPUT1\",\"datatype\":\"INT64\",\"shape\":[\"1\"],\"contents\":{\"int64Contents\":[\"2\"]}}],\"rawOutputContents\":[\"AgAAAAAAAAA=\"]}\r\n" + "{\"outputs\":[{\"name\":\"OUTPUT1\", \"datatype\":\"INT64\", \"shape\":[\"1\"], \"contents\":{\"int64Contents\":[\"2\"]}}]}\r\n" ] } ], @@ -515,7 +517,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/samples/trigger_joins.md b/samples/trigger_joins.md index 35953c2eb9..c17b504f6a 100644 --- a/samples/trigger_joins.md +++ b/samples/trigger_joins.md @@ -1,5 +1,7 @@ ## Trigger Joins +In this notebook we show use of trigger joins of type "any" where we wait for any of the inputs tobe present. We illustrate where we send various combinations of 2 inputs and show we always get an output. + ```python import json @@ -68,7 +70,7 @@ Load models and pipelines { "pipeline": { "name": "triggers_join_inputs", - "uid": "cbmbfial0p8os8jr7ds0", + "uid": "cdqjkdhqa12c739ab3t0", "version": 1, "steps": [ { @@ -94,8 +96,8 @@ Load models and pipelines "state": { "pipelineVersion": 1, "status": "PipelineReady", - "reason": "Created pipeline", - "lastChangeTimestamp": "2022-08-05T06:25:14.011256855Z" + "reason": "created pipeline", + "lastChangeTimestamp": "2022-11-16T19:29:58.778539435Z" } } ] @@ -133,7 +135,7 @@ request_string = get_request_string(use_trigger_1=True, use_trigger_2=True) !seldon pipeline infer triggers_join_inputs --inference-mode grpc '{request_string}' ``` - {"outputs":[{"name":"OUTPUT1","datatype":"INT64","shape":["1"],"contents":{"int64Contents":["2"]}}],"rawOutputContents":["AgAAAAAAAAA="]} + {"outputs":[{"name":"OUTPUT1", "datatype":"INT64", "shape":["1"], "contents":{"int64Contents":["2"]}}]} @@ -143,7 +145,7 @@ request_string = get_request_string(use_trigger_1=True, use_trigger_2=False) !seldon pipeline infer triggers_join_inputs --inference-mode grpc '{request_string}' ``` - {"outputs":[{"name":"OUTPUT1","datatype":"INT64","shape":["1"],"contents":{"int64Contents":["2"]}}],"rawOutputContents":["AgAAAAAAAAA="]} + {"outputs":[{"name":"OUTPUT1", "datatype":"INT64", "shape":["1"], "contents":{"int64Contents":["2"]}}]} @@ -153,7 +155,7 @@ request_string = get_request_string(use_trigger_1=False, use_trigger_2=True) !seldon pipeline infer triggers_join_inputs --inference-mode grpc '{request_string}' ``` - {"outputs":[{"name":"OUTPUT1","datatype":"INT64","shape":["1"],"contents":{"int64Contents":["2"]}}],"rawOutputContents":["AgAAAAAAAAA="]} + {"outputs":[{"name":"OUTPUT1", "datatype":"INT64", "shape":["1"], "contents":{"int64Contents":["2"]}}]} @@ -183,7 +185,7 @@ request_string = get_request_string(use_trigger_1=False, use_trigger_2=True) { "pipeline": { "name": "triggers_join_internal", - "uid": "cbmbfm2l0p8os8jr7dsg", + "uid": "cdqjkqpqa12c739ab3tg", "version": 1, "steps": [ { @@ -227,8 +229,8 @@ request_string = get_request_string(use_trigger_1=False, use_trigger_2=True) "state": { "pipelineVersion": 1, "status": "PipelineReady", - "reason": "Created pipeline", - "lastChangeTimestamp": "2022-08-05T06:25:29.114592623Z" + "reason": "created pipeline", + "lastChangeTimestamp": "2022-11-16T19:30:51.996346140Z" } } ] @@ -276,7 +278,7 @@ request_string = get_request_string(use_trigger_1=True, use_trigger_2=True) !seldon pipeline infer triggers_join_internal --inference-mode grpc '{request_string}' ``` - {"outputs":[{"name":"OUTPUT1","datatype":"INT64","shape":["1"],"contents":{"int64Contents":["2"]}}],"rawOutputContents":["AgAAAAAAAAA="]} + {"outputs":[{"name":"OUTPUT1", "datatype":"INT64", "shape":["1"], "contents":{"int64Contents":["2"]}}]} @@ -286,7 +288,7 @@ request_string = get_request_string(use_trigger_1=True, use_trigger_2=False) !seldon pipeline infer triggers_join_internal --inference-mode grpc '{request_string}' ``` - {"outputs":[{"name":"OUTPUT1","datatype":"INT64","shape":["1"],"contents":{"int64Contents":["2"]}}],"rawOutputContents":["AgAAAAAAAAA="]} + {"outputs":[{"name":"OUTPUT1", "datatype":"INT64", "shape":["1"], "contents":{"int64Contents":["2"]}}]} @@ -296,7 +298,7 @@ request_string = get_request_string(use_trigger_1=False, use_trigger_2=True) !seldon pipeline infer triggers_join_internal --inference-mode grpc '{request_string}' ``` - {"outputs":[{"name":"OUTPUT1","datatype":"INT64","shape":["1"],"contents":{"int64Contents":["2"]}}],"rawOutputContents":["AgAAAAAAAAA="]} + {"outputs":[{"name":"OUTPUT1", "datatype":"INT64", "shape":["1"], "contents":{"int64Contents":["2"]}}]} diff --git a/scheduler/pkg/store/pipeline/errors.go b/scheduler/pkg/store/pipeline/errors.go index 58a335f0be..385de30f24 100644 --- a/scheduler/pkg/store/pipeline/errors.go +++ b/scheduler/pkg/store/pipeline/errors.go @@ -18,28 +18,33 @@ package pipeline import "fmt" -type PipelineStepInputInvalidErr struct { - pipeline string - stepOutputName string -} - -func (e *PipelineStepInputInvalidErr) Is(tgt error) bool { - _, ok := tgt.(*PipelineStepInputInvalidErr) - return ok +type PipelineStepInputEmptyErr struct { + pipeline string + stepName string + isTrigger bool } -func (psi *PipelineStepInputInvalidErr) Error() string { - return fmt.Sprintf("pipeline step invalid pipeline %s step input [%s]", psi.pipeline, psi.stepOutputName) +func (psi *PipelineStepInputEmptyErr) Error() string { + if psi.isTrigger { + return fmt.Sprintf("pipeline %s step %s has an empty trigger", psi.pipeline, psi.stepName) + } else { + return fmt.Sprintf("pipeline %s step %s has an empty input", psi.pipeline, psi.stepName) + } } type PipelineStepInputSpecifierErr struct { pipeline string step string outputStep string + isTrigger bool } func (pse *PipelineStepInputSpecifierErr) Error() string { - return fmt.Sprintf("pipeline step input invalid pipeline %s step %s input step %s.", pse.pipeline, pse.step, pse.outputStep) + if pse.isTrigger { + return fmt.Sprintf("pipeline step trigger invalid pipeline %s step %s input step %s.", pse.pipeline, pse.step, pse.outputStep) + } else { + return fmt.Sprintf("pipeline step input invalid pipeline %s step %s input step %s.", pse.pipeline, pse.step, pse.outputStep) + } } type PipelineOutputSpecifierErr struct { @@ -177,5 +182,5 @@ type PipelineStepNameEqualsPipelineNameErr struct { } func (psr *PipelineStepNameEqualsPipelineNameErr) Error() string { - return fmt.Sprintf("pipeline %s must not have a step name with the same name", psr.pipeline) + return fmt.Sprintf("pipeline %s must not have a step name with the same name as pipeline name", psr.pipeline) } diff --git a/scheduler/pkg/store/pipeline/validate.go b/scheduler/pkg/store/pipeline/validate.go index ce0f612e40..4cc31d0ba2 100644 --- a/scheduler/pkg/store/pipeline/validate.go +++ b/scheduler/pkg/store/pipeline/validate.go @@ -36,10 +36,13 @@ func validate(pv *PipelineVersion) error { if err := checkStepNameNotPipelineName(pv); err != nil { return err } - if err := checkStepReferencesExist(pv); err != nil { + if err := checkStepInputs(pv); err != nil { return err } - if err := checkStepInputs(pv); err != nil { + if err := checkStepTriggers(pv); err != nil { + return err + } + if err := checkStepReferencesExist(pv); err != nil { return err } if err := checkStepOutputs(pv); err != nil { @@ -151,6 +154,39 @@ func checkStepReferencesExist(pv *PipelineVersion) error { func checkStepInputs(pv *PipelineVersion) error { for _, v := range pv.Steps { for _, inp := range v.Inputs { + if strings.TrimSpace(inp) == "" || strings.Index(inp, StepNameSeperator) == 0 { + return &PipelineStepInputEmptyErr{pv.Name, v.Name, false} + } + parts := strings.Split(inp, StepNameSeperator) + switch len(parts) { + case 2, 3: + if !(parts[1] == StepInputSpecifier || parts[1] == StepOutputSpecifier) { + return &PipelineStepInputSpecifierErr{ + pipeline: pv.Name, + step: v.Name, + outputStep: inp, + isTrigger: false, + } + } + default: + return &PipelineStepInputSpecifierErr{ + pipeline: pv.Name, + step: v.Name, + outputStep: inp, + isTrigger: false, + } + } + } + } + return nil +} + +func checkStepTriggers(pv *PipelineVersion) error { + for _, v := range pv.Steps { + for _, inp := range v.Triggers { + if strings.TrimSpace(inp) == "" || strings.Index(inp, StepNameSeperator) == 0 { + return &PipelineStepInputEmptyErr{pv.Name, v.Name, true} + } parts := strings.Split(inp, StepNameSeperator) switch len(parts) { case 2, 3: @@ -159,6 +195,7 @@ func checkStepInputs(pv *PipelineVersion) error { pipeline: pv.Name, step: v.Name, outputStep: inp, + isTrigger: true, } } default: @@ -166,6 +203,7 @@ func checkStepInputs(pv *PipelineVersion) error { pipeline: pv.Name, step: v.Name, outputStep: inp, + isTrigger: true, } } } diff --git a/scheduler/pkg/store/pipeline/validate_test.go b/scheduler/pkg/store/pipeline/validate_test.go index 31dc3118d8..56f8b1d23d 100644 --- a/scheduler/pkg/store/pipeline/validate_test.go +++ b/scheduler/pkg/store/pipeline/validate_test.go @@ -67,7 +67,7 @@ func TestCheckStepReferencesExist(t *testing.T) { }, "c": { Name: "c", - Inputs: []string{"f"}, + Inputs: []string{"f.outputs"}, }, }, }, @@ -159,7 +159,55 @@ func TestCheckStepInputs(t *testing.T) { }, }, }, - err: &PipelineStepInputSpecifierErr{pipeline: "test", step: "b", outputStep: "a.ffo.t1"}, + err: &PipelineStepInputSpecifierErr{pipeline: "test", step: "b", outputStep: "a.ffo.t1", isTrigger: false}, + }, + { + name: "empty input name in step", + pipelineVersion: &PipelineVersion{ + Name: "test", + Steps: map[string]*PipelineStep{ + "a": { + Name: "a", + }, + "b": { + Name: "b", + Inputs: []string{""}, + }, + }, + }, + err: &PipelineStepInputEmptyErr{pipeline: "test", stepName: "b", isTrigger: false}, + }, + { + name: "empty input name in step with spaces", + pipelineVersion: &PipelineVersion{ + Name: "test", + Steps: map[string]*PipelineStep{ + "a": { + Name: "a", + }, + "b": { + Name: "b", + Inputs: []string{" "}, + }, + }, + }, + err: &PipelineStepInputEmptyErr{pipeline: "test", stepName: "b", isTrigger: false}, + }, + { + name: "step separator at start", + pipelineVersion: &PipelineVersion{ + Name: "test", + Steps: map[string]*PipelineStep{ + "a": { + Name: "a", + }, + "b": { + Name: "b", + Inputs: []string{".outputs"}, + }, + }, + }, + err: &PipelineStepInputEmptyErr{pipeline: "test", stepName: "b", isTrigger: false}, }, { name: "bad specifier has too many parts", @@ -175,7 +223,7 @@ func TestCheckStepInputs(t *testing.T) { }, }, }, - err: &PipelineStepInputSpecifierErr{pipeline: "test", step: "b", outputStep: "a.inputs.t1.foo"}, + err: &PipelineStepInputSpecifierErr{pipeline: "test", step: "b", outputStep: "a.inputs.t1.foo", isTrigger: false}, }, } for _, test := range tests { @@ -196,6 +244,127 @@ func TestCheckStepInputs(t *testing.T) { } } +func TestCheckStepTriggers(t *testing.T) { + g := NewGomegaWithT(t) + tests := []validateTest{ + { + name: "valid triggers", + pipelineVersion: &PipelineVersion{ + Name: "test", + Steps: map[string]*PipelineStep{ + "a": { + Name: "a", + }, + "b": { + Name: "b", + Triggers: []string{"a.outputs.t1", "a.inputs", "a.outputs"}, + }, + "c": { + Name: "c", + Triggers: []string{"a.outputs.t1"}, + }, + }, + }, + }, + { + name: "bad specifier not inputs or ouputs", + pipelineVersion: &PipelineVersion{ + Name: "test", + Steps: map[string]*PipelineStep{ + "a": { + Name: "a", + }, + "b": { + Name: "b", + Triggers: []string{"a.ffo.t1"}, + }, + }, + }, + err: &PipelineStepInputSpecifierErr{pipeline: "test", step: "b", outputStep: "a.ffo.t1", isTrigger: true}, + }, + { + name: "empty input name in step", + pipelineVersion: &PipelineVersion{ + Name: "test", + Steps: map[string]*PipelineStep{ + "a": { + Name: "a", + }, + "b": { + Name: "b", + Triggers: []string{""}, + }, + }, + }, + err: &PipelineStepInputEmptyErr{pipeline: "test", stepName: "b", isTrigger: true}, + }, + { + name: "empty input name in step with spaces", + pipelineVersion: &PipelineVersion{ + Name: "test", + Steps: map[string]*PipelineStep{ + "a": { + Name: "a", + }, + "b": { + Name: "b", + Triggers: []string{" "}, + }, + }, + }, + err: &PipelineStepInputEmptyErr{pipeline: "test", stepName: "b", isTrigger: true}, + }, + { + name: "step separator at start", + pipelineVersion: &PipelineVersion{ + Name: "test", + Steps: map[string]*PipelineStep{ + "a": { + Name: "a", + }, + "b": { + Name: "b", + Triggers: []string{".outputs"}, + }, + }, + }, + err: &PipelineStepInputEmptyErr{pipeline: "test", stepName: "b", isTrigger: true}, + }, + { + name: "bad specifier has too many parts", + pipelineVersion: &PipelineVersion{ + Name: "test", + Steps: map[string]*PipelineStep{ + "a": { + Name: "a", + }, + "b": { + Name: "b", + Triggers: []string{"a.inputs.t1.foo"}, + }, + }, + }, + err: &PipelineStepInputSpecifierErr{pipeline: "test", step: "b", outputStep: "a.inputs.t1.foo", isTrigger: true}, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + err := checkStepTriggers(test.pipelineVersion) + if test.err == nil { + g.Expect(err).To(BeNil()) + } else { + g.Expect(err.Error()).To(Equal(test.err.Error())) + } + err = validate(test.pipelineVersion) + if test.err == nil { + g.Expect(err).To(BeNil()) + } else { + g.Expect(err.Error()).To(Equal(test.err.Error())) + } + }) + } +} + func TestCheckForCycles(t *testing.T) { g := NewGomegaWithT(t) tests := []validateTest{