This page was generated from examples/models/deep_mnist/deep_mnist.ipynb.

Tensorflow MNIST ModelΒΆ

  • Wrap a Tensorflow MNIST python model for use as a prediction microservice in seldon-core
  • Run locally on Docker to test
  • Deploy on seldon-core running on minikube

DependenciesΒΆ

pip install seldon-core

Train locallyΒΆ

[1]:
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot = True)
import tensorflow as tf

if __name__ == '__main__':

    x = tf.placeholder(tf.float32, [None,784], name="x")

    W = tf.Variable(tf.zeros([784,10]))
    b = tf.Variable(tf.zeros([10]))

    y = tf.nn.softmax(tf.matmul(x,W) + b, name="y")

    y_ = tf.placeholder(tf.float32, [None, 10])


    cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1]))

    train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)

    init = tf.initialize_all_variables()

    sess = tf.Session()
    sess.run(init)

    for i in range(1000):
        batch_xs, batch_ys = mnist.train.next_batch(100)
        sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys})

    correct_prediction = tf.equal(tf.argmax(y,1), tf.argmax(y_,1))
    accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
    print(sess.run(accuracy, feed_dict = {x: mnist.test.images, y_:mnist.test.labels}))

    saver = tf.train.Saver()

    saver.save(sess, "model/deep_mnist_model")


WARNING:tensorflow:From <ipython-input-1-b7995d30f035>:2: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use alternatives such as official/mnist/dataset.py from tensorflow/models.
WARNING:tensorflow:From /home/clive/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:260: maybe_download (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Please write your own downloading logic.
WARNING:tensorflow:From /home/clive/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:262: extract_images (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.data to implement this functionality.
Extracting MNIST_data/train-images-idx3-ubyte.gz
WARNING:tensorflow:From /home/clive/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:267: extract_labels (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.data to implement this functionality.
Extracting MNIST_data/train-labels-idx1-ubyte.gz
WARNING:tensorflow:From /home/clive/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:110: dense_to_one_hot (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.one_hot on tensors.
Extracting MNIST_data/t10k-images-idx3-ubyte.gz
Extracting MNIST_data/t10k-labels-idx1-ubyte.gz
WARNING:tensorflow:From /home/clive/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:290: DataSet.__init__ (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use alternatives such as official/mnist/dataset.py from tensorflow/models.
WARNING:tensorflow:From /home/clive/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py:118: initialize_all_variables (from tensorflow.python.ops.variables) is deprecated and will be removed after 2017-03-02.
Instructions for updating:
Use `tf.global_variables_initializer` instead.
0.918

Wrap model using s2i

[2]:
!s2i build . seldonio/seldon-core-s2i-python36:0.5.1 deep-mnist:0.1
---> Installing application source...
---> Installing dependencies ...
Looking in links: /whl
Requirement already satisfied: tensorflow>=1.12.0 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 1)) (1.13.1)
Requirement already satisfied: protobuf>=3.6.1 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (3.7.0)
Requirement already satisfied: absl-py>=0.1.6 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (0.7.1)
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.16.2)
Requirement already satisfied: tensorboard<1.14.0,>=1.13.0 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.13.1)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.12.0)
Requirement already satisfied: keras-applications>=1.0.6 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.0.7)
Requirement already satisfied: grpcio>=1.8.6 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.19.0)
Requirement already satisfied: keras-preprocessing>=1.0.5 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.0.9)
Requirement already satisfied: astor>=0.6.0 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (0.7.1)
Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.1.0)
Requirement already satisfied: tensorflow-estimator<1.14.0rc0,>=1.13.0 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.13.0)
Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (0.33.1)
Requirement already satisfied: gast>=0.2.0 in /usr/local/lib/python3.6/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (0.2.2)
Requirement already satisfied: setuptools in /usr/local/lib/python3.6/site-packages (from protobuf>=3.6.1->tensorflow>=1.12.0->-r requirements.txt (line 1)) (40.8.0)
Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.6/site-packages (from tensorboard<1.14.0,>=1.13.0->tensorflow>=1.12.0->-r requirements.txt (line 1)) (0.15.0)
Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.6/site-packages (from tensorboard<1.14.0,>=1.13.0->tensorflow>=1.12.0->-r requirements.txt (line 1)) (3.0.1)
Requirement already satisfied: h5py in /usr/local/lib/python3.6/site-packages (from keras-applications>=1.0.6->tensorflow>=1.12.0->-r requirements.txt (line 1)) (2.9.0)
Requirement already satisfied: mock>=2.0.0 in /usr/local/lib/python3.6/site-packages (from tensorflow-estimator<1.14.0rc0,>=1.13.0->tensorflow>=1.12.0->-r requirements.txt (line 1)) (2.0.0)
Requirement already satisfied: pbr>=0.11 in /usr/local/lib/python3.6/site-packages (from mock>=2.0.0->tensorflow-estimator<1.14.0rc0,>=1.13.0->tensorflow>=1.12.0->-r requirements.txt (line 1)) (5.1.3)
Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Build completed successfully
[3]:
!docker run --name "mnist_predictor" -d --rm -p 5000:5000 deep-mnist:0.1
d8676abb76c33c3ba10300a3625e242b405b3bad70d9b74be5ce8addd5e44ffd

