Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 2.33 KB

README.md

File metadata and controls

52 lines (35 loc) · 2.33 KB

TensorFlow MNIST Classifier

Assumptions

Train Model

Train the Tensorflow MNIST model following the steps in the user guide.

Wrap the Runtime Scorer

You can skip this step if you are happy to use the already packaged image seldonio/ffdl-mnist from DockerHub.

The runtime MNIST scrorer is contained within a standalone python class TFMnist.py. This needs to be packaged in a Docker container to run within Seldon. For this we use Redhat's Source-to-image.

  • Install S2I
  • From the tf-model folder run, (change seldonio to your Docker repo) You will need at least 8GB for your local Docker. :
s2i build . seldonio/seldon-core-s2i-python2 seldonio/ffdl-mnist:0.1
  • Push image to DockerHub or your Docker repo accessible from the FfDL cluster.

Deploy Model

To deploy the model you need to create the deployment resource from the template ffdl-mnist-deployment.json. You will need to set:

  • TRAINING_ID : Your FfDL Training ID
  • BUCKET_NAME : The name of the bucket containing your model

You will also need to create a kubernetes secret containing your bucket endpoint url, key and secret. You can use the bucket-secret.yaml as a template, e.g.:

  • edit bucket-secret.yaml
  • Enter the base64 values for endpoint url, key, secret
    • On a linux system running bash shell you could do the following to get your values, echo -n "my key" | base64
  • run kubectl create -f bucket-secret.yaml

Create a deployment file by adding your settings, e.g. using sed below:

cat ffdl-mnist-deployment.json | sed 's/%TRAINING_ID%/training-84hIKJViR/' | sed 's/%BUCKET_NAME%/tf_trained_model/'  > ffdl-mnist-deployment_mydeploy.json

Deploy:

kubectl create -f ffdl-mnist-deployment_mydeploy.json

Test

To test the running model with example MNIST images you can run either of two notebooks depending on how you exposed the Seldon APIs