Skip to content

Commit 8ce42b1

Browse files
authored
Updated mxnet_mnist_elastic_inference_local.ipynb and mxnet_mnist_elastic_inference.ipynb for SageMaker SDK v2 (#2032)
1 parent f8feda2 commit 8ce42b1

File tree

2 files changed

+23
-30
lines changed

2 files changed

+23
-30
lines changed

sagemaker-python-sdk/mxnet_mnist/mxnet_mnist_elastic_inference.ipynb

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"cell_type": "code",
4242
"execution_count": null,
4343
"metadata": {
44-
"collapsed": true,
4544
"isConfigCell": true
4645
},
4746
"outputs": [],
@@ -82,25 +81,23 @@
8281
"source": [
8382
"The SageMaker ```MXNet``` estimator allows us to run single-machine or distributed training in SageMaker, using CPU or GPU-based instances.\n",
8483
"\n",
85-
"When we create the estimator, we pass in the filename of our training script, the name of our IAM execution role, and the S3 locations we defined in the setup section. We also provide a few other parameters. `train_instance_count` and `train_instance_type` determine the number and type of SageMaker instances that are used for the training job. The `hyperparameters` parameter is a `dict` of values that are passed to your training script. You can see how to access these values in the ``mnist.py`` script above.\n",
84+
"When we create the estimator, we pass in the filename of our training script, the name of our IAM execution role, and the S3 locations we defined in the setup section. We also provide a few other parameters. `instance_count` and `instance_type` determine the number and type of SageMaker instances that are used for the training job. The `hyperparameters` parameter is a `dict` of values that are passed to your training script. You can see how to access these values in the ``mnist.py`` script above.\n",
8685
"\n",
8786
"For this example, we use one ``ml.m4.xlarge`` instance for our training job."
8887
]
8988
},
9089
{
9190
"cell_type": "code",
9291
"execution_count": null,
93-
"metadata": {
94-
"collapsed": true
95-
},
92+
"metadata": {},
9693
"outputs": [],
9794
"source": [
9895
"from sagemaker.mxnet import MXNet\n",
9996
"\n",
10097
"mnist_estimator = MXNet(entry_point='mnist.py',\n",
10198
" role=role,\n",
102-
" train_instance_count=1,\n",
103-
" train_instance_type='ml.m4.xlarge',\n",
99+
" instance_count=1,\n",
100+
" instance_type='ml.m4.xlarge',\n",
104101
" framework_version='1.4.1',\n",
105102
" py_version='py3',\n",
106103
" hyperparameters={'learning-rate': 0.1})"
@@ -246,9 +243,7 @@
246243
{
247244
"cell_type": "code",
248245
"execution_count": null,
249-
"metadata": {
250-
"collapsed": true
251-
},
246+
"metadata": {},
252247
"outputs": [],
253248
"source": [
254249
"print(\"Endpoint name: \" + predictor.endpoint)"
@@ -257,9 +252,7 @@
257252
{
258253
"cell_type": "code",
259254
"execution_count": null,
260-
"metadata": {
261-
"collapsed": true
262-
},
255+
"metadata": {},
263256
"outputs": [],
264257
"source": [
265258
"import sagemaker\n",
@@ -284,7 +277,7 @@
284277
"name": "python",
285278
"nbconvert_exporter": "python",
286279
"pygments_lexer": "ipython3",
287-
"version": "3.6.5"
280+
"version": "3.6.10"
288281
},
289282
"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."
290283
},

sagemaker-python-sdk/mxnet_mnist/mxnet_mnist_elastic_inference_local.ipynb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"cell_type": "code",
4242
"execution_count": null,
4343
"metadata": {
44-
"collapsed": true,
4544
"isConfigCell": true
4645
},
4746
"outputs": [],
@@ -55,7 +54,7 @@
5554
"cell_type": "markdown",
5655
"metadata": {},
5756
"source": [
58-
"This notebook shows how to use the SageMaker Python SDK to run your code in a local container before deploying to SageMaker's managed training or hosting environments. Just change your estimator's train_instance_type to local or local_gpu. For more information, see [local mode](https://github.com/aws/sagemaker-python-sdk#local-mode).\n",
57+
"This notebook shows how to use the SageMaker Python SDK to run your code in a local container before deploying to SageMaker's managed training or hosting environments. Just change your estimator's instance_type to local or local_gpu. For more information, see [local mode](https://github.com/aws/sagemaker-python-sdk#local-mode).\n",
5958
"\n",
6059
"To use Amazon Elastic Inference locally change your `accelerator_type` to `local_sagemaker_notebook` when calling `deploy()`.\n",
6160
"\n",
@@ -106,25 +105,23 @@
106105
"source": [
107106
"The SageMaker ```MXNet``` estimator allows us to run single machine or distributed training in SageMaker, using CPU or GPU-based instances.\n",
108107
"\n",
109-
"When we create the estimator, we pass in the filename of our training script, the name of our IAM execution role, and the S3 locations we defined in the setup section. We also provide a few other parameters. ``train_instance_count`` and ``train_instance_type`` determine the number and type of SageMaker instances that will be used for the training job. The ``hyperparameters`` parameter is a ``dict`` of values that will be passed to your training script -- you can see how to access these values in the ``mnist.py`` script above.\n",
108+
"When we create the estimator, we pass in the filename of our training script, the name of our IAM execution role, and the S3 locations we defined in the setup section. We also provide a few other parameters. ``instance_count`` and ``instance_type`` determine the number and type of SageMaker instances that will be used for the training job. The ``hyperparameters`` parameter is a ``dict`` of values that will be passed to your training script -- you can see how to access these values in the ``mnist.py`` script above.\n",
110109
"\n",
111-
"For this example, we will train our model on the local instance this notebook is running on. This is achieved by using `local` for `train_instance_type`. By passing local, training will be done inside of a Docker container on this notebook instance."
110+
"For this example, we will train our model on the local instance this notebook is running on. This is achieved by using `local` for `instance_type`. By passing local, training will be done inside of a Docker container on this notebook instance."
112111
]
113112
},
114113
{
115114
"cell_type": "code",
116115
"execution_count": null,
117-
"metadata": {
118-
"collapsed": true
119-
},
116+
"metadata": {},
120117
"outputs": [],
121118
"source": [
122119
"from sagemaker.mxnet import MXNet\n",
123120
"\n",
124121
"mnist_estimator = MXNet(entry_point='mnist.py',\n",
125122
" role=role,\n",
126-
" train_instance_count=1,\n",
127-
" train_instance_type='local',\n",
123+
" instance_count=1,\n",
124+
" instance_type='local',\n",
128125
" framework_version='1.4.1',\n",
129126
" py_version='py3',\n",
130127
" hyperparameters={'learning-rate': 0.1})"
@@ -287,9 +284,7 @@
287284
{
288285
"cell_type": "code",
289286
"execution_count": null,
290-
"metadata": {
291-
"collapsed": true
292-
},
287+
"metadata": {},
293288
"outputs": [],
294289
"source": [
295290
"print(\"Endpoint name: \" + predictor.endpoint)"
@@ -298,15 +293,20 @@
298293
{
299294
"cell_type": "code",
300295
"execution_count": null,
301-
"metadata": {
302-
"collapsed": true
303-
},
296+
"metadata": {},
304297
"outputs": [],
305298
"source": [
306299
"import sagemaker\n",
307300
"\n",
308301
"predictor.delete_endpoint()"
309302
]
303+
},
304+
{
305+
"cell_type": "code",
306+
"execution_count": null,
307+
"metadata": {},
308+
"outputs": [],
309+
"source": []
310310
}
311311
],
312312
"metadata": {
@@ -325,7 +325,7 @@
325325
"name": "python",
326326
"nbconvert_exporter": "python",
327327
"pygments_lexer": "ipython3",
328-
"version": "3.6.5"
328+
"version": "3.6.10"
329329
},
330330
"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."
331331
},

0 commit comments

Comments
 (0)