Send some random features that conform to the contract

[4]:
!seldon-core-tester contract.json 0.0.0.0 5000 -p
----------------------------------------
SENDING NEW REQUEST:

[[0.733 0.176 0.261 0.111 0.974 0.635 0.182 0.747 0.297 0.582 0.739 0.531
  0.216 0.977 0.586 0.443 0.33  0.423 0.772 0.923 0.534 0.891 0.056 0.437
  0.565 0.257 0.459 0.384 0.265 0.902 0.646 0.49  0.334 0.769 0.794 0.097
  0.09  0.543 0.711 0.635 0.919 0.402 0.969 0.452 0.134 0.211 0.773 0.201
  0.953 0.424 0.797 0.852 0.041 0.101 0.91  0.95  0.479 0.708 0.941 0.721
  0.855 0.509 0.818 0.592 0.908 0.827 0.163 0.187 0.405 0.874 0.73  0.719
  0.051 0.807 0.019 0.645 0.774 0.304 0.506 0.461 0.694 0.28  0.197 0.031
  0.213 0.211 0.987 0.175 0.641 0.19  0.446 0.776 0.892 0.755 0.266 0.803
  0.384 0.698 0.328 0.952 0.515 0.093 0.616 0.942 0.848 0.088 0.028 0.858
  0.119 0.177 0.463 0.798 0.461 0.011 0.601 0.397 0.02  0.064 0.309 0.757
  0.911 0.06  0.931 0.997 0.85  0.651 0.731 0.071 0.63  0.137 0.821 0.854
  0.726 0.902 0.532 0.032 0.154 0.294 0.307 0.039 0.976 0.757 0.444 0.911
  0.732 0.029 0.944 0.238 0.437 0.927 0.482 0.844 0.146 0.085 0.599 0.956
  0.439 0.912 0.029 0.468 0.332 0.376 0.545 0.157 0.077 0.956 0.135 0.623
  0.064 0.003 0.784 0.586 0.026 0.308 0.873 0.022 0.086 0.779 0.918 0.425
  0.706 0.305 0.705 0.364 0.335 0.723 0.465 0.237 0.019 0.513 0.937 0.402
  0.444 0.197 0.963 0.403 0.531 0.078 0.617 0.639 0.316 0.396 0.892 0.793
  0.674 0.789 0.452 0.365 0.487 0.683 0.595 0.667 0.403 0.432 0.305 0.026
  0.21  0.402 0.649 0.993 0.02  0.288 0.098 0.907 0.827 0.224 0.711 0.425
  0.733 0.476 0.653 0.33  0.547 0.554 0.216 0.268 0.25  0.403 0.488 0.197
  0.244 0.69  0.611 0.847 0.077 0.405 0.452 0.19  0.256 0.245 0.228 0.849
  0.813 0.838 0.935 0.408 0.2   0.897 0.099 0.899 0.322 0.981 0.094 0.867
  0.588 0.422 0.261 0.515 0.762 0.027 0.745 0.932 0.16  0.487 0.616 0.975
  0.283 0.513 0.569 0.974 0.596 0.59  0.183 0.264 0.995 0.445 0.767 0.624
  0.978 0.343 0.784 0.133 0.543 0.115 0.928 0.692 0.364 0.174 0.574 0.127
  0.102 0.591 0.88  0.963 0.298 0.264 0.195 0.196 0.226 0.149 0.7   0.732
  0.117 0.89  0.382 0.158 0.822 0.089 0.07  0.727 0.798 0.942 0.875 0.516
  0.223 0.804 0.891 0.145 0.76  0.515 0.712 0.92  0.788 0.592 0.699 0.005
  0.874 0.998 0.42  0.702 0.864 0.308 0.774 0.345 0.69  0.27  0.733 0.662
  0.499 0.489 0.571 0.559 0.581 0.98  0.035 0.5   0.001 0.281 0.669 0.851
  0.86  0.781 0.994 0.362 0.746 0.387 0.382 0.183 0.049 0.164 0.1   0.769
  0.887 0.756 0.873 0.582 0.018 0.047 0.124 0.241 0.043 0.898 0.998 0.225
  0.36  0.582 0.262 0.339 0.929 0.32  0.909 0.862 0.372 0.833 0.272 0.004
  0.245 0.803 0.294 0.486 0.585 0.671 0.384 0.354 0.512 0.253 0.554 0.745
  0.213 0.953 0.466 0.072 0.276 0.507 0.77  0.312 0.9   0.186 0.574 0.138
  0.67  0.603 0.583 0.006 0.475 0.536 0.677 0.208 0.654 0.509 0.167 0.496
  0.909 0.204 0.313 0.497 0.381 0.62  0.182 0.155 0.07  0.043 0.266 0.537
  0.573 0.045 0.375 0.63  0.365 0.416 0.407 0.336 0.856 0.466 0.24  0.399
  0.226 0.696 0.298 0.458 0.575 0.577 0.262 0.135 0.575 0.224 0.545 0.155
  0.802 0.849 0.241 0.543 0.755 0.648 0.373 0.136 0.62  0.444 0.069 0.77
  0.597 0.378 0.072 0.794 0.42  0.159 0.932 0.196 0.158 0.962 0.942 0.661
  0.273 0.917 0.474 0.717 0.275 0.203 0.17  0.943 0.859 0.729 0.815 0.228
  0.365 0.188 0.291 0.516 0.184 0.234 0.867 0.831 0.352 0.834 0.578 0.944
  0.157 0.225 0.02  0.457 0.725 0.543 0.11  0.764 0.046 0.789 0.371 0.003
  0.409 0.885 0.181 0.025 0.378 0.641 0.549 0.67  0.633 0.734 0.766 0.895
  0.928 0.08  0.756 0.114 0.785 0.753 0.862 0.774 0.084 0.031 0.265 0.04
  0.646 0.151 0.33  0.028 0.505 0.697 0.839 0.73  0.914 0.411 0.535 0.363
  0.901 0.199 0.665 0.485 0.962 0.225 0.799 0.439 0.964 0.681 0.932 0.851
  0.311 0.821 0.96  0.858 0.569 0.361 0.12  0.664 0.62  0.937 0.44  0.664
  0.389 0.844 0.644 0.387 0.25  0.989 0.2   0.848 0.207 0.033 0.56  0.905
  0.995 0.05  0.839 0.498 0.847 0.07  0.814 0.293 0.417 0.577 0.697 0.766
  0.11  0.824 0.319 0.424 0.426 0.425 0.646 0.826 0.981 0.159 0.329 0.029
  0.132 0.113 0.881 0.591 0.336 0.147 0.865 0.87  0.467 0.662 0.965 0.613
  0.142 0.788 0.205 0.956 0.385 0.519 0.126 0.3   0.667 0.022 0.287 0.202
  0.554 0.497 0.938 0.592 0.754 0.064 0.325 0.217 0.843 0.334 0.394 0.617
  0.041 0.003 0.492 0.627 0.993 0.879 0.64  0.601 0.063 0.773 0.946 0.28
  0.622 0.073 0.086 0.648 0.098 0.941 0.808 0.231 0.28  0.496 0.35  0.417
  0.372 0.609 0.179 0.135 0.716 0.604 0.737 0.902 0.129 0.037 0.447 0.818
  0.494 0.688 0.36  0.564 0.324 0.182 0.449 0.443 0.696 0.434 0.501 0.757
  0.694 0.992 0.49  0.716 0.401 0.04  0.232 0.042 0.466 0.601 0.951 0.819
  0.186 0.014 0.519 0.069 0.478 0.843 0.014 0.721 0.778 0.587 0.175 0.755
  0.661 0.659 0.459 0.516 0.991 0.898 0.822 0.239 0.841 0.053 0.798 0.99
  0.182 0.347 0.085 0.863 0.132 0.857 0.51  0.879 0.947 0.126 0.476 0.759
  0.313 0.998 0.383 0.938 0.932 0.706 0.891 0.083 0.118 0.534 0.182 0.912
  0.891 0.099 0.675 0.488 0.109 0.458 0.839 0.694 0.828 0.309 0.236 0.171
  0.561 0.294 0.563 0.241]]
