|
24 | 24 | },
|
25 | 25 | {
|
26 | 26 | "cell_type": "code",
|
27 |
| - "execution_count": 1, |
| 27 | + "execution_count": null, |
28 | 28 | "metadata": {
|
29 | 29 | "collapsed": true
|
30 | 30 | },
|
|
33 | 33 | "import os\n",
|
34 | 34 | "import sagemaker\n",
|
35 | 35 | "import tensorflow\n",
|
| 36 | + "from sagemaker import get_execution_role\n", |
36 | 37 | "\n",
|
37 | 38 | "sagemaker_session = sagemaker.Session()\n",
|
38 | 39 | "\n",
|
39 |
| - "# Replace with a role (either name or full arn) that gives SageMaker access to S3 and cloudwatch\n", |
40 |
| - "role='SageMakerRole'" |
| 40 | + "role = get_execution_role()" |
41 | 41 | ]
|
42 | 42 | },
|
43 | 43 | {
|
|
50 | 50 | },
|
51 | 51 | {
|
52 | 52 | "cell_type": "code",
|
53 |
| - "execution_count": 2, |
| 53 | + "execution_count": null, |
54 | 54 | "metadata": {
|
55 | 55 | "scrolled": false
|
56 | 56 | },
|
57 |
| - "outputs": [ |
58 |
| - { |
59 |
| - "name": "stdout", |
60 |
| - "output_type": "stream", |
61 |
| - "text": [ |
62 |
| - "cifar dataset already downloaded\n" |
63 |
| - ] |
64 |
| - } |
65 |
| - ], |
| 57 | + "outputs": [], |
66 | 58 | "source": [
|
67 | 59 | "import utils\n",
|
68 | 60 | "\n",
|
|
78 | 70 | },
|
79 | 71 | {
|
80 | 72 | "cell_type": "code",
|
81 |
| - "execution_count": 3, |
| 73 | + "execution_count": null, |
82 | 74 | "metadata": {
|
83 | 75 | "collapsed": true
|
84 | 76 | },
|
|
114 | 106 | "cell_type": "code",
|
115 | 107 | "execution_count": null,
|
116 | 108 | "metadata": {
|
117 |
| - "collapsed": true, |
118 | 109 | "scrolled": false
|
119 | 110 | },
|
120 | 111 | "outputs": [],
|
|
126 | 117 | "estimator = TensorFlow(entry_point='resnet_cifar_10.py',\n",
|
127 | 118 | " source_dir=source_dir,\n",
|
128 | 119 | " role=role,\n",
|
129 |
| - " training_steps=1000, evaluation_steps=100,\n", |
130 |
| - " train_instance_count=1, train_instance_type='ml.p2.xlarge', \n", |
| 120 | + " training_steps=3000, evaluation_steps=100,\n", |
| 121 | + " train_instance_count=2, train_instance_type='ml.c4.xlarge', \n", |
131 | 122 | " base_job_name='tensorboard-example')\n",
|
132 | 123 | "\n",
|
133 | 124 | "estimator.fit(inputs, run_tensorboard_locally=True)"
|
|
137 | 128 | "cell_type": "markdown",
|
138 | 129 | "metadata": {},
|
139 | 130 | "source": [
|
140 |
| - "The **```fit```** method will create a training job named **```tensorboard-example-{unique identifier}```**in a p2 instance. That instance will write checkpoints to the s3 bucket **```sagemaker-{your aws account number}```**.\n", |
| 131 | + "The **```fit```** method will create a training job named **```tensorboard-example-{unique identifier}```** in two **ml.c4.xlarge** instances. These instances will write checkpoints to the s3 bucket **```sagemaker-{your aws account number}```**.\n", |
141 | 132 | "\n",
|
142 | 133 | "If you don't have this bucket yet, **```sagemaker_session```** will create it for you. These checkpoints can be used for restoring the training job, and to analyze training job metrics using **TensorBoard**. \n",
|
143 | 134 | "\n",
|
|
164 | 155 | {
|
165 | 156 | "cell_type": "code",
|
166 | 157 | "execution_count": null,
|
167 |
| - "metadata": { |
168 |
| - "collapsed": true |
169 |
| - }, |
| 158 | + "metadata": {}, |
170 | 159 | "outputs": [],
|
171 | 160 | "source": [
|
172 | 161 | "predictor = estimator.deploy(initial_instance_count=1, instance_type='ml.c4.xlarge')"
|
|
176 | 165 | "cell_type": "markdown",
|
177 | 166 | "metadata": {},
|
178 | 167 | "source": [
|
179 |
| - "# Deleting the endpoint\n", |
180 |
| - "**Important** " |
| 168 | + "# Cleaning up\n", |
| 169 | + "To avoid incurring charges to your AWS account for the resources used in this tutorial you need to delete the **SageMaker Endpoint:**" |
181 | 170 | ]
|
182 | 171 | },
|
183 | 172 | {
|
|
0 commit comments