|
61 | 61 | "\n",
|
62 | 62 | "## The example\n",
|
63 | 63 | "\n",
|
64 |
| - "In this example we show how to package a PyTorch container, extending the SageMaker PyTorch container, with a Python example which works with the CIFAR-10 dataset. By extending the SageMaker PyTorch container we can utilize the existing training and hosting solution made to work on SageMaker.\n", |
| 64 | + "In this example we show how to package a PyTorch container, extending the SageMaker PyTorch container, with a Python example which works with the CIFAR-10 dataset. By extending the SageMaker PyTorch container we can utilize the existing training and hosting solution made to work on SageMaker. By comparison, if one were to build their own custom framework container from scratch, they would need to implement a training and hosting solution in order to use SageMaker. Here is an example showing [how to create a SageMaker TensorFlow container from scratch](https://github.com/awslabs/amazon-sagemaker-examples/blob/master/advanced_functionality/tensorflow_bring_your_own/tensorflow_bring_your_own.ipynb).\n", |
65 | 65 | "\n",
|
66 | 66 | "In this example, we use a single image to support training and hosting. This simplifies the procedure because we only need to manage one image for both tasks. Sometimes you may want separate images for training and hosting because they have different requirements. In this case, separate the parts discussed below into separate Dockerfiles and build two images. Choosing whether to use a single image or two images is a matter of what is most convenient for you to develop and manage.\n",
|
67 | 67 | "\n",
|
|
235 | 235 | "name": "stdout",
|
236 | 236 | "output_type": "stream",
|
237 | 237 | "text": [
|
238 |
| - "# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n", |
239 |
| - "#\n", |
240 |
| - "# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n", |
241 |
| - "# may not use this file except in compliance with the License. A copy of\n", |
242 |
| - "# the License is located at\n", |
243 |
| - "#\n", |
244 |
| - "# http://aws.amazon.com/apache2.0/\n", |
245 |
| - "#\n", |
246 |
| - "# or in the \"license\" file accompanying this file. This file is\n", |
247 |
| - "# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n", |
248 |
| - "# ANY KIND, either express or implied. See the License for the specific\n", |
249 |
| - "# language governing permissions and limitations under the License.\n", |
250 |
| - "\n", |
251 |
| - "# For more information on creating a Dockerfile\n", |
252 |
| - "# https://docs.docker.com/compose/gettingstarted/#step-2-create-a-dockerfile\n", |
253 |
| - "# SageMaker PyTorch image\n", |
254 |
| - "FROM 520713654638.dkr.ecr.us-west-2.amazonaws.com/sagemaker-pytorch:0.4.0-cpu-py3\n", |
255 |
| - "\n", |
256 |
| - "ENV PATH=\"/opt/ml/code:${PATH}\"\n", |
257 |
| - "\n", |
258 |
| - "# /opt/ml and all subdirectories are utilized by SageMaker, we use the /code subdirectory to store our user code.\n", |
259 |
| - "COPY /cifar10 /opt/ml/code\n", |
260 |
| - "\n", |
261 |
| - "# this environment variable is used by the SageMaker PyTorch container to determine our user code directory.\n", |
262 |
| - "ENV SAGEMAKER_SUBMIT_DIRECTORY /opt/ml/code\n", |
263 |
| - "\n", |
264 |
| - "# this environment variable is used by the SageMaker PyTorch container to determine our program entry point\n", |
265 |
| - "# for training and serving.\n", |
266 |
| - "# For more information: https://github.com/aws/sagemaker-pytorch-container\n", |
| 238 | + "# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r\n", |
| 239 | + "#\r\n", |
| 240 | + "# Licensed under the Apache License, Version 2.0 (the \"License\"). You\r\n", |
| 241 | + "# may not use this file except in compliance with the License. A copy of\r\n", |
| 242 | + "# the License is located at\r\n", |
| 243 | + "#\r\n", |
| 244 | + "# http://aws.amazon.com/apache2.0/\r\n", |
| 245 | + "#\r\n", |
| 246 | + "# or in the \"license\" file accompanying this file. This file is\r\n", |
| 247 | + "# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\r\n", |
| 248 | + "# ANY KIND, either express or implied. See the License for the specific\r\n", |
| 249 | + "# language governing permissions and limitations under the License.\r\n", |
| 250 | + "\r\n", |
| 251 | + "# For more information on creating a Dockerfile\r\n", |
| 252 | + "# https://docs.docker.com/compose/gettingstarted/#step-2-create-a-dockerfile\r\n", |
| 253 | + "# SageMaker PyTorch image\r\n", |
| 254 | + "FROM 520713654638.dkr.ecr.us-west-2.amazonaws.com/sagemaker-pytorch:0.4.0-cpu-py3\r\n", |
| 255 | + "\r\n", |
| 256 | + "ENV PATH=\"/opt/ml/code:${PATH}\"\r\n", |
| 257 | + "\r\n", |
| 258 | + "# /opt/ml and all subdirectories are utilized by SageMaker, we use the /code subdirectory to store our user code.\r\n", |
| 259 | + "COPY /cifar10 /opt/ml/code\r\n", |
| 260 | + "\r\n", |
| 261 | + "# this environment variable is used by the SageMaker PyTorch container to determine our user code directory.\r\n", |
| 262 | + "ENV SAGEMAKER_SUBMIT_DIRECTORY /opt/ml/code\r\n", |
| 263 | + "\r\n", |
| 264 | + "# this environment variable is used by the SageMaker PyTorch container to determine our program entry point\r\n", |
| 265 | + "# for training and serving.\r\n", |
| 266 | + "# For more information: https://github.com/aws/sagemaker-pytorch-container\r\n", |
267 | 267 | "ENV SAGEMAKER_PROGRAM cifar10.py"
|
268 | 268 | ]
|
269 | 269 | }
|
|
679 | 679 | ],
|
680 | 680 | "metadata": {
|
681 | 681 | "kernelspec": {
|
682 |
| - "display_name": "Python 3", |
| 682 | + "display_name": "conda_pytorch_p36", |
683 | 683 | "language": "python",
|
684 |
| - "name": "python3" |
| 684 | + "name": "conda_pytorch_p36" |
685 | 685 | },
|
686 | 686 | "language_info": {
|
687 | 687 | "codemirror_mode": {
|
|
0 commit comments