RECEIVED RESPONSE:
meta {
}
data {
  names: "class:0"
  names: "class:1"
  names: "class:2"
  names: "class:3"
  names: "class:4"
  names: "class:5"
  names: "class:6"
  names: "class:7"
  names: "class:8"
  names: "class:9"
  ndarray {
    values {
      list_value {
        values {
          number_value: 0.004559003282338381
        }
        values {
          number_value: 1.6435802052683357e-08
        }
        values {
          number_value: 0.44580259919166565
        }
        values {
          number_value: 0.24535049498081207
        }
        values {
          number_value: 1.9896437208899442e-07
        }
        values {
          number_value: 0.27744176983833313
        }
        values {
          number_value: 0.0008711284608580172
        }
        values {
          number_value: 7.18156443326734e-05
        }
        values {
          number_value: 0.02588343806564808
        }
        values {
          number_value: 1.9471399355097674e-05
        }
      }
    }
  }
}


[5]:
!docker rm mnist_predictor --force
mnist_predictor

Test using MinikubeΒΆ

Due to a `minikube/s2i issue <https://github.com/SeldonIO/seldon-core/issues/253>`__ you will need `s2i >= 1.1.13 <https://github.com/openshift/source-to-image/releases/tag/v1.1.13>`__

[6]:
!minikube start --memory 4096
πŸ˜„  minikube v0.34.1 on linux (amd64)
πŸ”₯  Creating virtualbox VM (CPUs=2, Memory=4096MB, Disk=20000MB) ...
πŸ“Ά  "minikube" IP address is 192.168.99.100
🐳  Configuring Docker as the container runtime ...
✨  Preparing Kubernetes environment ...
🚜  Pulling images required by Kubernetes v1.13.3 ...
πŸš€  Launching Kubernetes v1.13.3 using kubeadm ...
πŸ”‘  Configuring cluster permissions ...
πŸ€”  Verifying component health .....
πŸ’—  kubectl is now configured to use "minikube"
πŸ„  Done! Thank you for using minikube!
[7]:
!kubectl create clusterrolebinding kube-system-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
clusterrolebinding.rbac.authorization.k8s.io/kube-system-cluster-admin created
[8]:
!helm init
$HELM_HOME has been configured at /home/clive/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.

Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
To prevent this, run `helm init` with the --tiller-tls-verify flag.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
Happy Helming!
[9]:
!kubectl rollout status deploy/tiller-deploy -n kube-system
Waiting for deployment "tiller-deploy" rollout to finish: 0 of 1 updated replicas are available...
deployment "tiller-deploy" successfully rolled out
[6]:
!helm install ../../../helm-charts/seldon-core-operator --name seldon-core --set usageMetrics.enabled=true --namespace seldon-system
NAME:   seldon-core
LAST DEPLOYED: Thu Apr 25 09:13:58 2019
NAMESPACE: seldon-system
STATUS: DEPLOYED

