initial commit

This commit is contained in:
Ziad Arafat (RustyRaptor) committed 2019-07-16 09:51:50 -06:00
1 parent 69716636c9
commit 423cad3cae
7 files changed
+1372

No files matched your search

+186
View File
@@ -0,0 +1,186 @@
from __future__ import print_function
import json
import logging
import os
import time
import mxnet as mx
from mxnet import autograd as ag
from mxnet import gluon
from mxnet.gluon.model_zoo import vision as models
# ------------------------------------------------------------ #
# Training methods #
# ------------------------------------------------------------ #
def train(current_host, hosts, num_cpus, num_gpus, channel_input_dirs, model_dir, hyperparameters, **kwargs):
# retrieve the hyperparameters we set in notebook (with some defaults)
batch_size = hyperparameters.get('batch_size', 128)
epochs = hyperparameters.get('epochs', 100)
learning_rate = hyperparameters.get('learning_rate', 0.1)
momentum = hyperparameters.get('momentum', 0.9)
log_interval = hyperparameters.get('log_interval', 1)
wd = hyperparameters.get('wd', 0.0001)
if len(hosts) == 1:
kvstore = 'device' if num_gpus > 0 else 'local'
else:
kvstore = 'dist_device_sync'
ctx = [mx.gpu(i) for i in range(num_gpus)] if num_gpus > 0 else [mx.cpu()]
net = models.get_model('resnet34_v2', ctx=ctx, pretrained=False, classes=10)
batch_size *= max(1, len(ctx))
# load training and validation data
# we use the gluon.data.vision.CIFAR10 class because of its built in pre-processing logic,
# but point it at the location where SageMaker placed the data files, so it doesn't download them again.
part_index = 0
for i, host in enumerate(hosts):
if host == current_host:
part_index = i
break
data_dir = channel_input_dirs['training']
train_data = get_train_data(num_cpus, data_dir, batch_size, (3, 32, 32),
num_parts=len(hosts), part_index=part_index)
test_data = get_test_data(num_cpus, data_dir, batch_size, (3, 32, 32))
# Collect all parameters from net and its children, then initialize them.
net.initialize(mx.init.Xavier(magnitude=2), ctx=ctx)
# Trainer is for updating parameters with gradient.
trainer = gluon.Trainer(net.collect_params(), 'sgd',
optimizer_params={'learning_rate': learning_rate, 'momentum': momentum, 'wd': wd},
kvstore=kvstore)
metric = mx.metric.Accuracy()
loss = gluon.loss.SoftmaxCrossEntropyLoss()
best_accuracy = 0.0
for epoch in range(epochs):
# reset data iterator and metric at begining of epoch.
train_data.reset()
tic = time.time()
metric.reset()
btic = time.time()
for i, batch in enumerate(train_data):
data = gluon.utils.split_and_load(batch.data[0], ctx_list=ctx, batch_axis=0)
label = gluon.utils.split_and_load(batch.label[0], ctx_list=ctx, batch_axis=0)
outputs = []
Ls = []
with ag.record():
for x, y in zip(data, label):
z = net(x)
L = loss(z, y)
# store the loss and do backward after we have done forward
# on all GPUs for better speed on multiple GPUs.
Ls.append(L)
outputs.append(z)
for L in Ls:
L.backward()
trainer.step(batch.data[0].shape[0])
metric.update(label, outputs)
if i % log_interval == 0 and i > 0:
name, acc = metric.get()
logging.info('Epoch [%d] Batch [%d]\tSpeed: %f samples/sec\t%s=%f' %
(epoch, i, batch_size / (time.time() - btic), name, acc))
btic = time.time()
name, acc = metric.get()
logging.info('[Epoch %d] training: %s=%f' % (epoch, name, acc))
logging.info('[Epoch %d] time cost: %f' % (epoch, time.time() - tic))
name, val_acc = test(ctx, net, test_data)
logging.info('[Epoch %d] validation: %s=%f' % (epoch, name, val_acc))
# only save params on primary host
if current_host == hosts[0]:
if val_acc > best_accuracy:
net.save_params('{}/model-{:0>4}.params'.format(model_dir, epoch))
best_accuracy = val_acc
return net
def save(net, model_dir):
# model_dir will be empty except on primary container
files = os.listdir(model_dir)
if files:
best = sorted(os.listdir(model_dir))[-1]
os.rename(os.path.join(model_dir, best), os.path.join(model_dir, 'model.params'))
def get_data(path, augment, num_cpus, batch_size, data_shape, resize=-1, num_parts=1, part_index=0):
return mx.io.ImageRecordIter(
path_imgrec=path,
resize=resize,
data_shape=data_shape,
batch_size=batch_size,
rand_crop=augment,
rand_mirror=augment,
preprocess_threads=num_cpus,
num_parts=num_parts,
part_index=part_index)
def get_test_data(num_cpus, data_dir, batch_size, data_shape, resize=-1):
return get_data(os.path.join(data_dir, "test.rec"), False, num_cpus, batch_size, data_shape, resize, 1, 0)
def get_train_data(num_cpus, data_dir, batch_size, data_shape, resize=-1, num_parts=1, part_index=0):
return get_data(os.path.join(data_dir, "train.rec"), True, num_cpus, batch_size, data_shape, resize, num_parts,
part_index)
def test(ctx, net, test_data):
test_data.reset()
metric = mx.metric.Accuracy()
for i, batch in enumerate(test_data):
data = gluon.utils.split_and_load(batch.data[0], ctx_list=ctx, batch_axis=0)
label = gluon.utils.split_and_load(batch.label[0], ctx_list=ctx, batch_axis=0)
outputs = []
for x in data:
outputs.append(net(x))
metric.update(label, outputs)
return metric.get()
# ------------------------------------------------------------ #
# Hosting methods #
# ------------------------------------------------------------ #
def model_fn(model_dir):
"""
Load the gluon model. Called once when hosting service starts.
:param: model_dir The directory where model files are stored.
:return: a model (in this case a Gluon network)
"""
net = models.get_model('resnet34_v2', ctx=mx.cpu(), pretrained=False, classes=10)
net.load_params('%s/model.params' % model_dir, ctx=mx.cpu())
return net
def transform_fn(net, data, input_content_type, output_content_type):
"""
Transform a request using the Gluon model. Called once per request.
:param net: The Gluon model.
:param data: The request payload.
:param input_content_type: The request content type.
:param output_content_type: The (desired) response content type.
:return: response payload and content type.
"""
# we can use content types to vary input/output handling, but
# here we just assume json for both
parsed = json.loads(data)
nda = mx.nd.array(parsed)
output = net(nda)
prediction = mx.nd.argmax(output, axis=1)
response_body = json.dumps(prediction.asnumpy().tolist()[0])
return response_body, output_content_type
+32
View File
@@ -0,0 +1,32 @@
import numpy as np
import os
import zipfile
from skimage import io
from mxnet.test_utils import download
def download_training_data(fileName):
print('downloading training data...')
if not os.path.isdir("data"):
os.makedirs('data')
if (not os.path.exists('data/train.rec')) or \
(not os.path.exists('data/test.rec')) or \
(not os.path.exists('data/train.lst')) or \
(not os.path.exists('data/test.lst')):
zip_file_path = download('https://sagemaker-crops-corn.s3.amazonaws.com/' + str(fileName)) #'http://data.mxnet.io/mxnet/data/cifar10.zip')
with zipfile.ZipFile(zip_file_path) as zf:
zf.extractall()
os.rename('cifar', 'data')
print('done')
def read_image(filename):
img = io.imread(filename)
img = np.array(img).transpose(2, 0, 1)
img = np.expand_dims(img, axis=0)
return img
def read_images(filenames):
return [read_image(f) for f in filenames]
+32
View File
@@ -0,0 +1,32 @@
import numpy as np
import os
import zipfile
from skimage import io
from mxnet.test_utils import download
def download_training_data():
print('downloading training data...')
if not os.path.isdir("data"):
os.makedirs('data')
if (not os.path.exists('data/train.rec')) or \
(not os.path.exists('data/test.rec')) or \
(not os.path.exists('data/train.lst')) or \
(not os.path.exists('data/test.lst')):
zip_file_path = download('http://data.mxnet.io/mxnet/data/cifar10.zip')
with zipfile.ZipFile(zip_file_path) as zf:
zf.extractall()
os.rename('cifar', 'data')
print('done')
def read_image(filename):
img = io.imread(filename)
img = np.array(img).transpose(2, 0, 1)
img = np.expand_dims(img, axis=0)
return img
def read_images(filenames):
return [read_image(f) for f in filenames]
+10
View File
@@ -0,0 +1,10 @@
{
"default-runtime": "nvidia",
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
}
}
@@ -0,0 +1,941 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Gluon CIFAR-10 Trained in Local Mode\n",
"_**ResNet model in Gluon trained locally in a notebook instance**_\n",
"\n",
"---\n",
"\n",
"---\n",
"\n",
"_This notebook was created and tested on an ml.p3.8xlarge notebook instance._\n",
"\n",
"## Setup\n",
"\n",
"Import libraries and set IAM role ARN."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 770 ms, sys: 821 ms, total: 1.59 s\n",
"Wall time: 561 ms\n"
]
}
],
"source": [
"%%time\n",
"import sagemaker\n",
"import boto3\n",
"import pandas\n",
"import re\n",
"from sagemaker import get_execution_role\n",
"from sagemaker.amazon.amazon_estimator import get_image_uri\n",
"from sagemaker.mxnet import MXNet\n",
"\n",
"role = \"arn:aws:iam::437242975833:role/service-role/AmazonSageMaker-ExecutionRole-20180711T133970\"\n",
"sagemaker_session = sagemaker.Session()\n",
"# inputs = sagemaker_session.upload_data(path='data', key_prefix='data/DEMO-gluon-cifar10')\n",
"\n",
"\n",
"bucket='sagemaker-crops-corn' # customize to your bucket\n",
"\n",
"training_image = get_image_uri(boto3.Session().region_name, 'image-classification')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Install pre-requisites for local training."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The user has root access.\n",
"\n",
"WARNING: apt does not have a stable CLI interface. Use with caution in scripts.\n",
"\n",
"TEST1\n",
"nvidia-docker2 already installed. We are good to go!\n"
]
}
],
"source": [
"!/bin/bash setup.sh"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"## Data\n",
"\n",
"We use the helper scripts to download CIFAR-10 training data and sample images."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"downloading training data...\n",
"done\n"
]
}
],
"source": [
"from cifar10_utils import download_training_data\n",
"download_training_data()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We use the `sagemaker.Session.upload_data` function to upload our datasets to an S3 location. The return value `inputs` identifies the location -- we will use this later when we start the training job.\n",
"\n",
"Even though we are training within our notebook instance, we'll continue to use the S3 data location since it will allow us to easily transition to training in SageMaker's managed environment."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"input spec (in this case, just an S3 path): s3://sagemaker-us-east-1-437242975833/data/DEMO-gluon-cifar10\n"
]
}
],
"source": [
"inputs = sagemaker_session.upload_data(path='data', key_prefix='data/DEMO-gluon-cifar10')\n",
"print('input spec (in this case, just an S3 path): {}'.format(inputs))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"## Script\n",
"\n",
"We need to provide a training script that can run on the SageMaker platform. When SageMaker calls your function, it will pass in arguments that describe the training environment. Check the script below to see how this works.\n",
"\n",
"The network itself is a pre-built version contained in the [Gluon Model Zoo](https://mxnet.incubator.apache.org/versions/master/api/python/gluon/model_zoo.html)."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"from __future__ import print_function\n",
"\n",
"import json\n",
"import logging\n",
"import os\n",
"import time\n",
"\n",
"import mxnet as mx\n",
"from mxnet import autograd as ag\n",
"from mxnet import gluon\n",
"from mxnet.gluon.model_zoo import vision as models\n",
"\n",
"\n",
"# ------------------------------------------------------------ #\n",
"# Training methods #\n",
"# ------------------------------------------------------------ #\n",
"\n",
"def train(current_host, hosts, num_cpus, num_gpus, channel_input_dirs, model_dir, hyperparameters, **kwargs):\n",
" # retrieve the hyperparameters we set in notebook (with some defaults)\n",
" batch_size = hyperparameters.get('batch_size', 128)\n",
" epochs = hyperparameters.get('epochs', 100)\n",
" learning_rate = hyperparameters.get('learning_rate', 0.1)\n",
" momentum = hyperparameters.get('momentum', 0.9)\n",
" log_interval = hyperparameters.get('log_interval', 1)\n",
" wd = hyperparameters.get('wd', 0.0001)\n",
"\n",
" if len(hosts) == 1:\n",
" kvstore = 'device' if num_gpus > 0 else 'local'\n",
" else:\n",
" kvstore = 'dist_device_sync'\n",
"\n",
" ctx = [mx.gpu(i) for i in range(num_gpus)] if num_gpus > 0 else [mx.cpu()]\n",
" net = models.get_model('resnet34_v2', ctx=ctx, pretrained=False, classes=10)\n",
" batch_size *= max(1, len(ctx))\n",
"\n",
" # load training and validation data\n",
" # we use the gluon.data.vision.CIFAR10 class because of its built in pre-processing logic,\n",
" # but point it at the location where SageMaker placed the data files, so it doesn't download them again.\n",
"\n",
" part_index = 0\n",
" for i, host in enumerate(hosts):\n",
" if host == current_host:\n",
" part_index = i\n",
" break\n",
"\n",
"\n",
" data_dir = channel_input_dirs['training']\n",
" train_data = get_train_data(num_cpus, data_dir, batch_size, (3, 32, 32),\n",
" num_parts=len(hosts), part_index=part_index)\n",
" test_data = get_test_data(num_cpus, data_dir, batch_size, (3, 32, 32))\n",
"\n",
" # Collect all parameters from net and its children, then initialize them.\n",
" net.initialize(mx.init.Xavier(magnitude=2), ctx=ctx)\n",
" # Trainer is for updating parameters with gradient.\n",
" trainer = gluon.Trainer(net.collect_params(), 'sgd',\n",
" optimizer_params={'learning_rate': learning_rate, 'momentum': momentum, 'wd': wd},\n",
" kvstore=kvstore)\n",
" metric = mx.metric.Accuracy()\n",
" loss = gluon.loss.SoftmaxCrossEntropyLoss()\n",
"\n",
" best_accuracy = 0.0\n",
" for epoch in range(epochs):\n",
" # reset data iterator and metric at begining of epoch.\n",
" train_data.reset()\n",
" tic = time.time()\n",
" metric.reset()\n",
" btic = time.time()\n",
"\n",
" for i, batch in enumerate(train_data):\n",
" data = gluon.utils.split_and_load(batch.data[0], ctx_list=ctx, batch_axis=0)\n",
" label = gluon.utils.split_and_load(batch.label[0], ctx_list=ctx, batch_axis=0)\n",
" outputs = []\n",
" Ls = []\n",
" with ag.record():\n",
" for x, y in zip(data, label):\n",
" z = net(x)\n",
" L = loss(z, y)\n",
" # store the loss and do backward after we have done forward\n",
" # on all GPUs for better speed on multiple GPUs.\n",
" Ls.append(L)\n",
" outputs.append(z)\n",
" for L in Ls:\n",
" L.backward()\n",
" trainer.step(batch.data[0].shape[0])\n",
" metric.update(label, outputs)\n",
" if i % log_interval == 0 and i > 0:\n",
" name, acc = metric.get()\n",
" logging.info('Epoch [%d] Batch [%d]\\tSpeed: %f samples/sec\\t%s=%f' %\n",
" (epoch, i, batch_size / (time.time() - btic), name, acc))\n",
" btic = time.time()\n",
"\n",
" name, acc = metric.get()\n",
" logging.info('[Epoch %d] training: %s=%f' % (epoch, name, acc))\n",
" logging.info('[Epoch %d] time cost: %f' % (epoch, time.time() - tic))\n",
"\n",
" name, val_acc = test(ctx, net, test_data)\n",
" logging.info('[Epoch %d] validation: %s=%f' % (epoch, name, val_acc))\n",
"\n",
" # only save params on primary host\n",
" if current_host == hosts[0]:\n",
" if val_acc > best_accuracy:\n",
" net.save_params('{}/model-{:0>4}.params'.format(model_dir, epoch))\n",
" best_accuracy = val_acc\n",
"\n",
" return net\n",
"\n",
"\n",
"def save(net, model_dir):\n",
" # model_dir will be empty except on primary container\n",
" files = os.listdir(model_dir)\n",
" if files:\n",
" best = sorted(os.listdir(model_dir))[-1]\n",
" os.rename(os.path.join(model_dir, best), os.path.join(model_dir, 'model.params'))\n",
"\n",
"\n",
"def get_data(path, augment, num_cpus, batch_size, data_shape, resize=-1, num_parts=1, part_index=0):\n",
" return mx.io.ImageRecordIter(\n",
" path_imgrec=path,\n",
" resize=resize,\n",
" data_shape=data_shape,\n",
" batch_size=batch_size,\n",
" rand_crop=augment,\n",
" rand_mirror=augment,\n",
" preprocess_threads=num_cpus,\n",
" num_parts=num_parts,\n",
" part_index=part_index)\n",
"\n",
"\n",
"def get_test_data(num_cpus, data_dir, batch_size, data_shape, resize=-1):\n",
" return get_data(os.path.join(data_dir, \"test.rec\"), False, num_cpus, batch_size, data_shape, resize, 1, 0)\n",
"\n",
"\n",
"def get_train_data(num_cpus, data_dir, batch_size, data_shape, resize=-1, num_parts=1, part_index=0):\n",
" return get_data(os.path.join(data_dir, \"train.rec\"), True, num_cpus, batch_size, data_shape, resize, num_parts,\n",
" part_index)\n",
"\n",
"\n",
"def test(ctx, net, test_data):\n",
" test_data.reset()\n",
" metric = mx.metric.Accuracy()\n",
"\n",
" for i, batch in enumerate(test_data):\n",
" data = gluon.utils.split_and_load(batch.data[0], ctx_list=ctx, batch_axis=0)\n",
" label = gluon.utils.split_and_load(batch.label[0], ctx_list=ctx, batch_axis=0)\n",
" outputs = []\n",
" for x in data:\n",
" outputs.append(net(x))\n",
" metric.update(label, outputs)\n",
" return metric.get()\n",
"\n",
"\n",
"# ------------------------------------------------------------ #\n",
"# Hosting methods #\n",
"# ------------------------------------------------------------ #\n",
"\n",
"def model_fn(model_dir):\n",
" \"\"\"\n",
" Load the gluon model. Called once when hosting service starts.\n",
"\n",
" :param: model_dir The directory where model files are stored.\n",
" :return: a model (in this case a Gluon network)\n",
" \"\"\"\n",
"\n",
" net = models.get_model('resnet34_v2', ctx=mx.cpu(), pretrained=False, classes=10)\n",
" net.load_params('%s/model.params' % model_dir, ctx=mx.cpu())\n",
" return net\n",
"\n",
"\n",
"def transform_fn(net, data, input_content_type, output_content_type):\n",
" \"\"\"\n",
" Transform a request using the Gluon model. Called once per request.\n",
"\n",
" :param net: The Gluon model.\n",
" :param data: The request payload.\n",
" :param input_content_type: The request content type.\n",
" :param output_content_type: The (desired) response content type.\n",
" :return: response payload and content type.\n",
" \"\"\"\n",
" # we can use content types to vary input/output handling, but\n",
" # here we just assume json for both\n",
" parsed = json.loads(data)\n",
" nda = mx.nd.array(parsed)\n",
" output = net(nda)\n",
" prediction = mx.nd.argmax(output, axis=1)\n",
" response_body = json.dumps(prediction.asnumpy().tolist()[0])\n",
" return response_body, output_content_type\n"
]
}
],
"source": [
"!cat 'cifar10.py'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"## Train (Local Mode)\n",
"\n",
"The ```MXNet``` estimator will create our training job. To switch from training in SageMaker's managed environment to training within a notebook instance, just set `train_instance_type` to `local_gpu`."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"m = MXNet('cifar10.py',\n",
" role=role, \n",
" train_instance_count=1,\n",
" train_instance_type='local_gpu',\n",
" framework_version='1.1.0',\n",
" hyperparameters={'batch_size': 1024,\n",
" 'epochs': 5,\n",
" 'learning_rate': 0.8,\n",
" 'momentum': 0.9},\n",
" py_version = \"py3\")\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"After we've constructed our `MXNet` object, we can fit it using the data we uploaded to S3. SageMaker makes sure our data is available in the local filesystem, so our training script can simply read the data from disk."
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Creating tmpqioifl1x_algo-1-67dsm_1 ... \n",
"\u001b[1BAttaching to tmpqioifl1x_algo-1-67dsm_12mdone\u001b[0m\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:30,378 INFO - root - running container entrypoint\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:30,379 INFO - root - starting train task\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:30,400 INFO - container_support.training - Training starting\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:30,758 INFO - mxnet_container.train - MXNetTrainingEnvironment: {'channels': {'training': {'TrainingInputMode': 'File'}}, '_ps_port': 8000, 'channel_dirs': {'training': '/opt/ml/input/data/training'}, 'current_host': 'algo-1-67dsm', 'resource_config': {'hosts': ['algo-1-67dsm'], 'current_host': 'algo-1-67dsm'}, '_scheduler_host': 'algo-1-67dsm', 'hyperparameters': {'batch_size': 1024, 'epochs': 5, 'momentum': 0.9, 'sagemaker_submit_directory': 's3://sagemaker-us-east-1-437242975833/sagemaker-mxnet-2019-07-15-20-32-44-985/source/sourcedir.tar.gz', 'sagemaker_job_name': 'sagemaker-mxnet-2019-07-15-20-32-44-985', 'sagemaker_program': 'cifar10.py', 'sagemaker_container_log_level': 20, 'sagemaker_region': 'us-east-1', 'learning_rate': 0.8, 'sagemaker_enable_cloudwatch_metrics': False}, 'sagemaker_region': 'us-east-1', '_ps_verbose': 0, 'user_requirements_file': None, 'user_script_name': 'cifar10.py', 'hosts': ['algo-1-67dsm'], 'code_dir': '/opt/ml/code', 'enable_cloudwatch_metrics': False, 'output_dir': '/opt/ml/output', 'base_dir': '/opt/ml', 'model_dir': '/opt/ml/model', 'input_config_dir': '/opt/ml/input/config', 'output_data_dir': '/opt/ml/output/data/', 'input_dir': '/opt/ml/input', 'container_log_level': 20, 'job_name': 'sagemaker-mxnet-2019-07-15-20-32-44-985', '_scheduler_ip': '172.18.0.2', 'available_gpus': 1, 'user_script_archive': 's3://sagemaker-us-east-1-437242975833/sagemaker-mxnet-2019-07-15-20-32-44-985/source/sourcedir.tar.gz', 'available_cpus': 16}\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m Downloading s3://sagemaker-us-east-1-437242975833/sagemaker-mxnet-2019-07-15-20-32-44-985/source/sourcedir.tar.gz to /tmp/script.tar.gz\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:30,772 INFO - botocore.credentials - Found credentials in environment variables.\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:31,273 INFO - mxnet_container.train - Starting distributed training task\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m /usr/local/lib/python3.5/dist-packages/mxnet_container/train.py:178: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m train_args = inspect.getargspec(user_module.train)\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m [20:35:31] src/io/iter_image_recordio_2.cc:170: ImageRecordIOParser2: /opt/ml/input/data/training/train.rec, use 7 threads for decoding..\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m [20:35:32] src/io/iter_image_recordio_2.cc:170: ImageRecordIOParser2: /opt/ml/input/data/training/test.rec, use 7 threads for decoding..\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m [20:35:36] src/operator/nn/./cudnn/./cudnn_algoreg-inl.h:107: Running performance tests to find the best convolution algorithm, this can take a while... (setting env variable MXNET_CUDNN_AUTOTUNE_DEFAULT to 0 to disable)\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:38,855 INFO - root - Epoch [0] Batch [1]\tSpeed: 6816.759191 samples/sec\taccuracy=0.116211\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:39,004 INFO - root - Epoch [0] Batch [2]\tSpeed: 6888.700994 samples/sec\taccuracy=0.110026\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:39,153 INFO - root - Epoch [0] Batch [3]\tSpeed: 6903.161006 samples/sec\taccuracy=0.108887\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:39,300 INFO - root - Epoch [0] Batch [4]\tSpeed: 6958.556653 samples/sec\taccuracy=0.113281\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:39,449 INFO - root - Epoch [0] Batch [5]\tSpeed: 6872.244555 samples/sec\taccuracy=0.111816\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:39,597 INFO - root - Epoch [0] Batch [6]\tSpeed: 6941.922250 samples/sec\taccuracy=0.110770\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:39,749 INFO - root - Epoch [0] Batch [7]\tSpeed: 6736.125821 samples/sec\taccuracy=0.108765\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:39,896 INFO - root - Epoch [0] Batch [8]\tSpeed: 6989.061988 samples/sec\taccuracy=0.108073\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:40,047 INFO - root - Epoch [0] Batch [9]\tSpeed: 6813.417690 samples/sec\taccuracy=0.107813\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:40,193 INFO - root - Epoch [0] Batch [10]\tSpeed: 6990.722851 samples/sec\taccuracy=0.106179\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:40,360 INFO - root - Epoch [0] Batch [11]\tSpeed: 6157.085427 samples/sec\taccuracy=0.106120\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:40,530 INFO - root - Epoch [0] Batch [12]\tSpeed: 6011.537896 samples/sec\taccuracy=0.107046\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:40,684 INFO - root - Epoch [0] Batch [13]\tSpeed: 6662.717038 samples/sec\taccuracy=0.107003\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:40,831 INFO - root - Epoch [0] Batch [14]\tSpeed: 6970.776555 samples/sec\taccuracy=0.106445\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:40,980 INFO - root - Epoch [0] Batch [15]\tSpeed: 6891.840281 samples/sec\taccuracy=0.107422\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:41,134 INFO - root - Epoch [0] Batch [16]\tSpeed: 6658.162079 samples/sec\taccuracy=0.107709\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:41,305 INFO - root - Epoch [0] Batch [17]\tSpeed: 5984.490779 samples/sec\taccuracy=0.107856\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:41,465 INFO - root - Epoch [0] Batch [18]\tSpeed: 6435.738469 samples/sec\taccuracy=0.107679\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:41,614 INFO - root - Epoch [0] Batch [19]\tSpeed: 6889.043524 samples/sec\taccuracy=0.108203\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:41,761 INFO - root - Epoch [0] Batch [20]\tSpeed: 6982.676159 samples/sec\taccuracy=0.109515\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:41,914 INFO - root - Epoch [0] Batch [21]\tSpeed: 6679.368132 samples/sec\taccuracy=0.108842\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:42,081 INFO - root - Epoch [0] Batch [22]\tSpeed: 6152.578367 samples/sec\taccuracy=0.108993\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:42,243 INFO - root - Epoch [0] Batch [23]\tSpeed: 6326.324924 samples/sec\taccuracy=0.108561\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:42,390 INFO - root - Epoch [0] Batch [24]\tSpeed: 6939.903206 samples/sec\taccuracy=0.108320\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:42,548 INFO - root - Epoch [0] Batch [25]\tSpeed: 6517.292270 samples/sec\taccuracy=0.108661\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:42,717 INFO - root - Epoch [0] Batch [26]\tSpeed: 6066.723586 samples/sec\taccuracy=0.109122\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:42,870 INFO - root - Epoch [0] Batch [27]\tSpeed: 6682.849757 samples/sec\taccuracy=0.109584\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:43,017 INFO - root - Epoch [0] Batch [28]\tSpeed: 6964.119184 samples/sec\taccuracy=0.109510\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:43,171 INFO - root - Epoch [0] Batch [29]\tSpeed: 6653.953510 samples/sec\taccuracy=0.109798\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:43,342 INFO - root - Epoch [0] Batch [30]\tSpeed: 6008.997890 samples/sec\taccuracy=0.109848\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:43,494 INFO - root - Epoch [0] Batch [31]\tSpeed: 6763.174190 samples/sec\taccuracy=0.110229\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:43,644 INFO - root - Epoch [0] Batch [32]\tSpeed: 6846.260504 samples/sec\taccuracy=0.110322\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:43,812 INFO - root - Epoch [0] Batch [33]\tSpeed: 6071.903901 samples/sec\taccuracy=0.110237\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:43,963 INFO - root - Epoch [0] Batch [34]\tSpeed: 6819.118598 samples/sec\taccuracy=0.110184\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:44,112 INFO - root - Epoch [0] Batch [35]\tSpeed: 6850.049436 samples/sec\taccuracy=0.110379\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:44,273 INFO - root - Epoch [0] Batch [36]\tSpeed: 6403.641674 samples/sec\taccuracy=0.110536\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:44,438 INFO - root - Epoch [0] Batch [37]\tSpeed: 6208.080389 samples/sec\taccuracy=0.111045\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:44,585 INFO - root - Epoch [0] Batch [38]\tSpeed: 6977.333316 samples/sec\taccuracy=0.111203\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:44,743 INFO - root - Epoch [0] Batch [39]\tSpeed: 6468.197605 samples/sec\taccuracy=0.112134\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:44,911 INFO - root - Epoch [0] Batch [40]\tSpeed: 6117.638013 samples/sec\taccuracy=0.112686\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:45,060 INFO - root - Epoch [0] Batch [41]\tSpeed: 6878.484986 samples/sec\taccuracy=0.113351\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:45,220 INFO - root - Epoch [0] Batch [42]\tSpeed: 6392.490435 samples/sec\taccuracy=0.113281\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:45,381 INFO - root - Epoch [0] Batch [43]\tSpeed: 6384.726631 samples/sec\taccuracy=0.113503\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:45,529 INFO - root - Epoch [0] Batch [44]\tSpeed: 6904.692487 samples/sec\taccuracy=0.114084\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:45,697 INFO - root - Epoch [0] Batch [45]\tSpeed: 6112.257619 samples/sec\taccuracy=0.114215\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:45,850 INFO - root - Epoch [0] Batch [46]\tSpeed: 6691.554082 samples/sec\taccuracy=0.114133\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:46,016 INFO - root - Epoch [0] Batch [47]\tSpeed: 6179.764600 samples/sec\taccuracy=0.114807\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:46,178 INFO - root - Epoch [0] Batch [48]\tSpeed: 6322.553206 samples/sec\taccuracy=0.115573\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:46,179 INFO - root - [Epoch 0] training: accuracy=0.115573\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:46,179 INFO - root - [Epoch 0] time cost: 13.321810\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:46,812 INFO - root - [Epoch 0] validation: accuracy=0.124414\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:47,114 INFO - root - Epoch [1] Batch [1]\tSpeed: 6882.177342 samples/sec\taccuracy=0.150879\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:47,276 INFO - root - Epoch [1] Batch [2]\tSpeed: 6314.856119 samples/sec\taccuracy=0.156901\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:47,434 INFO - root - Epoch [1] Batch [3]\tSpeed: 6500.375793 samples/sec\taccuracy=0.158447\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:47,580 INFO - root - Epoch [1] Batch [4]\tSpeed: 7019.572082 samples/sec\taccuracy=0.161719\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:47,729 INFO - root - Epoch [1] Batch [5]\tSpeed: 6880.810157 samples/sec\taccuracy=0.163249\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:47,877 INFO - root - Epoch [1] Batch [6]\tSpeed: 6923.056446 samples/sec\taccuracy=0.166713\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:48,043 INFO - root - Epoch [1] Batch [7]\tSpeed: 6184.293784 samples/sec\taccuracy=0.169189\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:48,213 INFO - root - Epoch [1] Batch [8]\tSpeed: 6033.164108 samples/sec\taccuracy=0.172092\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:48,366 INFO - root - Epoch [1] Batch [9]\tSpeed: 6664.029939 samples/sec\taccuracy=0.171094\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:48,524 INFO - root - Epoch [1] Batch [10]\tSpeed: 6495.519337 samples/sec\taccuracy=0.172940\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:48,689 INFO - root - Epoch [1] Batch [11]\tSpeed: 6236.602523 samples/sec\taccuracy=0.174154\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:48,838 INFO - root - Epoch [1] Batch [12]\tSpeed: 6892.802537 samples/sec\taccuracy=0.174880\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:49,008 INFO - root - Epoch [1] Batch [13]\tSpeed: 6032.130357 samples/sec\taccuracy=0.176618\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:49,158 INFO - root - Epoch [1] Batch [14]\tSpeed: 6826.130684 samples/sec\taccuracy=0.177148\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:49,325 INFO - root - Epoch [1] Batch [15]\tSpeed: 6137.464966 samples/sec\taccuracy=0.177856\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:49,479 INFO - root - Epoch [1] Batch [16]\tSpeed: 6642.972387 samples/sec\taccuracy=0.178711\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:49,634 INFO - root - Epoch [1] Batch [17]\tSpeed: 6634.147967 samples/sec\taccuracy=0.180664\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:49,801 INFO - root - Epoch [1] Batch [18]\tSpeed: 6118.082449 samples/sec\taccuracy=0.181846\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:49,954 INFO - root - Epoch [1] Batch [19]\tSpeed: 6703.041746 samples/sec\taccuracy=0.183350\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:50,123 INFO - root - Epoch [1] Batch [20]\tSpeed: 6065.823936 samples/sec\taccuracy=0.184198\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:50,276 INFO - root - Epoch [1] Batch [21]\tSpeed: 6729.466035 samples/sec\taccuracy=0.184970\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:50,443 INFO - root - Epoch [1] Batch [22]\tSpeed: 6114.624522 samples/sec\taccuracy=0.185717\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:50,597 INFO - root - Epoch [1] Batch [23]\tSpeed: 6658.905320 samples/sec\taccuracy=0.186320\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:50,759 INFO - root - Epoch [1] Batch [24]\tSpeed: 6340.258655 samples/sec\taccuracy=0.187578\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:50,919 INFO - root - Epoch [1] Batch [25]\tSpeed: 6406.220564 samples/sec\taccuracy=0.189115\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:51,076 INFO - root - Epoch [1] Batch [26]\tSpeed: 6530.223680 samples/sec\taccuracy=0.190683\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:51,238 INFO - root - Epoch [1] Batch [27]\tSpeed: 6330.166451 samples/sec\taccuracy=0.192034\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:51,385 INFO - root - Epoch [1] Batch [28]\tSpeed: 6995.516477 samples/sec\taccuracy=0.193090\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:51,533 INFO - root - Epoch [1] Batch [29]\tSpeed: 6910.191437 samples/sec\taccuracy=0.194173\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:51,679 INFO - root - Epoch [1] Batch [30]\tSpeed: 7015.994459 samples/sec\taccuracy=0.194777\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:51,829 INFO - root - Epoch [1] Batch [31]\tSpeed: 6869.232953 samples/sec\taccuracy=0.195160\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:51,977 INFO - root - Epoch [1] Batch [32]\tSpeed: 6899.412856 samples/sec\taccuracy=0.195283\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:52,126 INFO - root - Epoch [1] Batch [33]\tSpeed: 6899.257695 samples/sec\taccuracy=0.195628\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:52,272 INFO - root - Epoch [1] Batch [34]\tSpeed: 6999.232924 samples/sec\taccuracy=0.196317\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:52,421 INFO - root - Epoch [1] Batch [35]\tSpeed: 6905.824888 samples/sec\taccuracy=0.196832\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:52,567 INFO - root - Epoch [1] Batch [36]\tSpeed: 7032.963145 samples/sec\taccuracy=0.197239\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:52,715 INFO - root - Epoch [1] Batch [37]\tSpeed: 6911.470225 samples/sec\taccuracy=0.198114\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:52,859 INFO - root - Epoch [1] Batch [38]\tSpeed: 7127.700989 samples/sec\taccuracy=0.199269\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:53,008 INFO - root - Epoch [1] Batch [39]\tSpeed: 6869.540587 samples/sec\taccuracy=0.199878\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:53,155 INFO - root - Epoch [1] Batch [40]\tSpeed: 6999.803280 samples/sec\taccuracy=0.200529\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:53,304 INFO - root - Epoch [1] Batch [41]\tSpeed: 6847.024504 samples/sec\taccuracy=0.201195\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:53,452 INFO - root - Epoch [1] Batch [42]\tSpeed: 6934.771152 samples/sec\taccuracy=0.202171\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:53,601 INFO - root - Epoch [1] Batch [43]\tSpeed: 6868.595799 samples/sec\taccuracy=0.202548\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:53,749 INFO - root - Epoch [1] Batch [44]\tSpeed: 6955.457681 samples/sec\taccuracy=0.203038\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:53,899 INFO - root - Epoch [1] Batch [45]\tSpeed: 6837.606479 samples/sec\taccuracy=0.203252\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:54,045 INFO - root - Epoch [1] Batch [46]\tSpeed: 7000.259633 samples/sec\taccuracy=0.203748\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:54,194 INFO - root - Epoch [1] Batch [47]\tSpeed: 6876.557718 samples/sec\taccuracy=0.204041\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:54,342 INFO - root - Epoch [1] Batch [48]\tSpeed: 6950.313852 samples/sec\taccuracy=0.204799\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:54,342 INFO - root - [Epoch 1] training: accuracy=0.204799\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:54,342 INFO - root - [Epoch 1] time cost: 7.428253\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:54,930 INFO - root - [Epoch 1] validation: accuracy=0.230566\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:55,226 INFO - root - Epoch [2] Batch [1]\tSpeed: 6803.703803 samples/sec\taccuracy=0.233398\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:55,374 INFO - root - Epoch [2] Batch [2]\tSpeed: 6922.264228 samples/sec\taccuracy=0.228841\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:55,523 INFO - root - Epoch [2] Batch [3]\tSpeed: 6895.757345 samples/sec\taccuracy=0.230225\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:55,671 INFO - root - Epoch [2] Batch [4]\tSpeed: 6904.337301 samples/sec\taccuracy=0.225781\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:55,822 INFO - root - Epoch [2] Batch [5]\tSpeed: 6814.779848 samples/sec\taccuracy=0.223145\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:55,974 INFO - root - Epoch [2] Batch [6]\tSpeed: 6739.751492 samples/sec\taccuracy=0.220006\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:56,143 INFO - root - Epoch [2] Batch [7]\tSpeed: 6062.527502 samples/sec\taccuracy=0.221436\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:56,295 INFO - root - Epoch [2] Batch [8]\tSpeed: 6725.830354 samples/sec\taccuracy=0.220595\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:56,463 INFO - root - Epoch [2] Batch [9]\tSpeed: 6124.608273 samples/sec\taccuracy=0.220215\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:56,629 INFO - root - Epoch [2] Batch [10]\tSpeed: 6167.288133 samples/sec\taccuracy=0.220437\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:56,790 INFO - root - Epoch [2] Batch [11]\tSpeed: 6366.073972 samples/sec\taccuracy=0.220866\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:56,954 INFO - root - Epoch [2] Batch [12]\tSpeed: 6241.986429 samples/sec\taccuracy=0.221529\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:57,111 INFO - root - Epoch [2] Batch [13]\tSpeed: 6540.745264 samples/sec\taccuracy=0.221680\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:57,278 INFO - root - Epoch [2] Batch [14]\tSpeed: 6132.636291 samples/sec\taccuracy=0.221419\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:57,430 INFO - root - Epoch [2] Batch [15]\tSpeed: 6750.153307 samples/sec\taccuracy=0.222534\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:57,600 INFO - root - Epoch [2] Batch [16]\tSpeed: 6034.198213 samples/sec\taccuracy=0.223288\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:57,752 INFO - root - Epoch [2] Batch [17]\tSpeed: 6727.758357 samples/sec\taccuracy=0.222819\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:57,915 INFO - root - Epoch [2] Batch [18]\tSpeed: 6312.016284 samples/sec\taccuracy=0.223890\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:58,077 INFO - root - Epoch [2] Batch [19]\tSpeed: 6316.081935 samples/sec\taccuracy=0.224463\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:58,226 INFO - root - Epoch [2] Batch [20]\tSpeed: 6911.870638 samples/sec\taccuracy=0.225121\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:58,391 INFO - root - Epoch [2] Batch [21]\tSpeed: 6189.953458 samples/sec\taccuracy=0.225009\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:58,551 INFO - root - Epoch [2] Batch [22]\tSpeed: 6434.186232 samples/sec\taccuracy=0.225119\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:58,700 INFO - root - Epoch [2] Batch [23]\tSpeed: 6849.776318 samples/sec\taccuracy=0.225708\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:58,848 INFO - root - Epoch [2] Batch [24]\tSpeed: 6939.634089 samples/sec\taccuracy=0.226680\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:59,005 INFO - root - Epoch [2] Batch [25]\tSpeed: 6545.609754 samples/sec\taccuracy=0.226788\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:59,173 INFO - root - Epoch [2] Batch [26]\tSpeed: 6102.478799 samples/sec\taccuracy=0.226382\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:59,323 INFO - root - Epoch [2] Batch [27]\tSpeed: 6838.314109 samples/sec\taccuracy=0.227434\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:59,493 INFO - root - Epoch [2] Batch [28]\tSpeed: 6026.738571 samples/sec\taccuracy=0.228044\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:59,650 INFO - root - Epoch [2] Batch [29]\tSpeed: 6535.679139 samples/sec\taccuracy=0.229004\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:59,813 INFO - root - Epoch [2] Batch [30]\tSpeed: 6295.335254 samples/sec\taccuracy=0.230280\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:35:59,975 INFO - root - Epoch [2] Batch [31]\tSpeed: 6292.153421 samples/sec\taccuracy=0.231689\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:00,123 INFO - root - Epoch [2] Batch [32]\tSpeed: 6935.364648 samples/sec\taccuracy=0.231534\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:00,273 INFO - root - Epoch [2] Batch [33]\tSpeed: 6845.343929 samples/sec\taccuracy=0.231934\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:00,419 INFO - root - Epoch [2] Batch [34]\tSpeed: 7012.569324 samples/sec\taccuracy=0.231334\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:00,569 INFO - root - Epoch [2] Batch [35]\tSpeed: 6856.577968 samples/sec\taccuracy=0.231093\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:00,716 INFO - root - Epoch [2] Batch [36]\tSpeed: 6958.737042 samples/sec\taccuracy=0.231709\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:00,865 INFO - root - Epoch [2] Batch [37]\tSpeed: 6906.968768 samples/sec\taccuracy=0.232268\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:01,012 INFO - root - Epoch [2] Batch [38]\tSpeed: 6951.675044 samples/sec\taccuracy=0.233223\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:01,165 INFO - root - Epoch [2] Batch [39]\tSpeed: 6716.931638 samples/sec\taccuracy=0.233862\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:01,331 INFO - root - Epoch [2] Batch [40]\tSpeed: 6169.050944 samples/sec\taccuracy=0.234018\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:01,487 INFO - root - Epoch [2] Batch [41]\tSpeed: 6563.615282 samples/sec\taccuracy=0.234724\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:01,657 INFO - root - Epoch [2] Batch [42]\tSpeed: 6026.341129 samples/sec\taccuracy=0.234988\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:01,814 INFO - root - Epoch [2] Batch [43]\tSpeed: 6554.630162 samples/sec\taccuracy=0.235463\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:01,983 INFO - root - Epoch [2] Batch [44]\tSpeed: 6061.338241 samples/sec\taccuracy=0.236263\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:02,139 INFO - root - Epoch [2] Batch [45]\tSpeed: 6571.629464 samples/sec\taccuracy=0.236880\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:02,306 INFO - root - Epoch [2] Batch [46]\tSpeed: 6115.747702 samples/sec\taccuracy=0.237471\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:02,463 INFO - root - Epoch [2] Batch [47]\tSpeed: 6566.204194 samples/sec\taccuracy=0.238363\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:02,631 INFO - root - Epoch [2] Batch [48]\tSpeed: 6091.201793 samples/sec\taccuracy=0.238799\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:02,631 INFO - root - [Epoch 2] training: accuracy=0.238799\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:02,631 INFO - root - [Epoch 2] time cost: 7.610042\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:03,248 INFO - root - [Epoch 2] validation: accuracy=0.208105\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:03,449 INFO - root - Epoch [3] Batch [1]\tSpeed: 6872.365513 samples/sec\taccuracy=0.253418\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:03,599 INFO - root - Epoch [3] Batch [2]\tSpeed: 6815.688256 samples/sec\taccuracy=0.251302\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:03,765 INFO - root - Epoch [3] Batch [3]\tSpeed: 6191.970267 samples/sec\taccuracy=0.249756\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:03,929 INFO - root - Epoch [3] Batch [4]\tSpeed: 6272.085424 samples/sec\taccuracy=0.251563\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:04,076 INFO - root - Epoch [3] Batch [5]\tSpeed: 6948.312406 samples/sec\taccuracy=0.252441\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:04,234 INFO - root - Epoch [3] Batch [6]\tSpeed: 6501.733752 samples/sec\taccuracy=0.254325\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:04,403 INFO - root - Epoch [3] Batch [7]\tSpeed: 6074.720760 samples/sec\taccuracy=0.255615\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:04,561 INFO - root - Epoch [3] Batch [8]\tSpeed: 6458.374065 samples/sec\taccuracy=0.254883\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:04,728 INFO - root - Epoch [3] Batch [9]\tSpeed: 6150.305292 samples/sec\taccuracy=0.255957\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:04,883 INFO - root - Epoch [3] Batch [10]\tSpeed: 6610.876238 samples/sec\taccuracy=0.257013\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:05,052 INFO - root - Epoch [3] Batch [11]\tSpeed: 6067.786373 samples/sec\taccuracy=0.259766\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:05,206 INFO - root - Epoch [3] Batch [12]\tSpeed: 6679.690160 samples/sec\taccuracy=0.261418\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:05,374 INFO - root - Epoch [3] Batch [13]\tSpeed: 6085.876403 samples/sec\taccuracy=0.261719\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:05,524 INFO - root - Epoch [3] Batch [14]\tSpeed: 6844.100398 samples/sec\taccuracy=0.263477\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:05,672 INFO - root - Epoch [3] Batch [15]\tSpeed: 6942.359864 samples/sec\taccuracy=0.266113\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:05,820 INFO - root - Epoch [3] Batch [16]\tSpeed: 6892.514938 samples/sec\taccuracy=0.265970\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:05,967 INFO - root - Epoch [3] Batch [17]\tSpeed: 7005.969059 samples/sec\taccuracy=0.267036\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:06,117 INFO - root - Epoch [3] Batch [18]\tSpeed: 6848.203582 samples/sec\taccuracy=0.269583\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:06,264 INFO - root - Epoch [3] Batch [19]\tSpeed: 6974.308200 samples/sec\taccuracy=0.270215\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:06,412 INFO - root - Epoch [3] Batch [20]\tSpeed: 6919.409286 samples/sec\taccuracy=0.270415\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:06,559 INFO - root - Epoch [3] Batch [21]\tSpeed: 6965.711726 samples/sec\taccuracy=0.269886\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:06,708 INFO - root - Epoch [3] Batch [22]\tSpeed: 6857.596096 samples/sec\taccuracy=0.269361\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:06,855 INFO - root - Epoch [3] Batch [23]\tSpeed: 7015.925694 samples/sec\taccuracy=0.268148\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:07,004 INFO - root - Epoch [3] Batch [24]\tSpeed: 6880.479468 samples/sec\taccuracy=0.266797\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:07,151 INFO - root - Epoch [3] Batch [25]\tSpeed: 6966.400924 samples/sec\taccuracy=0.266376\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:07,299 INFO - root - Epoch [3] Batch [26]\tSpeed: 6901.852018 samples/sec\taccuracy=0.266927\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:07,446 INFO - root - Epoch [3] Batch [27]\tSpeed: 6988.277333 samples/sec\taccuracy=0.268136\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:07,596 INFO - root - Epoch [3] Batch [28]\tSpeed: 6845.638516 samples/sec\taccuracy=0.268925\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:07,742 INFO - root - Epoch [3] Batch [29]\tSpeed: 7022.292139 samples/sec\taccuracy=0.269108\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:07,891 INFO - root - Epoch [3] Batch [30]\tSpeed: 6887.287039 samples/sec\taccuracy=0.269626\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:08,038 INFO - root - Epoch [3] Batch [31]\tSpeed: 6945.301166 samples/sec\taccuracy=0.269897\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:08,188 INFO - root - Epoch [3] Batch [32]\tSpeed: 6851.207698 samples/sec\taccuracy=0.269709\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:08,334 INFO - root - Epoch [3] Batch [33]\tSpeed: 7008.141084 samples/sec\taccuracy=0.269503\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:08,484 INFO - root - Epoch [3] Batch [34]\tSpeed: 6857.563249 samples/sec\taccuracy=0.268722\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:08,631 INFO - root - Epoch [3] Batch [35]\tSpeed: 6967.644085 samples/sec\taccuracy=0.267849\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:08,780 INFO - root - Epoch [3] Batch [36]\tSpeed: 6902.595196 samples/sec\taccuracy=0.268185\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:08,926 INFO - root - Epoch [3] Batch [37]\tSpeed: 6975.101048 samples/sec\taccuracy=0.268940\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:09,076 INFO - root - Epoch [3] Batch [38]\tSpeed: 6867.288905 samples/sec\taccuracy=0.269907\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:09,222 INFO - root - Epoch [3] Batch [39]\tSpeed: 7019.973646 samples/sec\taccuracy=0.269751\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:09,371 INFO - root - Epoch [3] Batch [40]\tSpeed: 6883.567135 samples/sec\taccuracy=0.270079\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:09,518 INFO - root - Epoch [3] Batch [41]\tSpeed: 6950.955009 samples/sec\taccuracy=0.270647\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:09,669 INFO - root - Epoch [3] Batch [42]\tSpeed: 6794.952706 samples/sec\taccuracy=0.270962\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:09,816 INFO - root - Epoch [3] Batch [43]\tSpeed: 6998.491599 samples/sec\taccuracy=0.271063\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:09,965 INFO - root - Epoch [3] Batch [44]\tSpeed: 6845.005731 samples/sec\taccuracy=0.271788\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:10,121 INFO - root - Epoch [3] Batch [45]\tSpeed: 6583.152666 samples/sec\taccuracy=0.272100\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:10,284 INFO - root - Epoch [3] Batch [46]\tSpeed: 6279.632629 samples/sec\taccuracy=0.272461\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:10,438 INFO - root - Epoch [3] Batch [47]\tSpeed: 6677.114805 samples/sec\taccuracy=0.272888\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:10,604 INFO - root - Epoch [3] Batch [48]\tSpeed: 6166.287588 samples/sec\taccuracy=0.273358\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:10,605 INFO - root - [Epoch 3] training: accuracy=0.273358\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:10,605 INFO - root - [Epoch 3] time cost: 7.356472\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:11,189 INFO - root - [Epoch 3] validation: accuracy=0.284071\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:11,488 INFO - root - Epoch [4] Batch [1]\tSpeed: 6845.780363 samples/sec\taccuracy=0.288086\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:11,643 INFO - root - Epoch [4] Batch [2]\tSpeed: 6612.738890 samples/sec\taccuracy=0.291667\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:11,808 INFO - root - Epoch [4] Batch [3]\tSpeed: 6217.651745 samples/sec\taccuracy=0.290039\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:11,962 INFO - root - Epoch [4] Batch [4]\tSpeed: 6661.921279 samples/sec\taccuracy=0.285938\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:12,129 INFO - root - Epoch [4] Batch [5]\tSpeed: 6149.873774 samples/sec\taccuracy=0.290690\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:12,277 INFO - root - Epoch [4] Batch [6]\tSpeed: 6938.243983 samples/sec\taccuracy=0.290318\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:12,428 INFO - root - Epoch [4] Batch [7]\tSpeed: 6786.170479 samples/sec\taccuracy=0.288940\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:12,576 INFO - root - Epoch [4] Batch [8]\tSpeed: 6905.891512 samples/sec\taccuracy=0.289931\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:12,725 INFO - root - Epoch [4] Batch [9]\tSpeed: 6897.728624 samples/sec\taccuracy=0.291309\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:12,875 INFO - root - Epoch [4] Batch [10]\tSpeed: 6836.561631 samples/sec\taccuracy=0.291016\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:13,039 INFO - root - Epoch [4] Batch [11]\tSpeed: 6236.774592 samples/sec\taccuracy=0.291260\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:13,194 INFO - root - Epoch [4] Batch [12]\tSpeed: 6625.163002 samples/sec\taccuracy=0.291466\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:13,357 INFO - root - Epoch [4] Batch [13]\tSpeed: 6290.089257 samples/sec\taccuracy=0.290667\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:13,515 INFO - root - Epoch [4] Batch [14]\tSpeed: 6471.179746 samples/sec\taccuracy=0.291016\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:13,682 INFO - root - Epoch [4] Batch [15]\tSpeed: 6155.885252 samples/sec\taccuracy=0.292847\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:13,838 INFO - root - Epoch [4] Batch [16]\tSpeed: 6582.214393 samples/sec\taccuracy=0.292624\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:14,003 INFO - root - Epoch [4] Batch [17]\tSpeed: 6199.925364 samples/sec\taccuracy=0.292480\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:14,160 INFO - root - Epoch [4] Batch [18]\tSpeed: 6548.184479 samples/sec\taccuracy=0.293431\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:14,327 INFO - root - Epoch [4] Batch [19]\tSpeed: 6139.324849 samples/sec\taccuracy=0.294385\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:14,487 INFO - root - Epoch [4] Batch [20]\tSpeed: 6409.681448 samples/sec\taccuracy=0.294829\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:14,649 INFO - root - Epoch [4] Batch [21]\tSpeed: 6330.530333 samples/sec\taccuracy=0.294522\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:14,808 INFO - root - Epoch [4] Batch [22]\tSpeed: 6441.752014 samples/sec\taccuracy=0.294243\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:14,970 INFO - root - Epoch [4] Batch [23]\tSpeed: 6318.098136 samples/sec\taccuracy=0.294881\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:15,131 INFO - root - Epoch [4] Batch [24]\tSpeed: 6373.395207 samples/sec\taccuracy=0.294609\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:15,294 INFO - root - Epoch [4] Batch [25]\tSpeed: 6304.030201 samples/sec\taccuracy=0.294922\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:15,457 INFO - root - Epoch [4] Batch [26]\tSpeed: 6281.350019 samples/sec\taccuracy=0.295103\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:15,620 INFO - root - Epoch [4] Batch [27]\tSpeed: 6286.010989 samples/sec\taccuracy=0.296526\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:15,784 INFO - root - Epoch [4] Batch [28]\tSpeed: 6231.363505 samples/sec\taccuracy=0.297178\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:15,943 INFO - root - Epoch [4] Batch [29]\tSpeed: 6458.917955 samples/sec\taccuracy=0.296484\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:16,111 INFO - root - Epoch [4] Batch [30]\tSpeed: 6120.619585 samples/sec\taccuracy=0.297127\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:16,268 INFO - root - Epoch [4] Batch [31]\tSpeed: 6534.297023 samples/sec\taccuracy=0.297943\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:16,434 INFO - root - Epoch [4] Batch [32]\tSpeed: 6175.037843 samples/sec\taccuracy=0.297230\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:16,594 INFO - root - Epoch [4] Batch [33]\tSpeed: 6416.298113 samples/sec\taccuracy=0.297248\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:16,760 INFO - root - Epoch [4] Batch [34]\tSpeed: 6156.555880 samples/sec\taccuracy=0.296512\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:16,921 INFO - root - Epoch [4] Batch [35]\tSpeed: 6384.176184 samples/sec\taccuracy=0.295871\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:17,090 INFO - root - Epoch [4] Batch [36]\tSpeed: 6066.663601 samples/sec\taccuracy=0.296901\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:17,246 INFO - root - Epoch [4] Batch [37]\tSpeed: 6546.128528 samples/sec\taccuracy=0.297055\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:17,417 INFO - root - Epoch [4] Batch [38]\tSpeed: 6018.926193 samples/sec\taccuracy=0.297701\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:17,577 INFO - root - Epoch [4] Batch [39]\tSpeed: 6415.943474 samples/sec\taccuracy=0.297607\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:17,747 INFO - root - Epoch [4] Batch [40]\tSpeed: 6010.906900 samples/sec\taccuracy=0.298114\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:17,904 INFO - root - Epoch [4] Batch [41]\tSpeed: 6546.038734 samples/sec\taccuracy=0.297945\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:18,073 INFO - root - Epoch [4] Batch [42]\tSpeed: 6052.156453 samples/sec\taccuracy=0.297352\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:18,230 INFO - root - Epoch [4] Batch [43]\tSpeed: 6555.070330 samples/sec\taccuracy=0.298118\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:18,399 INFO - root - Epoch [4] Batch [44]\tSpeed: 6071.303080 samples/sec\taccuracy=0.298589\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:18,553 INFO - root - Epoch [4] Batch [45]\tSpeed: 6626.144227 samples/sec\taccuracy=0.298361\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:18,722 INFO - root - Epoch [4] Batch [46]\tSpeed: 6078.374544 samples/sec\taccuracy=0.298267\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:18,877 INFO - root - Epoch [4] Batch [47]\tSpeed: 6594.493588 samples/sec\taccuracy=0.298767\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:19,046 INFO - root - Epoch [4] Batch [48]\tSpeed: 6094.088471 samples/sec\taccuracy=0.298868\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:19,046 INFO - root - [Epoch 4] training: accuracy=0.298868\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:19,046 INFO - root - [Epoch 4] time cost: 7.759808\n",
"\u001b[36malgo-1-67dsm_1 |\u001b[0m 2019-07-15 20:36:19,661 INFO - root - [Epoch 4] validation: accuracy=0.298926\n",
"\u001b[36mtmpqioifl1x_algo-1-67dsm_1 exited with code 0\n",
"\u001b[0mAborting on container exit...\n",
"===== Job Complete =====\n"
]
}
],
"source": [
"m.fit(inputs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"## Host\n",
"\n",
"After training, we use the MXNet estimator object to deploy an endpoint. Because we trained locally, we'll also deploy the endpoint locally. The predictor object returned by `deploy` lets us call the endpoint and perform inference on our sample images."
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Attaching to tmp2g0l4dal_algo-1-zl0u5_1\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:49,544 INFO - root - running container entrypoint\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:49,545 INFO - root - starting serve task\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:49,545 INFO - container_support.serving - reading config\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m Downloading s3://sagemaker-us-east-1-437242975833/sagemaker-mxnet-2019-07-15-20-32-44-985/sourcedir.tar.gz to /tmp/script.tar.gz\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:49,575 INFO - botocore.credentials - Found credentials in environment variables.\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:50,034 INFO - container_support.serving - loading framework-specific dependencies\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:50,382 INFO - container_support.serving - starting nginx\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:50,397 INFO - container_support.serving - starting gunicorn\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:50,400 INFO - container_support.serving - inference server started. waiting on processes: {32, 31}\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:50 +0000] [32] [INFO] Starting gunicorn 19.9.0\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:50 +0000] [32] [INFO] Listening at: unix:/tmp/gunicorn.sock (32)\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:50 +0000] [32] [INFO] Using worker: gevent\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:50 +0000] [51] [INFO] Booting worker with pid: 51\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:50 +0000] [52] [INFO] Booting worker with pid: 52\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:50 +0000] [54] [INFO] Booting worker with pid: 54\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:50,750 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:50 +0000] [59] [INFO] Booting worker with pid: 59\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:50,763 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:50,773 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:50,787 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:50 +0000] [92] [INFO] Booting worker with pid: 92\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:50 +0000] [93] [INFO] Booting worker with pid: 93\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:50,900 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:50,913 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:50 +0000] [112] [INFO] Booting worker with pid: 112\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:50 +0000] [115] [INFO] Booting worker with pid: 115\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,028 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,041 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:51 +0000] [135] [INFO] Booting worker with pid: 135\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,109 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,113 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,126 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,136 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:51 +0000] [170] [INFO] Booting worker with pid: 170\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:51 +0000] [172] [INFO] Booting worker with pid: 172\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:51 +0000] [174] [INFO] Booting worker with pid: 174\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,271 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,285 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,296 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:51] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,331 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:51 +0000] [197] [INFO] Booting worker with pid: 197\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:51] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:51 +0000] [216] [INFO] Booting worker with pid: 216\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,393 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,415 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:51 +0000] [235] [INFO] Booting worker with pid: 235\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,494 INFO - container_support.serving - returning initialized server\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [2019-07-15 20:37:51 +0000] [237] [INFO] Booting worker with pid: 237\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,570 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,573 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,579 INFO - container_support.serving - returning initialized server\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:51] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,589 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,589 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,590 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,604 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:51] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,725 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,741 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,791 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:51] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,791 INFO - container_support.serving - returning initialized server\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,812 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,841 INFO - container_support.serving - returning initialized server\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:51] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,873 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:51] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,901 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,918 INFO - container_support.serving - creating Server instance\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:51,969 INFO - container_support.serving - importing user module\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:52,059 INFO - container_support.serving - returning initialized server\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:52] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:52,070 INFO - container_support.serving - returning initialized server\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:52] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:52,098 INFO - container_support.serving - returning initialized server\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:52] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:52,211 INFO - container_support.serving - returning initialized server\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:52] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:52,255 INFO - container_support.serving - returning initialized server\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:52] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:52] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:52] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:52,395 INFO - container_support.serving - returning initialized server\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m 2019-07-15 20:37:52,395 INFO - container_support.serving - returning initialized server\n",
"\u001b[36malgo-1-zl0u5_1 |\u001b[0m [20:37:52] src/engine/engine.cc:55: MXNet start using engine: NaiveEngine\n",
"!"
]
}
],
"source": [
"predictor = m.deploy(initial_instance_count=1, instance_type='local_gpu')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Evaluate\n",
"\n",
"We'll use these CIFAR-10 sample images to test the service:\n",
"\n",
"<img style=\"display: inline; height: 32px; margin: 0.25em\" src=\"images/airplane1.png\" />\n",
"<img style=\"display: inline; height: 32px; margin: 0.25em\" src=\"images/automobile1.png\" />\n",
"<img style=\"display: inline; height: 32px; margin: 0.25em\" src=\"images/bird1.png\" />\n",
"<img style=\"display: inline; height: 32px; margin: 0.25em\" src=\"images/cat1.png\" />\n",
"<img style=\"display: inline; height: 32px; margin: 0.25em\" src=\"images/deer1.png\" />\n",
"<img style=\"display: inline; height: 32px; margin: 0.25em\" src=\"images/dog1.png\" />\n",
"<img style=\"display: inline; height: 32px; margin: 0.25em\" src=\"images/frog1.png\" />\n",
"<img style=\"display: inline; height: 32px; margin: 0.25em\" src=\"images/horse1.png\" />\n",
"<img style=\"display: inline; height: 32px; margin: 0.25em\" src=\"images/ship1.png\" />\n",
"<img style=\"display: inline; height: 32px; margin: 0.25em\" src=\"images/truck1.png\" />\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": [
"# load the CIFAR-10 samples, and convert them into format we can use with the prediction endpoint\n",
"from cifar10_utils import read_images\n",
"\n",
"filenames = ['images/airplane1.png',\n",
" 'images/bird1.png',\n",
" 'images/cat1.png',\n",
" 'images/deer1.png',\n",
" 'images/dog1.png',\n",
" 'images/frog1.png',\n",
" 'images/horse1.png',\n",
" 'images/ship1.png',\n",
" 'images/truck1.png',\n",
" 'images/test.png',\n",
" 'images/airplane.png',\n",
" 'images/frogadded.png']\n",
"\n",
"image_data = read_images(filenames)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The predictor runs inference on our input data and returns the predicted class label (as a float value, so we convert to int for display)."
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"image 0: class: 8\n",
"image 1: class: 7\n",
"image 2: class: 5\n",
"image 3: class: 6\n",
"image 4: class: 5\n",
"image 5: class: 5\n",
"image 6: class: 7\n",
"image 7: class: 8\n",
"image 8: class: 1\n",
"image 9: class: 5\n",
"image 10: class: 7\n",
"image 11: class: 6\n"
]
}
],
"source": [
"for i, img in enumerate(image_data):\n",
" response = predictor.predict(img)\n",
" print('image {}: class: {}'.format(i, int(response)))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"## Cleanup\n",
"\n",
"After you have finished with this example, remember to delete the prediction endpoint. Only one local endpoint can be running at a time."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Gracefully stopping... (press Ctrl+C again to force)\n"
]
}
],
"source": [
"m.delete_endpoint()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
},
"notice": "Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with the License. A copy of the License is located at http://aws.amazon.com/apache2.0/ or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."
},
"nbformat": 4,
"nbformat_minor": 4
}
+86
View File
@@ -0,0 +1,86 @@
#!/bin/bash
sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi
# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
# check if we have nvidia-docker
NVIDIA_DOCKER=`sudo apt list --installed | grep -c nvidia-docker2`
echo "TEST"$NVIDIA_DOCKER
if [ $NVIDIA_DOCKER -eq 0 ]; then
# Install nvidia-docker2
DOCKER_VERSION=`yum list docker | tail -1 | awk '{print $2}' | head -c 2`
if [ $DOCKER_VERSION -eq 17 ]; then
DOCKER_PKG_VERSION='17.09.1ce-1.111.amzn1'
NVIDIA_DOCKER_PKG_VERSION='2.0.3-1.docker17.09.1.ce.amzn1'
else
DOCKER_PKG_VERSION='18.06.1ce-3.17.amzn1'
NVIDIA_DOCKER_PKG_VERSION='2.0.3-1.docker18.06.1.ce.amzn1'
fi
sudo yum -y remove docker
sudo yum -y install docker-$DOCKER_PKG_VERSION
sudo /etc/init.d/docker start
curl -s -L https://nvidia.github.io/nvidia-docker/amzn1/nvidia-docker.repo | sudo tee /etc/yum.repos.d/nvidia-docker.repo
sudo yum install -y nvidia-docker2-$NVIDIA_DOCKER_PKG_VERSION
sudo cp daemon.json /etc/docker/daemon.json
sudo pkill -SIGHUP dockerd
echo "installed nvidia-docker2"
else
echo "nvidia-docker2 already installed. We are good to go!"
fi
fi
# This is common for both GPU and CPU instances
# check if we have docker-compose
docker-compose version >/dev/null 2>&1
if [ $? -ne 0 ]; then
# install docker compose
pip install docker-compose
fi
# check if we need to configure our docker interface
SAGEMAKER_NETWORK=`docker network ls | grep -c sagemaker-local`
if [ $SAGEMAKER_NETWORK -eq 0 ]; then
docker network create --driver bridge sagemaker-local
fi
# Notebook instance Docker networking fixes
RUNNING_ON_NOTEBOOK_INSTANCE=`sudo iptables -S OUTPUT -t nat | grep -c 169.254.0.2`
# Get the Docker Network CIDR and IP for the sagemaker-local docker interface.
SAGEMAKER_INTERFACE=br-`docker network ls | grep sagemaker-local | cut -d' ' -f1`
DOCKER_NET=`ip route | grep $SAGEMAKER_INTERFACE | cut -d" " -f1`
DOCKER_IP=`ip route | grep $SAGEMAKER_INTERFACE | cut -d" " -f12`
# check if both IPTables and the Route Table are OK.
IPTABLES_PATCHED=`sudo iptables -S PREROUTING -t nat | grep -c $SAGEMAKER_INTERFACE`
ROUTE_TABLE_PATCHED=`sudo ip route show table local | grep -c $SAGEMAKER_INTERFACE`
if [ $RUNNING_ON_NOTEBOOK_INSTANCE -gt 0 ]; then
if [ $ROUTE_TABLE_PATCHED -eq 0 ]; then
# fix routing
sudo ip route add $DOCKER_NET via $DOCKER_IP dev $SAGEMAKER_INTERFACE table agent
else
echo "SageMaker instance route table setup is ok. We are good to go."
fi
if [ $IPTABLES_PATCHED -eq 0 ]; then
sudo iptables -t nat -A PREROUTING -i $SAGEMAKER_INTERFACE -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 169.254.0.2:9081
echo "iptables for Docker setup done"
else
echo "SageMaker instance routing for Docker is ok. We are good to go!"
fi
fi
Executable
+85
View File
@@ -0,0 +1,85 @@
#!/bin/bash
sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi
# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
# check if we have nvidia-docker
NVIDIA_DOCKER=`rpm -qa | grep -c nvidia-docker2`
if [ $NVIDIA_DOCKER -eq 0 ]; then
# Install nvidia-docker2
DOCKER_VERSION=`yum list docker | tail -1 | awk '{print $2}' | head -c 2`
if [ $DOCKER_VERSION -eq 17 ]; then
DOCKER_PKG_VERSION='17.09.1ce-1.111.amzn1'
NVIDIA_DOCKER_PKG_VERSION='2.0.3-1.docker17.09.1.ce.amzn1'
else
DOCKER_PKG_VERSION='18.06.1ce-3.17.amzn1'
NVIDIA_DOCKER_PKG_VERSION='2.0.3-1.docker18.06.1.ce.amzn1'
fi
sudo yum -y remove docker
sudo yum -y install docker-$DOCKER_PKG_VERSION
sudo /etc/init.d/docker start
curl -s -L https://nvidia.github.io/nvidia-docker/amzn1/nvidia-docker.repo | sudo tee /etc/yum.repos.d/nvidia-docker.repo
sudo yum install -y nvidia-docker2-$NVIDIA_DOCKER_PKG_VERSION
sudo cp daemon.json /etc/docker/daemon.json
sudo pkill -SIGHUP dockerd
echo "installed nvidia-docker2"
else
echo "nvidia-docker2 already installed. We are good to go!"
fi
fi
# This is common for both GPU and CPU instances
# check if we have docker-compose
docker-compose version >/dev/null 2>&1
if [ $? -ne 0 ]; then
# install docker compose
pip install docker-compose
fi
# check if we need to configure our docker interface
SAGEMAKER_NETWORK=`docker network ls | grep -c sagemaker-local`
if [ $SAGEMAKER_NETWORK -eq 0 ]; then
docker network create --driver bridge sagemaker-local
fi
# Notebook instance Docker networking fixes
RUNNING_ON_NOTEBOOK_INSTANCE=`sudo iptables -S OUTPUT -t nat | grep -c 169.254.0.2`
# Get the Docker Network CIDR and IP for the sagemaker-local docker interface.
SAGEMAKER_INTERFACE=br-`docker network ls | grep sagemaker-local | cut -d' ' -f1`
DOCKER_NET=`ip route | grep $SAGEMAKER_INTERFACE | cut -d" " -f1`
DOCKER_IP=`ip route | grep $SAGEMAKER_INTERFACE | cut -d" " -f12`
# check if both IPTables and the Route Table are OK.
IPTABLES_PATCHED=`sudo iptables -S PREROUTING -t nat | grep -c $SAGEMAKER_INTERFACE`
ROUTE_TABLE_PATCHED=`sudo ip route show table agent | grep -c $SAGEMAKER_INTERFACE`
if [ $RUNNING_ON_NOTEBOOK_INSTANCE -gt 0 ]; then
if [ $ROUTE_TABLE_PATCHED -eq 0 ]; then
# fix routing
sudo ip route add $DOCKER_NET via $DOCKER_IP dev $SAGEMAKER_INTERFACE table agent
else
echo "SageMaker instance route table setup is ok. We are good to go."
fi
if [ $IPTABLES_PATCHED -eq 0 ]; then
sudo iptables -t nat -A PREROUTING -i $SAGEMAKER_INTERFACE -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 169.254.0.2:9081
echo "iptables for Docker setup done"
else
echo "SageMaker instance routing for Docker is ok. We are good to go!"
fi
fi