|
171 | 171 | "\n",
|
172 | 172 | "### Export the model from tensorflow\n",
|
173 | 173 | "\n",
|
174 |
| - "In order to set up hosting, we have to import the model from training to hosting. We will begin by exporting the model from TensorFlow and saving it down. Analogous to the [MXNet example](../mxnet_mnist_byom/mxnet_mnist.ipynb), some structure needs to be followed. The exported model has to be converted into a form that is readable by ``sagemaker.mxnet.model.MXNetModel``. The following code describes exporting the model in a form that does the same:\n", |
| 174 | + "In order to set up hosting, we have to import the model from training to hosting. We will begin by exporting the model from TensorFlow and saving it down. Analogous to the [MXNet example](../mxnet_mnist_byom/mxnet_mnist.ipynb), some structure needs to be followed. The exported model has to be converted into a form that is readable by ``sagemaker.tensorflow.model.TensorFlowModel``. The following code describes exporting the model in a form that does the same:\n", |
175 | 175 | "\n",
|
176 | 176 | "There is a small difference between a SageMaker model and a TensorFlow model. The conversion is easy and fairly trivial. Simply move the tensorflow exported model into a directory ``export\\Servo\\`` and tar the entire directory. SageMaker will recognize this as a loadable TensorFlow model."
|
177 | 177 | ]
|
|
199 | 199 | "source": [
|
200 | 200 | "### Import model into SageMaker\n",
|
201 | 201 | "\n",
|
202 |
| - "Open a new sagemaker session and upload the model on to the default S3 bucket. We can use the ``sagemaker.Session.upload_data`` method to do this. We need the location of where we exported the model from MXNet and where in our default bucket we want to store the model(``/model``). The default S3 bucket can be found using the ``sagemaker.Session.default_bucket`` method." |
| 202 | + "Open a new sagemaker session and upload the model on to the default S3 bucket. We can use the ``sagemaker.Session.upload_data`` method to do this. We need the location of where we exported the model from TensorFlow and where in our default bucket we want to store the model(``/model``). The default S3 bucket can be found using the ``sagemaker.Session.default_bucket`` method." |
203 | 203 | ]
|
204 | 204 | },
|
205 | 205 | {
|
|
220 | 220 | "cell_type": "markdown",
|
221 | 221 | "metadata": {},
|
222 | 222 | "source": [
|
223 |
| - "Use the ``sagemaker.mxnet.model.TensorFlowModel`` to import the model into SageMaker that can be deployed. We need the location of the S3 bucket where we have the model, the role for authentication and the entry_point where the model defintion is stored (``iris_dnn_classifier.py``). The import call is the following:" |
| 223 | + "Use the ``sagemaker.tensorflow.model.TensorFlowModel`` to import the model into SageMaker that can be deployed. We need the location of the S3 bucket where we have the model, the role for authentication and the entry_point where the model defintion is stored (``iris_dnn_classifier.py``). The import call is the following:" |
224 | 224 | ]
|
225 | 225 | },
|
226 | 226 | {
|
|
243 | 243 | "source": [
|
244 | 244 | "### Create endpoint\n",
|
245 | 245 | "\n",
|
246 |
| - "Now the model is ready to be deployed at a SageMaker endpoint. We can use the ``sagemaker.mxnet.model.TensorFlowModel.deploy`` method to do this. Unless you have created or prefer other instances, we recommend using 1 ``'ml.c4.xlarge'`` instance for this example. These are supplied as arguments. " |
| 246 | + "Now the model is ready to be deployed at a SageMaker endpoint. We can use the ``sagemaker.tensotflow.model.TensorFlowModel.deploy`` method to do this. Unless you have created or prefer other instances, we recommend using 1 ``'ml.m4.xlarge'`` instance for this example. These are supplied as arguments. " |
247 | 247 | ]
|
248 | 248 | },
|
249 | 249 | {
|
|
254 | 254 | "source": [
|
255 | 255 | "%%time\n",
|
256 | 256 | "predictor = sagemaker_model.deploy(initial_instance_count=1,\n",
|
257 |
| - " instance_type='ml.c4.xlarge')" |
| 257 | + " instance_type='ml.m4.xlarge')" |
258 | 258 | ]
|
259 | 259 | },
|
260 | 260 | {
|
|
0 commit comments