RESOURCES:
==> v1beta1/CustomResourceDefinition
NAME                                         AGE
seldondeployments.machinelearning.seldon.io  0s

==> v1/ClusterRole
seldon-operator-manager-role  0s

==> v1/ClusterRoleBinding
NAME                                 AGE
seldon-operator-manager-rolebinding  0s

==> v1/Service
NAME                                        TYPE       CLUSTER-IP    EXTERNAL-IP  PORT(S)  AGE
seldon-operator-controller-manager-service  ClusterIP  10.109.84.44  <none>       443/TCP  0s

==> v1/StatefulSet
NAME                                DESIRED  CURRENT  AGE
seldon-operator-controller-manager  1        1        0s

==> v1/Pod(related)
NAME                                  READY  STATUS             RESTARTS  AGE
seldon-operator-controller-manager-0  0/1    ContainerCreating  0         0s

==> v1/Secret
NAME                                   TYPE    DATA  AGE
seldon-operator-webhook-server-secret  Opaque  0     0s


NOTES:
NOTES: TODO


[7]:
!kubectl rollout status statefulset.apps/seldon-operator-controller-manager -n seldon-system
partitioned roll out complete: 1 new pods have been updated...

Setup IngressΒΆ

There are gRPC issues with the latest Ambassador, so we rewcommend 0.40.2 until these are fixed.

