Train Various Models on MNIST using kubeflow and seldon-core

Using:

  • kubeflow
  • seldon-core

The example will be the MNIST handwriiten digit classification task.

Dependencies

  • Argo

Setup


In [ ]:
!kubectl config set-context $(kubectl config current-context) --namespace=kubeflow

Tensorflow Model

A simple neural network in Tensorflow.

Training

  • Create image from source
  • Run training

Run with:

  • -p build-push-image=true to build image and push to repo, needed extra params:
    • -p version=<version> create <version> of model
    • -p github-user=<github-user> to download example-seldon source from <github-user> account
    • -p github-revision=<revision> to use the github branch <revision>
    • -p docker-org=<docker-org> to use Docker repo <docker-org> to push image to. Needs docker credentials in secret as described in README.

In [ ]:
!pygmentize ../workflows/training-tf-mnist-workflow.yaml

In [ ]:
!argo submit ../workflows/training-tf-mnist-workflow.yaml -p tfjob-version-hack=1

In [ ]:
!argo list

Runtime Image

Run with:

  • -p build-push-image=true to build image and push to repo, needed extra params:
    • -p version=<version> create <version> of model
    • -p github-user=<github-user> to download example-seldon source from <github-user> account
    • -p github-revision=<revision> to use the github branch <revision>
    • -p docker-org=<docker-org> to use Docker user <docker-org> to push image to. Needs docker credentials in secret as described in README.
  • -p deploy-model=true to deploy model

In [ ]:
!pygmentize ../workflows/serving-tf-mnist-workflow.yaml

In [ ]:
!argo submit ../workflows/serving-tf-mnist-workflow.yaml

In [ ]:
!argo list

Sklearn Model

A Random forest in sklearn.

Training

  • For options see above Tensorflow example

In [ ]:
!pygmentize ../workflows/training-sk-mnist-workflow.yaml

In [ ]:
!argo submit ../workflows/training-sk-mnist-workflow.yaml

In [ ]:
!argo list

Runtime Image

  • For options see above Tensorflow example

In [ ]:
!pygmentize ../workflows/serving-sk-mnist-workflow.yaml

In [ ]:
!argo submit ../workflows/serving-sk-mnist-workflow.yaml

In [ ]:
!argo list

R Model

A partial least squares model in R.

Training

  • For options see above Tensorflow example

In [ ]:
!pygmentize ../workflows/training-r-mnist-workflow.yaml

In [ ]:
!argo submit ../workflows/training-r-mnist-workflow.yaml

In [ ]:
!argo list

Runtime Image

  • For options see above Tensorflow example

In [ ]:
!pygmentize ../workflows/serving-r-mnist-workflow.yaml

In [ ]:
!argo submit ../workflows/serving-r-mnist-workflow.yaml

In [ ]:
!argo list

In [ ]: