This page was generated from examples/models/chainer_mnist/chainer_mnist.ipynb.
Chainer MNIST Model DeploymentΒΆ
Wrap a Chainer 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
pip install chainer==6.2.0
Train locallyΒΆ
[1]:
#!/usr/bin/env python
import argparse
import chainer
import chainer.functions as F
import chainer.links as L
import chainerx
from chainer import training
from chainer.training import extensions
# Network definition
class MLP(chainer.Chain):
def __init__(self, n_units, n_out):
super(MLP, self).__init__()
with self.init_scope():
# the size of the inputs to each layer will be inferred
self.l1 = L.Linear(None, n_units) # n_in -> n_units
self.l2 = L.Linear(None, n_units) # n_units -> n_units
self.l3 = L.Linear(None, n_out) # n_units -> n_out
def forward(self, x):
h1 = F.relu(self.l1(x))
h2 = F.relu(self.l2(h1))
return self.l3(h2)
def main():
parser = argparse.ArgumentParser(description="Chainer example: MNIST")
parser.add_argument(
"--batchsize",
"-b",
type=int,
default=100,
help="Number of images in each mini-batch",
)
parser.add_argument(
"--epoch",
"-e",
type=int,
default=20,
help="Number of sweeps over the dataset to train",
)
parser.add_argument(
"--frequency", "-f", type=int, default=-1, help="Frequency of taking a snapshot"
)
parser.add_argument(
"--device",
"-d",
type=str,
default="-1",
help="Device specifier. Either ChainerX device "
"specifier or an integer. If non-negative integer, "
"CuPy arrays with specified device id are used. If "
"negative integer, NumPy arrays are used",
)
parser.add_argument(
"--out", "-o", default="result", help="Directory to output the result"
)
parser.add_argument(
"--resume", "-r", type=str, help="Resume the training from snapshot"
)
parser.add_argument("--unit", "-u", type=int, default=1000, help="Number of units")
parser.add_argument(
"--noplot",
dest="plot",
action="store_false",
help="Disable PlotReport extension",
)
group = parser.add_argument_group("deprecated arguments")
group.add_argument(
"--gpu",
"-g",
dest="device",
type=int,
nargs="?",
const=0,
help="GPU ID (negative value indicates CPU)",
)
args = parser.parse_args(args=[])
device = chainer.get_device(args.device)
print("Device: {}".format(device))
print("# unit: {}".format(args.unit))
print("# Minibatch-size: {}".format(args.batchsize))
print("# epoch: {}".format(args.epoch))
print("")
# Set up a neural network to train
# Classifier reports softmax cross entropy loss and accuracy at every
# iteration, which will be used by the PrintReport extension below.
model = L.Classifier(MLP(args.unit, 10))
model.to_device(device)
device.use()
# Setup an optimizer
optimizer = chainer.optimizers.Adam()
optimizer.setup(model)
# Load the MNIST dataset
train, test = chainer.datasets.get_mnist()
train_iter = chainer.iterators.SerialIterator(train, args.batchsize)
test_iter = chainer.iterators.SerialIterator(
test, args.batchsize, repeat=False, shuffle=False
)
# Set up a trainer
updater = training.updaters.StandardUpdater(train_iter, optimizer, device=device)
trainer = training.Trainer(updater, (args.epoch, "epoch"), out=args.out)
# Evaluate the model with the test dataset for each epoch
trainer.extend(extensions.Evaluator(test_iter, model, device=device))
# Dump a computational graph from 'loss' variable at the first iteration
# The "main" refers to the target link of the "main" optimizer.
# TODO(niboshi): Temporarily disabled for chainerx. Fix it.
if device.xp is not chainerx:
trainer.extend(extensions.DumpGraph("main/loss"))
# Take a snapshot for each specified epoch
frequency = args.epoch if args.frequency == -1 else max(1, args.frequency)
trainer.extend(extensions.snapshot(), trigger=(frequency, "epoch"))
# Write a log of evaluation statistics for each epoch
trainer.extend(extensions.LogReport())
# Save two plot images to the result dir
if args.plot and extensions.PlotReport.available():
trainer.extend(
extensions.PlotReport(
["main/loss", "validation/main/loss"], "epoch", file_name="loss.png"
)
)
trainer.extend(
extensions.PlotReport(
["main/accuracy", "validation/main/accuracy"],
"epoch",
file_name="accuracy.png",
)
)
# Print selected entries of the log to stdout
# Here "main" refers to the target link of the "main" optimizer again, and
# "validation" refers to the default name of the Evaluator extension.
# Entries other than 'epoch' are reported by the Classifier link, called by
# either the updater or the evaluator.
trainer.extend(
extensions.PrintReport(
[
"epoch",
"main/loss",
"validation/main/loss",
"main/accuracy",
"validation/main/accuracy",
"elapsed_time",
]
)
)
# Print a progress bar to stdout
trainer.extend(extensions.ProgressBar())
if args.resume is not None:
# Resume from a snapshot
chainer.serializers.load_npz(args.resume, trainer)
# Run the training
trainer.run()
if __name__ == "__main__":
main()
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/chainer/_environment_check.py:41: UserWarning: Accelerate has been detected as a NumPy backend library.
vecLib, which is a part of Accelerate, is known not to work correctly with Chainer.
We recommend using other BLAS libraries such as OpenBLAS.
For details of the issue, please see
https://docs.chainer.org/en/stable/tips.html#mnist-example-does-not-converge-in-cpu-mode-on-mac-os-x.
Please be aware that Mac OS X is not an officially supported OS.
''') # NOQA
Device: @numpy
# unit: 1000
# Minibatch-size: 100
# epoch: 20
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/chainer/training/extensions/plot_report.py:32: UserWarning: matplotlib is not installed on your environment, so nothing will be plotted at this time. Please install matplotlib to plot figures.
$ pip install matplotlib
warnings.warn('matplotlib is not installed on your environment, '
epoch main/loss validation/main/loss main/accuracy validation/main/accuracy elapsed_time
total [..................................................] 0.83%
this epoch [########..........................................] 16.67%
100 iter, 0 epoch / 20 epochs
inf iters/sec. Estimated time to finish: 0:00:00.
total [..................................................] 1.67%
this epoch [################..................................] 33.33%
200 iter, 0 epoch / 20 epochs
43.916 iters/sec. Estimated time to finish: 0:04:28.695672.
total [#.................................................] 2.50%
this epoch [#########################.........................] 50.00%
300 iter, 0 epoch / 20 epochs
45.431 iters/sec. Estimated time to finish: 0:04:17.534906.
total [#.................................................] 3.33%
this epoch [#################################.................] 66.67%
400 iter, 0 epoch / 20 epochs
44.796 iters/sec. Estimated time to finish: 0:04:18.950502.
total [##................................................] 4.17%
this epoch [#########################################.........] 83.33%
500 iter, 0 epoch / 20 epochs
44.363 iters/sec. Estimated time to finish: 0:04:19.224978.
1 0.191134 0.104015 0.942833 0.9664 14.3463
total [##................................................] 5.00%
this epoch [..................................................] 0.00%
600 iter, 1 epoch / 20 epochs
41.815 iters/sec. Estimated time to finish: 0:04:32.630750.
total [##................................................] 5.83%
this epoch [########..........................................] 16.67%
700 iter, 1 epoch / 20 epochs
41.68 iters/sec. Estimated time to finish: 0:04:31.113255.
total [###...............................................] 6.67%
this epoch [################..................................] 33.33%
800 iter, 1 epoch / 20 epochs
41.313 iters/sec. Estimated time to finish: 0:04:31.103168.
total [###...............................................] 7.50%
this epoch [#########################.........................] 50.00%
900 iter, 1 epoch / 20 epochs
40.762 iters/sec. Estimated time to finish: 0:04:32.314401.
total [####..............................................] 8.33%
this epoch [#################################.................] 66.67%
1000 iter, 1 epoch / 20 epochs
40.337 iters/sec. Estimated time to finish: 0:04:32.701110.
total [####..............................................] 9.17%
this epoch [#########################################.........] 83.33%
1100 iter, 1 epoch / 20 epochs
40.131 iters/sec. Estimated time to finish: 0:04:31.609394.
2 0.0770754 0.0721484 0.9757 0.9764 30.3365
total [#####.............................................] 10.00%
this epoch [..................................................] 0.00%
1200 iter, 2 epoch / 20 epochs
39.361 iters/sec. Estimated time to finish: 0:04:34.386204.
total [#####.............................................] 10.83%
this epoch [########..........................................] 16.67%
1300 iter, 2 epoch / 20 epochs
38.88 iters/sec. Estimated time to finish: 0:04:35.203848.
total [#####.............................................] 11.67%
this epoch [################..................................] 33.33%
1400 iter, 2 epoch / 20 epochs
38.471 iters/sec. Estimated time to finish: 0:04:35.534012.
total [######............................................] 12.50%
this epoch [#########################.........................] 50.00%
1500 iter, 2 epoch / 20 epochs
38.217 iters/sec. Estimated time to finish: 0:04:34.750417.
total [######............................................] 13.33%
this epoch [#################################.................] 66.67%
1600 iter, 2 epoch / 20 epochs
38.206 iters/sec. Estimated time to finish: 0:04:32.210044.
total [#######...........................................] 14.17%
this epoch [#########################################.........] 83.33%
1700 iter, 2 epoch / 20 epochs
38.03 iters/sec. Estimated time to finish: 0:04:30.836325.
3 0.0491765 0.0686589 0.984117 0.9783 47.5777
total [#######...........................................] 15.00%
this epoch [..................................................] 0.00%
1800 iter, 3 epoch / 20 epochs
37.621 iters/sec. Estimated time to finish: 0:04:31.123488.
total [#######...........................................] 15.83%
this epoch [########..........................................] 16.67%
1900 iter, 3 epoch / 20 epochs
37.486 iters/sec. Estimated time to finish: 0:04:29.434877.
total [########..........................................] 16.67%
this epoch [################..................................] 33.33%
2000 iter, 3 epoch / 20 epochs
37.124 iters/sec. Estimated time to finish: 0:04:29.367115.
total [########..........................................] 17.50%
this epoch [#########################.........................] 50.00%
2100 iter, 3 epoch / 20 epochs
36.981 iters/sec. Estimated time to finish: 0:04:27.702144.
total [#########.........................................] 18.33%
this epoch [#################################.................] 66.67%
2200 iter, 3 epoch / 20 epochs
36.893 iters/sec. Estimated time to finish: 0:04:25.632841.
total [#########.........................................] 19.17%
this epoch [#########################################.........] 83.33%
2300 iter, 3 epoch / 20 epochs
36.626 iters/sec. Estimated time to finish: 0:04:24.839007.
4 0.0344382 0.0732416 0.988733 0.9793 66.0447
total [##########........................................] 20.00%
this epoch [..................................................] 0.00%
2400 iter, 4 epoch / 20 epochs
36.133 iters/sec. Estimated time to finish: 0:04:25.687154.
total [##########........................................] 20.83%
this epoch [########..........................................] 16.67%
2500 iter, 4 epoch / 20 epochs
36.036 iters/sec. Estimated time to finish: 0:04:23.627129.
total [##########........................................] 21.67%
this epoch [################..................................] 33.33%
2600 iter, 4 epoch / 20 epochs
35.894 iters/sec. Estimated time to finish: 0:04:21.883252.
total [###########.......................................] 22.50%
this epoch [#########################.........................] 50.00%
2700 iter, 4 epoch / 20 epochs
35.863 iters/sec. Estimated time to finish: 0:04:19.317012.
total [###########.......................................] 23.33%
this epoch [#################################.................] 66.67%
2800 iter, 4 epoch / 20 epochs
35.882 iters/sec. Estimated time to finish: 0:04:16.399349.
total [############......................................] 24.17%
this epoch [#########################################.........] 83.33%
2900 iter, 4 epoch / 20 epochs
35.858 iters/sec. Estimated time to finish: 0:04:13.775733.
5 0.0280074 0.0716412 0.990383 0.9804 83.6667
total [############......................................] 25.00%
this epoch [..................................................] 0.00%
3000 iter, 5 epoch / 20 epochs
35.681 iters/sec. Estimated time to finish: 0:04:12.234897.
total [############......................................] 25.83%
this epoch [########..........................................] 16.67%
3100 iter, 5 epoch / 20 epochs
35.678 iters/sec. Estimated time to finish: 0:04:09.451360.
total [#############.....................................] 26.67%
this epoch [################..................................] 33.33%
3200 iter, 5 epoch / 20 epochs
35.648 iters/sec. Estimated time to finish: 0:04:06.858238.
total [#############.....................................] 27.50%
this epoch [#########################.........................] 50.00%
3300 iter, 5 epoch / 20 epochs
35.646 iters/sec. Estimated time to finish: 0:04:04.067962.
total [##############....................................] 28.33%
this epoch [#################################.................] 66.67%
3400 iter, 5 epoch / 20 epochs
35.62 iters/sec. Estimated time to finish: 0:04:01.439835.
total [##############....................................] 29.17%
this epoch [#########################################.........] 83.33%
3500 iter, 5 epoch / 20 epochs
35.548 iters/sec. Estimated time to finish: 0:03:59.114360.
6 0.0221732 0.0800123 0.992683 0.9783 101.278
total [###############...................................] 30.00%
this epoch [..................................................] 0.00%
3600 iter, 6 epoch / 20 epochs
35.394 iters/sec. Estimated time to finish: 0:03:57.328954.
total [###############...................................] 30.83%
this epoch [########..........................................] 16.67%
3700 iter, 6 epoch / 20 epochs
35.101 iters/sec. Estimated time to finish: 0:03:56.458370.
total [###############...................................] 31.67%
this epoch [################..................................] 33.33%
3800 iter, 6 epoch / 20 epochs
35.097 iters/sec. Estimated time to finish: 0:03:53.638225.
total [################..................................] 32.50%
this epoch [#########################.........................] 50.00%
3900 iter, 6 epoch / 20 epochs
35.08 iters/sec. Estimated time to finish: 0:03:50.901687.
total [################..................................] 33.33%
this epoch [#################################.................] 66.67%
4000 iter, 6 epoch / 20 epochs
35.062 iters/sec. Estimated time to finish: 0:03:48.167167.
total [#################.................................] 34.17%
this epoch [#########################################.........] 83.33%
4100 iter, 6 epoch / 20 epochs
35.035 iters/sec. Estimated time to finish: 0:03:45.491051.
7 0.0197829 0.0768317 0.9938 0.9784 119.732
total [#################.................................] 35.00%
this epoch [..................................................] 0.00%
4200 iter, 7 epoch / 20 epochs
34.941 iters/sec. Estimated time to finish: 0:03:43.233173.
total [#################.................................] 35.83%
this epoch [########..........................................] 16.67%
4300 iter, 7 epoch / 20 epochs
34.943 iters/sec. Estimated time to finish: 0:03:40.358854.
total [##################................................] 36.67%
this epoch [################..................................] 33.33%
4400 iter, 7 epoch / 20 epochs
34.939 iters/sec. Estimated time to finish: 0:03:37.521260.
total [##################................................] 37.50%
this epoch [#########################.........................] 50.00%
4500 iter, 7 epoch / 20 epochs
34.942 iters/sec. Estimated time to finish: 0:03:34.640363.
total [###################...............................] 38.33%
this epoch [#################################.................] 66.67%
4600 iter, 7 epoch / 20 epochs
34.936 iters/sec. Estimated time to finish: 0:03:31.816158.
total [###################...............................] 39.17%
this epoch [#########################################.........] 83.33%
4700 iter, 7 epoch / 20 epochs
34.921 iters/sec. Estimated time to finish: 0:03:29.044796.
8 0.016657 0.113716 0.994683 0.9749 137.569
total [####################..............................] 40.00%
this epoch [..................................................] 0.00%
4800 iter, 8 epoch / 20 epochs
34.769 iters/sec. Estimated time to finish: 0:03:27.079825.
total [####################..............................] 40.83%
this epoch [########..........................................] 16.67%
4900 iter, 8 epoch / 20 epochs
34.729 iters/sec. Estimated time to finish: 0:03:24.437863.
total [####################..............................] 41.67%
this epoch [################..................................] 33.33%
5000 iter, 8 epoch / 20 epochs
34.73 iters/sec. Estimated time to finish: 0:03:21.554960.
total [#####################.............................] 42.50%
this epoch [#########################.........................] 50.00%
5100 iter, 8 epoch / 20 epochs
34.724 iters/sec. Estimated time to finish: 0:03:18.709996.
total [#####################.............................] 43.33%
this epoch [#################################.................] 66.67%
5200 iter, 8 epoch / 20 epochs
34.723 iters/sec. Estimated time to finish: 0:03:15.835849.
total [######################............................] 44.17%
this epoch [#########################################.........] 83.33%
5300 iter, 8 epoch / 20 epochs
34.715 iters/sec. Estimated time to finish: 0:03:13.000289.
9 0.0196976 0.0879474 0.993633 0.9807 155.458
total [######################............................] 45.00%
this epoch [..................................................] 0.00%
5400 iter, 9 epoch / 20 epochs
34.626 iters/sec. Estimated time to finish: 0:03:10.610652.
total [######################............................] 45.83%
this epoch [########..........................................] 16.67%
5500 iter, 9 epoch / 20 epochs
34.6 iters/sec. Estimated time to finish: 0:03:07.863616.
total [#######################...........................] 46.67%
this epoch [################..................................] 33.33%
5600 iter, 9 epoch / 20 epochs
34.582 iters/sec. Estimated time to finish: 0:03:05.066867.
total [#######################...........................] 47.50%
this epoch [#########################.........................] 50.00%
5700 iter, 9 epoch / 20 epochs
34.56 iters/sec. Estimated time to finish: 0:03:02.289066.
total [########################..........................] 48.33%
this epoch [#################################.................] 66.67%
5800 iter, 9 epoch / 20 epochs
34.524 iters/sec. Estimated time to finish: 0:02:59.585753.
total [########################..........................] 49.17%
this epoch [#########################################.........] 83.33%
5900 iter, 9 epoch / 20 epochs
34.479 iters/sec. Estimated time to finish: 0:02:56.921205.
10 0.0135036 0.094506 0.9956 0.9788 174.195
total [#########################.........................] 50.00%
this epoch [..................................................] 0.00%
6000 iter, 10 epoch / 20 epochs
34.342 iters/sec. Estimated time to finish: 0:02:54.714546.
total [#########################.........................] 50.83%
this epoch [########..........................................] 16.67%
6100 iter, 10 epoch / 20 epochs
34.293 iters/sec. Estimated time to finish: 0:02:52.047114.
total [#########################.........................] 51.67%
this epoch [################..................................] 33.33%
6200 iter, 10 epoch / 20 epochs
34.267 iters/sec. Estimated time to finish: 0:02:49.260471.
total [##########################........................] 52.50%
this epoch [#########################.........................] 50.00%
6300 iter, 10 epoch / 20 epochs
34.226 iters/sec. Estimated time to finish: 0:02:46.539137.
total [##########################........................] 53.33%
this epoch [#################################.................] 66.67%
6400 iter, 10 epoch / 20 epochs
34.194 iters/sec. Estimated time to finish: 0:02:43.773183.
total [###########################.......................] 54.17%
this epoch [#########################################.........] 83.33%
6500 iter, 10 epoch / 20 epochs
34.149 iters/sec. Estimated time to finish: 0:02:41.057623.
11 0.0174658 0.118295 0.9947 0.9766 193.345
total [###########################.......................] 55.00%
this epoch [..................................................] 0.00%
6600 iter, 11 epoch / 20 epochs
34.04 iters/sec. Estimated time to finish: 0:02:38.637333.
total [###########################.......................] 55.83%
this epoch [########..........................................] 16.67%
6700 iter, 11 epoch / 20 epochs
33.997 iters/sec. Estimated time to finish: 0:02:35.894480.
total [############################......................] 56.67%
this epoch [################..................................] 33.33%
6800 iter, 11 epoch / 20 epochs
33.929 iters/sec. Estimated time to finish: 0:02:33.260000.
total [############################......................] 57.50%
this epoch [#########################.........................] 50.00%
6900 iter, 11 epoch / 20 epochs
33.885 iters/sec. Estimated time to finish: 0:02:30.506863.
total [#############################.....................] 58.33%
this epoch [#################################.................] 66.67%
7000 iter, 11 epoch / 20 epochs
33.848 iters/sec. Estimated time to finish: 0:02:27.717927.
total [#############################.....................] 59.17%
this epoch [#########################################.........] 83.33%
7100 iter, 11 epoch / 20 epochs
33.798 iters/sec. Estimated time to finish: 0:02:24.978252.
12 0.0110422 0.092281 0.996467 0.9804 213.149
total [##############################....................] 60.00%
this epoch [..................................................] 0.00%
7200 iter, 12 epoch / 20 epochs
33.688 iters/sec. Estimated time to finish: 0:02:22.482880.
total [##############################....................] 60.83%
this epoch [########..........................................] 16.67%
7300 iter, 12 epoch / 20 epochs
33.627 iters/sec. Estimated time to finish: 0:02:19.767865.
total [##############################....................] 61.67%
this epoch [################..................................] 33.33%
7400 iter, 12 epoch / 20 epochs
33.57 iters/sec. Estimated time to finish: 0:02:17.027452.
total [###############################...................] 62.50%
this epoch [#########################.........................] 50.00%
7500 iter, 12 epoch / 20 epochs
33.454 iters/sec. Estimated time to finish: 0:02:14.514958.
total [###############################...................] 63.33%
this epoch [#################################.................] 66.67%
7600 iter, 12 epoch / 20 epochs
33.404 iters/sec. Estimated time to finish: 0:02:11.721757.
total [################################..................] 64.17%
this epoch [#########################################.........] 83.33%
7700 iter, 12 epoch / 20 epochs
33.361 iters/sec. Estimated time to finish: 0:02:08.892462.
13 0.0131023 0.112165 0.996183 0.9795 233.983
total [################################..................] 65.00%
this epoch [..................................................] 0.00%
7800 iter, 13 epoch / 20 epochs
33.249 iters/sec. Estimated time to finish: 0:02:06.321430.
total [################################..................] 65.83%
this epoch [########..........................................] 16.67%
7900 iter, 13 epoch / 20 epochs
33.197 iters/sec. Estimated time to finish: 0:02:03.506134.
total [#################################.................] 66.67%
this epoch [################..................................] 33.33%
8000 iter, 13 epoch / 20 epochs
33.148 iters/sec. Estimated time to finish: 0:02:00.671093.
total [#################################.................] 67.50%
this epoch [#########################.........................] 50.00%
8100 iter, 13 epoch / 20 epochs
33.099 iters/sec. Estimated time to finish: 0:01:57.829645.
total [##################################................] 68.33%
this epoch [#################################.................] 66.67%
8200 iter, 13 epoch / 20 epochs
33.044 iters/sec. Estimated time to finish: 0:01:54.999835.
total [##################################................] 69.17%
this epoch [#########################################.........] 83.33%
8300 iter, 13 epoch / 20 epochs
32.925 iters/sec. Estimated time to finish: 0:01:52.378181.
14 0.0107402 0.106344 0.99645 0.9813 255.572
total [###################################...............] 70.00%
this epoch [..................................................] 0.00%
8400 iter, 14 epoch / 20 epochs
32.783 iters/sec. Estimated time to finish: 0:01:49.812125.
total [###################################...............] 70.83%
this epoch [########..........................................] 16.67%
8500 iter, 14 epoch / 20 epochs
32.686 iters/sec. Estimated time to finish: 0:01:47.081025.
total [###################################...............] 71.67%
this epoch [################..................................] 33.33%
8600 iter, 14 epoch / 20 epochs
32.641 iters/sec. Estimated time to finish: 0:01:44.163313.
total [####################################..............] 72.50%
this epoch [#########################.........................] 50.00%
8700 iter, 14 epoch / 20 epochs
32.589 iters/sec. Estimated time to finish: 0:01:41.262226.
total [####################################..............] 73.33%
this epoch [#################################.................] 66.67%
8800 iter, 14 epoch / 20 epochs
32.542 iters/sec. Estimated time to finish: 0:01:38.335180.
total [#####################################.............] 74.17%
this epoch [#########################################.........] 83.33%
8900 iter, 14 epoch / 20 epochs
32.489 iters/sec. Estimated time to finish: 0:01:35.416948.
15 0.0125309 0.0853632 0.996467 0.9835 277.066
total [#####################################.............] 75.00%
this epoch [..................................................] 0.00%
9000 iter, 15 epoch / 20 epochs
32.402 iters/sec. Estimated time to finish: 0:01:32.586512.
total [#####################################.............] 75.83%
this epoch [########..........................................] 16.67%
9100 iter, 15 epoch / 20 epochs
32.348 iters/sec. Estimated time to finish: 0:01:29.649633.
total [######################################............] 76.67%
this epoch [################..................................] 33.33%
9200 iter, 15 epoch / 20 epochs
32.302 iters/sec. Estimated time to finish: 0:01:26.683121.
total [######################################............] 77.50%
this epoch [#########################.........................] 50.00%
9300 iter, 15 epoch / 20 epochs
32.247 iters/sec. Estimated time to finish: 0:01:23.728150.
total [#######################################...........] 78.33%
this epoch [#################################.................] 66.67%
9400 iter, 15 epoch / 20 epochs
32.181 iters/sec. Estimated time to finish: 0:01:20.793071.
total [#######################################...........] 79.17%
this epoch [#########################################.........] 83.33%
9500 iter, 15 epoch / 20 epochs
32.114 iters/sec. Estimated time to finish: 0:01:17.848522.
16 0.0076524 0.0845158 0.9977 0.9833 299.077
total [########################################..........] 80.00%
this epoch [..................................................] 0.00%
9600 iter, 16 epoch / 20 epochs
32.021 iters/sec. Estimated time to finish: 0:01:14.951347.
total [########################################..........] 80.83%
this epoch [########..........................................] 16.67%
9700 iter, 16 epoch / 20 epochs
31.966 iters/sec. Estimated time to finish: 0:01:11.951340.
total [########################################..........] 81.67%
this epoch [################..................................] 33.33%
9800 iter, 16 epoch / 20 epochs
31.917 iters/sec. Estimated time to finish: 0:01:08.928651.
total [#########################################.........] 82.50%
this epoch [#########################.........................] 50.00%
9900 iter, 16 epoch / 20 epochs
31.865 iters/sec. Estimated time to finish: 0:01:05.903967.
total [#########################################.........] 83.33%
this epoch [#################################.................] 66.67%
10000 iter, 16 epoch / 20 epochs
31.812 iters/sec. Estimated time to finish: 0:01:02.869297.
total [##########################################........] 84.17%
this epoch [#########################################.........] 83.33%
10100 iter, 16 epoch / 20 epochs
31.743 iters/sec. Estimated time to finish: 0:00:59.854943.
17 0.0125142 0.0967522 0.996583 0.9808 321.412
total [##########################################........] 85.00%
this epoch [..................................................] 0.00%
10200 iter, 17 epoch / 20 epochs
31.571 iters/sec. Estimated time to finish: 0:00:57.014005.
total [##########################################........] 85.83%
this epoch [########..........................................] 16.67%
10300 iter, 17 epoch / 20 epochs
31.412 iters/sec. Estimated time to finish: 0:00:54.119356.
total [###########################################.......] 86.67%
this epoch [################..................................] 33.33%
10400 iter, 17 epoch / 20 epochs
31.253 iters/sec. Estimated time to finish: 0:00:51.194843.
total [###########################################.......] 87.50%
this epoch [#########################.........................] 50.00%
10500 iter, 17 epoch / 20 epochs
31.052 iters/sec. Estimated time to finish: 0:00:48.305561.
total [############################################......] 88.33%
this epoch [#################################.................] 66.67%
10600 iter, 17 epoch / 20 epochs
30.971 iters/sec. Estimated time to finish: 0:00:45.203923.
total [############################################......] 89.17%
this epoch [#########################################.........] 83.33%
10700 iter, 17 epoch / 20 epochs
30.835 iters/sec. Estimated time to finish: 0:00:42.159730.
18 0.00738255 0.112494 0.997783 0.9795 345.352
total [#############################################.....] 90.00%
this epoch [..................................................] 0.00%
10800 iter, 18 epoch / 20 epochs
30.674 iters/sec. Estimated time to finish: 0:00:39.121586.
total [#############################################.....] 90.83%
this epoch [########..........................................] 16.67%
10900 iter, 18 epoch / 20 epochs
30.563 iters/sec. Estimated time to finish: 0:00:35.991122.
total [#############################################.....] 91.67%
this epoch [################..................................] 33.33%
11000 iter, 18 epoch / 20 epochs
30.458 iters/sec. Estimated time to finish: 0:00:32.831952.
total [##############################################....] 92.50%
this epoch [#########################.........................] 50.00%
11100 iter, 18 epoch / 20 epochs
30.334 iters/sec. Estimated time to finish: 0:00:29.669973.
total [##############################################....] 93.33%
this epoch [#################################.................] 66.67%
11200 iter, 18 epoch / 20 epochs
30.257 iters/sec. Estimated time to finish: 0:00:26.440229.
total [###############################################...] 94.17%
this epoch [#########################################.........] 83.33%
11300 iter, 18 epoch / 20 epochs
30.178 iters/sec. Estimated time to finish: 0:00:23.195403.
19 0.0121511 0.0853964 0.9964 0.9833 368.794
total [###############################################...] 95.00%
this epoch [..................................................] 0.00%
11400 iter, 19 epoch / 20 epochs
30.066 iters/sec. Estimated time to finish: 0:00:19.956411.
total [###############################################...] 95.83%
this epoch [########..........................................] 16.67%
11500 iter, 19 epoch / 20 epochs
29.966 iters/sec. Estimated time to finish: 0:00:16.685483.
total [################################################..] 96.67%
this epoch [################..................................] 33.33%
11600 iter, 19 epoch / 20 epochs
29.849 iters/sec. Estimated time to finish: 0:00:13.400864.
total [################################################..] 97.50%
this epoch [#########################.........................] 50.00%
11700 iter, 19 epoch / 20 epochs
29.753 iters/sec. Estimated time to finish: 0:00:10.082910.
total [#################################################.] 98.33%
this epoch [#################################.................] 66.67%
11800 iter, 19 epoch / 20 epochs
29.675 iters/sec. Estimated time to finish: 0:00:06.739601.
total [#################################################.] 99.17%
this epoch [#########################################.........] 83.33%
11900 iter, 19 epoch / 20 epochs
29.581 iters/sec. Estimated time to finish: 0:00:03.380585.
20 0.00638073 0.098195 0.997883 0.9814 392.74
total [##################################################] 100.00%
this epoch [..................................................] 0.00%
12000 iter, 20 epoch / 20 epochs
29.484 iters/sec. Estimated time to finish: 0:00:00.
Wrap model using s2i
[2]:
!s2i build . seldonio/seldon-core-s2i-python37-ubi8:1.7.0-dev chainer-mnist:0.1
---> Installing application source...
---> Installing dependencies ...
Looking in links: /whl
Collecting chainer==6.2.0 (from -r requirements.txt (line 1))
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
Downloading https://files.pythonhosted.org/packages/2c/5a/86c50a0119a560a39d782c4cdd9b72927c090cc2e3f70336e01b19a5f97a/chainer-6.2.0.tar.gz (873kB)
Requirement already satisfied: setuptools in /usr/local/lib/python3.6/site-packages (from chainer==6.2.0->-r requirements.txt (line 1)) (41.0.1)
Collecting typing<=3.6.6 (from chainer==6.2.0->-r requirements.txt (line 1))
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
Downloading https://files.pythonhosted.org/packages/4a/bd/eee1157fc2d8514970b345d69cb9975dcd1e42cd7e61146ed841f6e68309/typing-3.6.6-py3-none-any.whl
Collecting typing_extensions<=3.6.6 (from chainer==6.2.0->-r requirements.txt (line 1))
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
Downloading https://files.pythonhosted.org/packages/62/4f/392a1fa2873e646f5990eb6f956e662d8a235ab474450c72487745f67276/typing_extensions-3.6.6-py3-none-any.whl
Collecting filelock (from chainer==6.2.0->-r requirements.txt (line 1))
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
Downloading https://files.pythonhosted.org/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl
Requirement already satisfied: numpy>=1.9.0 in /usr/local/lib/python3.6/site-packages (from chainer==6.2.0->-r requirements.txt (line 1)) (1.16.4)
Collecting protobuf<3.8.0rc1,>=3.0.0 (from chainer==6.2.0->-r requirements.txt (line 1))
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
Downloading https://files.pythonhosted.org/packages/5a/aa/a858df367b464f5e9452e1c538aa47754d467023850c00b000287750fa77/protobuf-3.7.1-cp36-cp36m-manylinux1_x86_64.whl (1.2MB)
Requirement already satisfied: six>=1.9.0 in /usr/local/lib/python3.6/site-packages (from chainer==6.2.0->-r requirements.txt (line 1)) (1.12.0)
Building wheels for collected packages: chainer
Building wheel for chainer (setup.py): started
Building wheel for chainer (setup.py): finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/2e/be/c5/6ee506abcaa4a53106f7d7671bbee8b4e5243bc562a9d32ad1
Successfully built chainer
Installing collected packages: typing, typing-extensions, filelock, protobuf, chainer
Found existing installation: protobuf 3.8.0
Uninstalling protobuf-3.8.0:
Successfully uninstalled protobuf-3.8.0
Successfully installed chainer-6.2.0 filelock-3.0.12 protobuf-3.7.1 typing-3.6.6 typing-extensions-3.6.6
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
WARNING: You are using pip version 19.1, however version 19.2.2 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 chainer-mnist:0.1
b03f58f82ca07e25261be34b75be4a0ffbbfa1ad736d3866790682bf0d8202a3
Send some random features that conform to the contract
[6]:
!seldon-core-tester contract.json 0.0.0.0 5000 -p
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
----------------------------------------
SENDING NEW REQUEST:
[[0.997 0.039 0.778 0.59 0.526 0.591 0.659 0.423 0.404 0.302 0.322 0.453
0.54 0.852 0.268 0.564 0.163 0.032 0.934 0.317 0.395 0.122 0.056 0.729
0.106 0.443 0.334 0.784 0.646 0.296 0.524 0.855 0.503 0.727 0.326 0.491
0.385 0.042 0.82 0.715 0.972 0.699 0.431 0.618 0.096 0.849 0.224 0.187
0.145 0.357 0.187 0.779 0.009 0.775 0.775 0.584 0.897 0.674 0.01 0.775
0.095 0.081 0.089 0.351 0.985 0.878 0.906 0.396 0.499 0.646 0.127 0.966
0.087 0.668 0.314 0.853 0.55 0.345 0.95 0.792 0.797 0.037 0.18 0.592
0.941 0.662 0.101 0.388 0.902 0.868 0.505 0.824 0.8 0.855 0.568 0.368
0.605 0.224 0.214 0.582 0.365 0.44 0.389 0.922 0.028 0.142 0.525 0.843
0.706 0.61 0.215 0.962 0.334 0.273 0.365 0.075 0.929 0.693 0.382 0.76
0.75 0.403 0.344 0.218 0.831 0.431 0.469 0.527 0.755 0.048 0.407 0.953
0.468 0.186 0.589 0.839 0.513 0.307 0.251 0.738 0.173 0.185 0.499 0.797
0.264 0.149 0.547 0.699 0.935 0.071 0.145 0.853 0.884 0.195 0.944 0.775
0.523 0.627 0.729 0.826 0.894 0.117 0.935 0.363 0.03 0.16 0.435 0.579
0.954 0.487 0.133 0.348 0.12 0.741 0.203 0.103 0.334 0.009 0.898 0.597
0.375 0.241 0.27 0.094 0.819 0.737 0.147 0.715 0.138 0.801 0.427 0.602
0.336 0.796 0.691 0.415 0.329 0.155 0.17 0.152 0.237 0.957 0.298 0.837
0.982 0.805 0.972 0.125 0.916 0.101 0.054 0.347 0.566 0.232 0.885 0.864
0.049 0.205 0.361 0.767 0.099 0.634 0.359 0.975 0.56 0.289 0.49 0.359
0.901 0.39 0.197 0.985 0.141 0.232 0.336 0.932 0.923 0.032 0.126 0.51
0.571 0.743 0.831 0.999 0.972 0.649 0.527 0.909 0.071 0.539 0.676 0.851
0.104 0.103 0.392 0.641 0.838 0.333 0.453 0.573 0.199 0.924 0.588 0.955
0.866 0.085 0.985 0.803 0.386 0.713 0.056 0.972 0.489 0.623 0.108 0.904
0.746 0.986 0.824 0.996 0.161 0.738 0.24 0.153 0.935 0.782 0.393 0.098
0.449 0.24 0.621 0.293 0.569 0.196 0.893 0.605 0.608 0.114 0.383 0.038
0.573 0.373 0.474 0.006 0.292 0.738 0.943 0.65 0.553 0.684 0.3 0.587
0.183 0.521 0.211 0.074 0.696 0.672 0.206 0.694 0.129 0.81 0.415 0.56
0.994 0.686 0.807 0.514 0.215 0.096 0.295 0.233 0.625 0.663 0.794 0.16
0.837 0.194 0.07 0.939 0.965 0.142 0.66 0.152 0.249 0.995 0.892 0.265
0.865 0.742 0.19 0.03 0.42 0.807 0.15 0.163 0.529 0.23 0.59 0.676
0.121 0.474 0.329 0.383 0.534 0.093 0.861 0.058 0.019 0.212 0.296 0.947
0.879 0.445 0.357 0.021 0.551 0.362 0.653 0.258 0.146 0.453 0.373 0.448
0.339 0.974 0.266 0.656 0.036 0.698 0.651 0.91 0.438 0.767 0.716 0.267
0.871 0.781 0.13 0.912 0.13 0.332 0.647 0.31 0.171 0.323 0.703 0.197
0.918 0.803 0.43 0.103 0.606 0.955 0.733 0.902 0.139 0.471 0.994 0.393
0.95 0.485 0.782 0.213 0.994 0.206 0.938 0.019 0.429 0.135 0.811 0.209
0.991 0.93 0.878 0.742 0.859 0.397 0.128 0.087 0.447 0.392 0.61 0.18
0.087 0.641 0.31 0.033 0.211 0.431 0.051 0.639 0.461 0.466 0.171 0.736
0.727 0.183 0.542 0.416 0.524 0.251 0.513 0.087 0.395 0.164 0.25 0.384
0.705 0.683 0.827 0.188 0.163 0.325 0.256 0.904 0.161 0.334 0.639 0.728
0.267 0.463 0.373 0.111 0.585 0.794 0.972 0.281 0.984 0.564 0.671 0.868
0.741 0.638 0.702 0.778 0.667 0.372 0.818 0.49 0.102 0.403 0.187 0.283
0.492 0.937 0.643 0.657 0.514 0.492 0.042 0.809 0.088 0.018 0.631 0.731
0.516 0.625 0.597 0.629 0.798 0.907 0.861 0.439 0.777 0.014 0.771 0.152
0.16 0.997 0.699 0.127 0.038 0.503 0.572 0.878 0.901 0.215 0.606 0.686
0.847 0.007 0.976 0.895 0.357 0.374 0.989 0.544 0.317 0.043 0.718 0.788
0.121 0.432 0.16 0.485 0.553 0.048 0.003 0.375 0.592 0.207 0.853 0.81
0.043 0.554 0.084 0.584 0.73 0.766 0.738 0.038 0.56 0.475 0.763 0.002
0.382 0.49 0.302 0.873 0.141 0.023 0.341 0.113 0.197 0.948 0.088 0.294
0.778 0.807 0.935 0.712 0.466 0.885 0.815 0.843 0.745 0.217 0.664 0.142
0.421 0.371 0.536 0.009 0.036 0.352 0.916 0.161 0.345 0.348 0.688 0.806
0.434 0.413 0.567 0.043 0.934 0.072 0.54 0.347 0.817 0.321 0.85 0.478
0.832 0.899 0.283 0.34 0.304 0.955 0.915 0.934 0.452 0.423 0.75 0.013
0.5 0.691 0.854 0.453 0.959 0.843 0.698 0.756 0.918 0.992 0.663 0.608
0.756 0.7 0.347 0.427 0.198 0.37 0.837 0.362 0.291 0.126 0.695 0.777
0.318 0.88 0.859 0.958 0.075 0.332 0.321 0.179 0.834 0.027 0.332 0.799
0.504 0.274 0.819 0.081 0.337 0.02 0.598 0.727 0.159 0.937 0.199 0.639
0.063 0.75 0.637 0.686 0.677 0.102 0.135 0.264 0.091 0.837 0.562 0.453
0.503 0.884 0.147 0.966 0.118 0.293 0.327 0.859 0.958 0.498 0.369 0.123
0.354 0.812 0.163 0.96 0.64 0.596 0.029 0.84 0.159 0.717 0.025 0.394
0.185 0.29 0.554 0.646 0.432 0.197 0.668 0.531 0.206 0.599 0.842 0.579
0.836 0.889 0.797 0.891 0.1 0.087 0.825 0.952 0.781 0.295 0.819 0.038
0.34 0.476 0.08 0.784 0.556 0.282 0.699 0.954 0.5 0.332 0.213 0.618
0.92 0.776 0.147 0.749 0.597 0.191 0.957 0.47 0.324 0.352 0.837 0.263
0.536 0.48 0.997 0.417 0.08 0.464 0.886 0.019 0.307 0.164 0.36 0.638
0.46 0.803 0.139 0.575]]
Traceback (most recent call last):
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
raise err
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
chunked=chunked)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/urllib3/connectionpool.py", line 355, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/http/client.py", line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/http/client.py", line 1290, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/http/client.py", line 1239, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/urllib3/connection.py", line 183, in connect
conn = self._new_conn()
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x1232a2050>: Failed to establish a new connection: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/urllib3/connectionpool.py", line 641, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='0.0.0.0', port=5000): Max retries exceeded with url: /predict (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1232a2050>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/bin/seldon-core-tester", line 10, in <module>
sys.exit(main())
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/seldon_core/microservice_tester.py", line 258, in main
run_predict(args)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/seldon_core/microservice_tester.py", line 225, in run_predict
response = sc.microservice(data=batch, transport=transport, method="predict", payload_type=payload_type, names=feature_names)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/seldon_core/seldon_client.py", line 395, in microservice
return microservice_api_rest_seldon_message(**k)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/seldon_core/seldon_client.py", line 534, in microservice_api_rest_seldon_message
data={"json": json.dumps(payload)})
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/requests/api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=5000): Max retries exceeded with url: /predict (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1232a2050>: Failed to establish a new connection: [Errno 61] Connection refused'))
[7]:
!docker rm mnist_predictor --force
Error: No such container: mnist_predictor
Test using MinikubeΒΆ
Due to aminikube/s2i issueyou will needs2i >= 1.1.13
[14]:
!minikube start --memory 4096
π minikube v1.2.0 on darwin (amd64)
π₯ Creating virtualbox VM (CPUs=2, Memory=4096MB, Disk=20000MB) ...
π³ Configuring environment for Kubernetes v1.15.0 on Docker 18.09.6
π Pulling images ...
π Launching Kubernetes ...
β Verifying: apiserver proxy etcd scheduler controller dns
π Done! kubectl is now configured to use "minikube"
Setup Seldon CoreΒΆ
Use the setup notebook to Setup Cluster with Ambassador Ingress and Install Seldon Core. Instructions also online.
[22]:
!eval $(minikube docker-env) && s2i build . seldonio/seldon-core-s2i-python37-ubi8:1.7.0-dev chainer-mnist:0.1
---> Installing application source...
---> Installing dependencies ...
Looking in links: /whl
Collecting chainer==6.2.0 (from -r requirements.txt (line 1))
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
Downloading https://files.pythonhosted.org/packages/2c/5a/86c50a0119a560a39d782c4cdd9b72927c090cc2e3f70336e01b19a5f97a/chainer-6.2.0.tar.gz (873kB)
Requirement already satisfied: setuptools in /usr/local/lib/python3.6/site-packages (from chainer==6.2.0->-r requirements.txt (line 1)) (41.0.1)
Collecting typing<=3.6.6 (from chainer==6.2.0->-r requirements.txt (line 1))
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
Downloading https://files.pythonhosted.org/packages/4a/bd/eee1157fc2d8514970b345d69cb9975dcd1e42cd7e61146ed841f6e68309/typing-3.6.6-py3-none-any.whl
Collecting typing_extensions<=3.6.6 (from chainer==6.2.0->-r requirements.txt (line 1))
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
Downloading https://files.pythonhosted.org/packages/62/4f/392a1fa2873e646f5990eb6f956e662d8a235ab474450c72487745f67276/typing_extensions-3.6.6-py3-none-any.whl
Collecting filelock (from chainer==6.2.0->-r requirements.txt (line 1))
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
Downloading https://files.pythonhosted.org/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl
Requirement already satisfied: numpy>=1.9.0 in /usr/local/lib/python3.6/site-packages (from chainer==6.2.0->-r requirements.txt (line 1)) (1.16.4)
Collecting protobuf<3.8.0rc1,>=3.0.0 (from chainer==6.2.0->-r requirements.txt (line 1))
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
Downloading https://files.pythonhosted.org/packages/5a/aa/a858df367b464f5e9452e1c538aa47754d467023850c00b000287750fa77/protobuf-3.7.1-cp36-cp36m-manylinux1_x86_64.whl (1.2MB)
Requirement already satisfied: six>=1.9.0 in /usr/local/lib/python3.6/site-packages (from chainer==6.2.0->-r requirements.txt (line 1)) (1.12.0)
Building wheels for collected packages: chainer
Building wheel for chainer (setup.py): started
Building wheel for chainer (setup.py): finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/2e/be/c5/6ee506abcaa4a53106f7d7671bbee8b4e5243bc562a9d32ad1
Successfully built chainer
Installing collected packages: typing, typing-extensions, filelock, protobuf, chainer
Found existing installation: protobuf 3.8.0
Uninstalling protobuf-3.8.0:
Successfully uninstalled protobuf-3.8.0
Successfully installed chainer-6.2.0 filelock-3.0.12 protobuf-3.7.1 typing-3.6.6 typing-extensions-3.6.6
WARNING: Url '/whl' is ignored. It is either a non-existing path or lacks a specific scheme.
WARNING: You are using pip version 19.1, however version 19.2.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Build completed successfully
[23]:
!kubectl create -f chainer_mnist_deployment.json
seldondeployment.machinelearning.seldon.io/seldon-deployment-example created
[24]:
!kubectl rollout status deploy/chainer-mnist-deployment-chainer-mnist-predictor-76478b2
Waiting for deployment "chainer-mnist-deployment-chainer-mnist-predictor-76478b2" rollout to finish: 0 of 1 updated replicas are available...
deployment "chainer-mnist-deployment-chainer-mnist-predictor-76478b2" successfully rolled out
[25]:
!seldon-core-api-tester contract.json `minikube ip` `kubectl get svc ambassador -o jsonpath='{.spec.ports[0].nodePort}'` \
seldon-deployment-example --namespace default -p
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/Users/dtaniwaki/.pyenv/versions/3.7.4/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
----------------------------------------
SENDING NEW REQUEST:
[[0.64 0.213 0.028 0.604 0.586 0.076 0.629 0.568 0.806 0.931 0.266 0.098
0.526 0.336 0.569 0.965 0.157 0.401 0.15 0.405 0.594 0.21 0.699 0.085
0.314 0.467 0.303 0.384 0.788 0.135 0.349 0.467 0.025 0.525 0.767 0.819
0.275 0.212 0.784 0.448 0.808 0.582 0.939 0.165 0.761 0.272 0.332 0.321
0.005 0.921 0.285 0.181 0.161 0.948 0.148 0.788 0.664 0.65 0.795 0.548
0.754 0.407 0.057 0.429 0.569 0.538 0.295 0.4 0.581 0.569 0.299 0.066
0.456 0.118 0.983 0.93 0.316 0.865 0.492 0.048 0.505 0.573 0.595 0.13
0.595 0.595 0.474 0.334 0.708 0.25 0.183 0.391 0.268 0.252 0.366 0.029
0.676 0.869 0.12 0.737 0.502 0.868 0.846 0.891 0.578 0.598 0.984 0.543
0.515 0.081 0.998 0.976 0.611 0.492 0.494 0.985 0.443 0.246 0.252 0.871
0.615 0.885 0.903 0.254 0.651 0.412 0.645 0.608 0.921 0.5 0.18 0.845
0.91 0.601 0.782 0.27 0.643 0.671 0.273 0.37 0.454 0.08 0.854 0.439
0.912 0.709 0.703 0.817 0.381 0.963 0.057 0.015 0.126 0.686 0.284 0.463
0.231 0.332 0.932 0.804 0.538 0.039 0.12 0.992 0.436 0.791 0.261 0.842
0.901 0.208 0.578 0.423 0.657 0.293 0.633 0.45 0.609 0.715 0.149 0.244
0.026 0.332 0.525 0.157 0.749 0.88 0.713 0.405 0.473 0.01 0.038 0.807
0.934 0.157 0.141 0.155 0.124 0.781 0.738 0.018 0.42 0.635 0.867 0.925
0.398 0.505 0.695 0.429 0.174 0.327 0.123 0.967 0.378 0.224 0.393 0.053
0.344 0.731 0.02 0.848 0.079 0.814 0.023 0.087 0.578 0.642 0.18 0.563
0.276 0.491 0.021 0.719 0.85 0.156 0.031 0.506 0.271 0.095 0.186 0.002
0.799 0.138 0.734 0.925 0.881 0.187 0.559 0.946 0.826 0.488 0.744 0.322
0.333 0.322 0.665 0.032 0.663 0.754 0.495 0.569 0.917 0.167 0.168 0.409
0.369 0.363 0.23 0.961 0.201 0.463 0.565 0.834 0.431 0.848 0.742 0.436
0.061 0.656 0.3 0.128 0.485 0.78 0.617 0.082 0.396 0.416 0.673 0.961
0.727 0.986 0.222 0.909 0.898 0.144 0.639 0.046 0.101 0.546 0.782 0.069
0.672 0.824 0.861 0.981 0.003 0.591 0.303 0.384 0.67 0.7 0.834 0.475
0.932 0.949 0.938 0.945 0.368 0.522 0.833 0.045 0.452 0.068 0.165 0.569
0.44 0.702 0.727 0.069 0.686 0.262 0.891 0.547 0.994 0.454 0.947 0.364
0.154 0.322 0.571 0.19 0.476 0.925 0.871 0.605 0.442 0.585 0.544 0.316
0.915 0.253 0.973 0.501 0.402 0.96 0.206 0.501 0.37 0.463 0.904 0.981
0.969 0.877 0.724 0.5 0.447 0.499 0.443 0.349 0.79 0.051 0.384 0.27
0.094 0.774 0.742 0.16 0.517 0.266 0.908 0.796 0.862 0.987 0.939 0.909
0.962 0.587 0.964 0.159 0.029 0.952 0.416 0.72 0.346 0.257 0.152 0.233
0.862 0.457 0.153 0.076 0.105 0.634 0.652 0.435 0.757 0.985 0.487 0.114
0.95 0.217 0.877 0.483 0.302 0.929 0.856 0.768 0.223 0.006 0.841 0.565
0.611 0.407 0.71 0.588 0.654 0.197 0.506 0.938 0.779 0.387 0.007 0.482
0.523 0.993 0.671 0.044 0.497 0.71 0.418 0.06 0.114 0.082 0.811 0.083
0.773 0.134 0.87 0.414 0.787 0.972 0.132 0.047 0.593 0.502 0.15 0.042
0.363 0.311 0.17 0.895 0.569 0.774 0.006 0.408 0.92 0.753 0.543 0.279
0.911 0.314 0.195 0.538 0.977 0.606 0.954 0.378 0.397 0.261 0.085 0.656
0.978 0.598 0.216 0.832 0.105 0.958 0.185 0.81 0.444 0.308 0.013 0.176
0.603 0.383 0.671 0.436 0.981 0.072 0.713 0.349 0.962 0.055 0.315 0.417
0.052 0.076 0.198 0.786 0.397 0.757 0.145 0.539 0.671 0.583 0.42 0.575
0.563 0.286 0.788 0.481 0.403 0.85 0.864 0.945 0.427 0.511 0.268 0.091
0.049 0.611 0.137 0.58 0.281 0.057 0.453 0.461 0.895 0.701 0.662 0.599
0.967 0.562 0.295 0.6 0.742 0.909 0.69 0.383 0.553 0.078 0.949 0.109
0.771 0.083 0.712 0.514 0.549 0.403 0.575 0.494 0.31 0.307 0.091 0.874
0.591 0.315 0.199 0.372 0.131 0.905 0.32 0.284 0.516 0.055 0.832 0.042
0.927 0.667 0.273 0.426 0.054 0.799 0.356 0.564 0.223 0.772 0.79 0.628
0.893 0.512 0.523 0.518 0.48 0.869 0.49 0.416 0.775 0.864 0.921 0.968
0.109 0.812 0.943 0.042 0.179 0.943 0.324 0.079 0.017 0.226 0.848 0.803
0.873 0.834 0.696 0.582 0.125 0.042 0.917 0.909 0.491 0.5 0.101 0.779
0.65 0.424 0.94 0.582 0.706 0.935 0.286 0.057 0.544 0.198 0.893 0.537
0.405 0.91 0.908 0.297 0.288 0.368 0.654 0.347 0.002 0.677 0.32 0.691
0.17 0.133 0.586 0.857 0.001 0.639 0.223 0.164 0.689 0.97 0.913 0.947
0.962 0.44 0.201 0.343 0.493 0.662 0.728 0.295 0.445 0.739 0.764 0.955
0.206 0.298 0.996 0.835 0.983 0.033 0.801 0.284 0.621 0.941 0.293 0.865
0.158 0.788 0.681 0.613 0.705 0.753 0.006 0.175 0.414 0.299 0.116 0.67
0.66 0.845 0.905 0.369 0.11 0.841 0.717 0.348 0.537 0.116 0.024 0.575
0.211 0.427 0.84 0.447 0.056 0.427 0.39 0.424 0.48 0.738 0.698 0.377
0.143 0.242 0.877 0.238 0.188 0.786 0.965 0.112 0.952 0.679 0.916 0.13
0.882 0.353 0.433 0.608 0.297 0.558 0.663 0.646 0.185 0.91 0.131 0.217
0.549 0.759 0.087 0.96 0.11 0.613 0.643 0.218 0.126 0.535 0.751 0.097
0.681 0.782 0.367 0.197 0.05 0.742 0.623 0.763 0.625 0.317 0.364 0.879
0.445 0.751 0.87 0.727 0.879 0.035 0.412 0.907 0.895 0.923 0.373 0.22
0.21 0.176 0.182 0.821]]
RECEIVED RESPONSE:
meta {
puid: "c88qkq0g5nsdtkero34a1i56dv"
requestPath {
key: "chainer-mnist-classifier"
value: "chainer-mnist:0.1"
}
}
data {
names: "t:0"
names: "t:1"
names: "t:2"
names: "t:3"
names: "t:4"
names: "t:5"
names: "t:6"
names: "t:7"
names: "t:8"
names: "t:9"
ndarray {
values {
list_value {
values {
number_value: 2.4670965671539307
}
values {
number_value: -4.471328258514404
}
values {
number_value: -12.0973482131958
}
values {
number_value: -8.344386100769043
}
values {
number_value: -1.4862585067749023
}
values {
number_value: -2.065153121948242
}
values {
number_value: 1.480709195137024
}
values {
number_value: -6.679415702819824
}
values {
number_value: -7.224794864654541
}
values {
number_value: -7.008320331573486
}
}
}
}
}
[ ]:
!minikube delete