[8]:
!helm install stable/ambassador --name ambassador --set image.tag=0.40.2
NAME:   ambassador
LAST DEPLOYED: Thu Apr 25 09:14:31 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/ServiceAccount
NAME        SECRETS  AGE
ambassador  1        0s

==> v1beta1/ClusterRole
NAME        AGE
ambassador  0s

==> v1beta1/ClusterRoleBinding
NAME        AGE
ambassador  0s

==> v1/Service
NAME               TYPE          CLUSTER-IP     EXTERNAL-IP  PORT(S)                     AGE
ambassador-admins  ClusterIP     10.110.99.128  <none>       8877/TCP                    0s
ambassador         LoadBalancer  10.97.7.72     <pending>    80:30064/TCP,443:32402/TCP  0s

==> v1/Deployment
NAME        DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE
ambassador  3        3        3           0          0s

==> v1/Pod(related)
NAME                         READY  STATUS             RESTARTS  AGE
ambassador-5b89d44544-5hhl7  0/1    ContainerCreating  0         0s
ambassador-5b89d44544-5xcdw  0/1    ContainerCreating  0         0s
ambassador-5b89d44544-7rv6r  0/1    ContainerCreating  0         0s


NOTES:
Congratuations! You've successfully installed Ambassador.

For help, visit our Slack at https://d6e.co/slack or view the documentation online at https://www.getambassador.io.

