Training Outlier Detector for CIFAR10 with Poetry

Outlier Detector for Cifar10 model with Poetry-defined Environment

Prerequisites

  • A kubernetes cluster with kubectl configured

  • poetry

  • rclone

  • curl

Setup Seldon Core

Use the setup notebook to Setup Cluster with Ambassador Ingress and Install Seldon Core. Instructions also online.

We will assume that ambassador (or Istio) ingress is port-forwarded to localhost:8003

!kubectl create namespace cifar10 || true
namespace/cifar10 created

Setup MinIO

Use the provided notebook to install Minio in your cluster. Instructions also online.

We will assume that MinIO service is port-forwarded to localhost:8090

%%writefile rclone.conf
[s3]
type = s3
provider = minio
env_auth = false
access_key_id = minioadmin
secret_access_key = minioadmin
endpoint = http://localhost:8090

Poetry

We will use poetry.lock to fully define the explainer environment. Install poetry following official documentation. Usually this goes down to

Train Outlier Detector

Prepare Training Environment

We are going to use pyproject.toml and poetry.lock files from Alibi Detect Server. This will allow us to create environment that will match the runtime one.

Currently, the server's pyproject.toml is structured in the way that it uses a locally present source code of seldon-core.

Please, make sure that you obtain the source code that match the version of used alibi-detect-server.

Prepare Training Script

Deploy Cifar10 model and Outlier Detector

Note, this requires Knative. Follow Knative documentation to install it.

Deploy Event Display

Deploy Model

Create Knative Broker, Trigger and Kservice

Test it!

In a terminal follow logs of the event-display deployment with for example

Now we were send two requests, one containing a normal image and one outlier.

Note: it may take a moment for the kservice to become available

png
png

Tear Down

Last updated

Was this helpful?