To get the IP address of Ambassador, run the following commands:
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
     You can watch the status of by running 'kubectl get svc -w  --namespace default ambassador'

  On GKE/Azure:
  export SERVICE_IP=$(kubectl get svc --namespace default ambassador -o jsonpath='{.status.loadBalancer.ingress[0].ip}')

  On AWS:
  export SERVICE_IP=$(kubectl get svc --namespace default ambassador -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')

  echo http://$SERVICE_IP:

[9]:
!kubectl rollout status deployment.apps/ambassador
Waiting for deployment "ambassador" rollout to finish: 0 of 3 updated replicas are available...
Waiting for deployment "ambassador" rollout to finish: 1 of 3 updated replicas are available...
Waiting for deployment "ambassador" rollout to finish: 2 of 3 updated replicas are available...
deployment "ambassador" successfully rolled out

Wrap Model and TestΒΆ

[10]:
!eval $(minikube docker-env) && s2i build . seldonio/seldon-core-s2i-python2:0.5.1 deep-mnist:0.1
---> Installing application source...
---> Installing dependencies ...
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in links: /whl
Requirement already satisfied: tensorflow>=1.12.0 in /usr/local/lib/python2.7/site-packages (from -r requirements.txt (line 1)) (1.13.1)
Requirement already satisfied: astor>=0.6.0 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (0.7.1)
Requirement already satisfied: keras-preprocessing>=1.0.5 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.0.9)
Requirement already satisfied: gast>=0.2.0 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (0.2.2)
Requirement already satisfied: enum34>=1.1.6 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.1.6)
Requirement already satisfied: protobuf>=3.6.1 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (3.7.0)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.12.0)
Requirement already satisfied: absl-py>=0.1.6 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (0.7.1)
Requirement already satisfied: backports.weakref>=1.0rc1 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.0.post1)
Requirement already satisfied: tensorboard<1.14.0,>=1.13.0 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.13.1)
Requirement already satisfied: wheel in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (0.33.1)
Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.1.0)
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.16.2)
Requirement already satisfied: mock>=2.0.0 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (2.0.0)
Requirement already satisfied: keras-applications>=1.0.6 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.0.7)
Requirement already satisfied: tensorflow-estimator<1.14.0rc0,>=1.13.0 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.13.0)
Requirement already satisfied: grpcio>=1.8.6 in /usr/local/lib/python2.7/site-packages (from tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.19.0)
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/site-packages (from protobuf>=3.6.1->tensorflow>=1.12.0->-r requirements.txt (line 1)) (40.8.0)
Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python2.7/site-packages (from tensorboard<1.14.0,>=1.13.0->tensorflow>=1.12.0->-r requirements.txt (line 1)) (3.0.1)
Requirement already satisfied: futures>=3.1.1; python_version < "3" in /usr/local/lib/python2.7/site-packages (from tensorboard<1.14.0,>=1.13.0->tensorflow>=1.12.0->-r requirements.txt (line 1)) (3.2.0)
Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python2.7/site-packages (from tensorboard<1.14.0,>=1.13.0->tensorflow>=1.12.0->-r requirements.txt (line 1)) (0.15.0)
Requirement already satisfied: funcsigs>=1; python_version < "3.3" in /usr/local/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow>=1.12.0->-r requirements.txt (line 1)) (1.0.2)
Requirement already satisfied: pbr>=0.11 in /usr/local/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow>=1.12.0->-r requirements.txt (line 1)) (5.1.3)
Requirement already satisfied: h5py in /usr/local/lib/python2.7/site-packages (from keras-applications>=1.0.6->tensorflow>=1.12.0->-r requirements.txt (line 1)) (2.9.0)
Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Build completed successfully
[11]:
!kubectl create -f deep_mnist.json
seldondeployment.machinelearning.seldon.io/deep-mnist created
[12]:
!kubectl rollout status deploy/deep-mnist-single-model-8969cc0
Waiting for deployment "deep-mnist-single-model-8969cc0" rollout to finish: 0 of 1 updated replicas are available...
deployment "deep-mnist-single-model-8969cc0" successfully rolled out
[13]:
!seldon-core-api-tester contract.json `minikube ip` `kubectl get svc ambassador -o jsonpath='{.spec.ports[0].nodePort}'` \
    deep-mnist --namespace default -p
----------------------------------------
SENDING NEW REQUEST:

[[0.07  0.525 0.195 0.946 0.425 0.312 0.099 0.855 0.955 0.769 0.156 0.647
  0.479 0.197 0.586 0.616 0.105 0.862 0.073 0.335 0.277 0.345 0.872 0.247
  0.266 0.289 0.396 0.217 0.143 0.685 0.567 0.425 0.919 0.474 0.436 0.6
  0.341 0.776 0.417 0.541 0.62  0.161 0.164 0.757 0.135 0.982 0.491 0.735
  0.837 0.387 0.628 0.069 0.062 0.73  0.742 0.563 0.22  0.964 0.01  0.084
  0.681 0.553 0.746 0.834 0.143 0.34  0.676 0.794 0.562 0.113 0.195 0.309
  0.334 0.45  0.936 0.233 0.435 0.105 0.347 0.149 0.378 0.939 0.844 0.912
  0.869 0.251 0.231 0.596 0.603 0.716 0.086 0.669 0.78  0.265 0.316 0.063
  0.296 0.347 0.23  0.843 0.031 0.923 0.978 0.623 0.738 0.362 0.186 0.905
  0.138 0.952 0.209 0.218 0.407 0.198 0.489 0.838 0.372 0.335 0.908 0.505
  0.551 0.256 0.966 0.827 0.121 0.642 0.321 0.949 0.225 0.903 0.954 0.193
  0.378 0.109 0.684 0.026 0.804 0.108 0.104 0.646 0.101 0.097 0.303 0.528
  0.49  0.91  0.523 0.868 0.22  0.555 0.353 0.627 0.077 0.946 0.127 0.101
  0.341 0.205 0.004 0.963 0.825 0.699 0.222 0.644 0.895 0.219 0.151 0.682
  0.488 0.78  0.443 0.8   0.527 0.524 0.894 0.797 0.192 0.744 0.096 0.222
  0.953 0.219 0.244 0.335 0.932 0.507 0.613 0.911 0.501 0.548 0.168 0.27
  0.998 0.889 0.866 0.406 0.042 0.159 0.938 0.94  0.549 0.229 0.965 0.392
  0.943 0.656 0.822 0.336 0.432 0.176 0.726 0.142 0.696 0.899 0.325 0.596
  0.422 0.036 0.381 0.407 0.943 0.249 0.963 0.652 0.226 0.333 0.207 0.825
  0.611 0.752 0.196 0.452 0.616 0.146 0.02  0.804 0.466 0.792 0.241 0.861
  0.762 0.606 0.721 0.404 0.95  0.044 0.911 0.424 0.19  0.14  0.756 0.982
  0.487 0.008 0.209 0.922 0.211 0.29  0.966 0.996 0.097 0.308 0.944 0.054
  0.439 0.522 0.362 0.497 0.943 0.338 0.233 0.471 0.7   0.396 0.598 0.713
  0.708 0.886 0.118 0.615 0.946 0.066 0.069 0.046 0.414 0.298 0.988 0.7
  0.396 0.685 0.521 0.495 0.523 0.596 0.606 0.364 0.937 0.023 0.396 0.565
  0.276 0.034 0.243 0.42  0.222 0.687 0.364 0.111 0.205 0.69  0.344 0.497
  0.881 0.094 0.921 0.137 0.379 0.347 0.161 0.53  0.758 0.215 0.322 0.559
  0.249 0.751 0.991 0.966 0.333 0.44  0.912 0.863 0.666 0.495 0.808 0.932
  0.191 0.279 0.317 0.241 0.678 0.735 0.092 0.751 0.356 0.435 0.33  0.153
  0.232 0.265 0.307 0.12  0.121 0.422 0.283 0.039 0.024 0.097 0.33  0.67
  0.917 0.519 0.423 0.24  0.168 0.466 0.288 0.777 0.509 0.055 0.211 0.382
  0.329 0.394 0.391 0.122 0.284 0.751 0.345 0.003 0.308 0.222 0.234 0.389
  0.062 0.733 0.358 0.804 0.377 0.598 0.293 0.096 0.316 0.798 0.1   0.632
  0.55  0.36  0.157 0.211 0.813 0.897 0.598 0.78  0.134 0.548 0.284 0.84
  0.447 0.131 0.178 0.316 0.527 0.271 0.437 0.72  0.096 0.613 0.532 0.323
  0.17  0.701 0.84  0.155 0.737 0.471 0.407 0.979 0.58  0.694 0.611 0.276
  0.113 0.084 0.024 0.18  0.709 0.716 0.469 0.804 0.483 0.307 0.055 0.226
  0.377 0.297 0.56  0.021 0.581 0.541 0.471 0.205 0.6   0.828 0.794 0.748
  0.277 0.635 0.3   0.571 0.577 0.193 0.204 0.244 0.408 0.341 0.626 0.434
  0.502 0.585 0.107 0.816 0.928 0.612 0.286 0.983 0.178 0.703 0.978 0.208
  0.5   0.424 0.384 0.015 0.418 0.339 0.043 0.699 0.533 0.625 0.834 0.266
  0.336 0.029 0.718 0.074 0.252 0.018 0.331 0.882 0.591 0.364 0.008 0.415
  0.271 0.962 0.144 0.939 0.858 0.258 0.688 0.401 0.03  0.432 0.823 0.69
  0.824 0.284 0.971 0.022 0.47  0.482 0.938 0.201 0.635 0.612 0.975 0.929
  0.478 0.023 0.968 0.63  0.605 0.26  0.416 0.039 0.583 0.538 0.167 0.374
  0.694 0.128 0.692 0.786 0.664 0.343 0.53  0.207 0.217 0.691 0.239 0.121
  0.072 0.806 0.72  0.069 0.799 0.789 0.058 0.889 0.657 0.168 0.18  0.337
  0.48  0.471 0.16  0.44  0.733 0.699 0.439 0.006 0.681 0.177 0.366 0.515
  0.415 0.927 0.26  0.121 0.794 0.257 0.837 0.51  0.45  0.41  0.09  0.017
  0.856 0.06  0.341 1.    0.424 0.892 0.276 0.216 0.52  0.755 0.965 0.757
  0.37  0.204 0.456 0.306 0.72  0.233 0.289 0.359 0.478 0.063 0.249 0.816
  0.568 0.978 0.191 0.588 0.872 0.783 0.76  0.696 0.305 0.832 0.173 0.515
  0.459 0.471 0.386 0.825 0.625 0.495 0.596 0.426 0.159 0.174 0.519 0.355
  0.799 0.98  0.606 0.797 0.81  0.111 0.888 0.583 0.163 0.907 0.336 0.708
  0.815 0.171 0.454 0.359 0.19  0.775 0.488 0.674 0.905 0.889 0.606 0.429
  0.387 0.724 0.204 0.145 0.649 0.306 0.811 0.325 0.022 0.573 0.881 0.474
  0.413 0.981 0.074 0.898 0.715 0.323 0.942 0.586 0.857 0.03  0.997 0.72
  0.908 0.332 0.55  0.43  0.036 0.273 0.451 0.653 0.439 0.623 0.497 0.56
  0.728 0.452 0.091 0.505 0.788 0.219 0.554 0.748 0.958 0.88  0.945 0.755
  0.444 0.553 0.258 0.562 0.752 0.7   0.524 0.555 0.557 0.547 0.28  0.179
  0.843 0.331 0.713 0.225 0.156 0.216 0.943 0.228 0.437 0.425 0.61  0.497
  0.325 0.517 0.51  0.573 0.683 0.448 0.936 0.986 0.725 0.371 0.984 0.674
  0.528 0.781 0.601 0.744 0.998 0.512 0.115 0.808 0.713 0.632 0.426 0.641
  0.25  0.408 0.875 0.937 0.936 0.785 0.08  0.205 0.573 0.168 0.871 0.791
  0.984 0.071 0.478 0.303 0.527 0.048 0.874 0.626 0.242 0.651 0.736 0.863
  0.838 0.906 0.058 0.979]]
RECEIVED RESPONSE:
meta {
  puid: "kir32rkd07l461qt20k5aia2ip"
  requestPath {
    key: "classifier"
    value: "deep-mnist:0.1"
  }
}
data {
  names: "class:0"
  names: "class:1"
  names: "class:2"
  names: "class:3"
  names: "class:4"
  names: "class:5"
  names: "class:6"
  names: "class:7"
  names: "class:8"
  names: "class:9"
  ndarray {
    values {
      list_value {
        values {
          number_value: 0.004758698865771294
        }
        values {
          number_value: 2.673733900948605e-09
        }
        values {
          number_value: 0.4710583984851837
        }
        values {
          number_value: 0.145528644323349
        }
        values {
          number_value: 1.7886424785729105e-08
        }
        values {
          number_value: 0.37631428241729736
        }
        values {
          number_value: 2.9651535442098975e-05
        }
        values {
          number_value: 0.0002321827778359875
        }
        values {
          number_value: 0.0020594694651663303
        }
        values {
          number_value: 1.8733135220827535e-05
        }
      }
    }
  }
}


[16]:
!minikube delete
πŸ”₯  Deleting "minikube" from virtualbox ...
πŸ’”  The "minikube" cluster has been deleted.
[ ]: