From 12888d5134c4cc21f8972ddb621b8c93e1c98304 Mon Sep 17 00:00:00 2001 From: EC2 Default User Date: Tue, 8 Jun 2021 12:20:28 +0000 Subject: [PATCH 1/2] modified: multi-model-endpoint-tensorflow-cv.ipynb --- multi-model-endpoint-tensorflow-cv.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multi-model-endpoint-tensorflow-cv.ipynb b/multi-model-endpoint-tensorflow-cv.ipynb index a109a07..e5485df 100644 --- a/multi-model-endpoint-tensorflow-cv.ipynb +++ b/multi-model-endpoint-tensorflow-cv.ipynb @@ -328,7 +328,7 @@ "fig = plt.figure(figsize=(20, 5))\n", "for i in range(36):\n", " ax = fig.add_subplot(3, 12, i+1, xticks=[], yticks=[])\n", - " ax.imshow(np.squeeze(X_train[i].T))" + " ax.imshow(np.squeeze(X_train[i]))" ] }, { @@ -857,7 +857,7 @@ "source": [ "fig, rows = plt.subplots(nrows=1, ncols=4, figsize=(224, 224))\n", "for row in rows:\n", - " row.imshow(train_batches.next()[0][0].astype('int').T)\n", + " row.imshow(train_batches.next()[0][0].astype('int'))\n", " row.axis('off')\n", "plt.show()" ] @@ -1458,7 +1458,7 @@ }, "outputs": [], "source": [ - "predicted_label = np.argmax(y_pred)\n", + "predicted_label = np.argmax(y_pred['predictions'][0])\n", "print(f'Predicted Label: [{predicted_label}]')" ] } From 74a97ecc2fa9bf76c5543dfe23373a6c69c61647 Mon Sep 17 00:00:00 2001 From: EC2 Default User Date: Tue, 8 Jun 2021 13:39:04 +0000 Subject: [PATCH 2/2] modified: multi-model-endpoint-tensorflow-cv.ipynb --- multi-model-endpoint-tensorflow-cv.ipynb | 26 ++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/multi-model-endpoint-tensorflow-cv.ipynb b/multi-model-endpoint-tensorflow-cv.ipynb index e5485df..63c5bd1 100644 --- a/multi-model-endpoint-tensorflow-cv.ipynb +++ b/multi-model-endpoint-tensorflow-cv.ipynb @@ -963,7 +963,7 @@ "source": [ "model_name = 'sign-language'\n", "\n", - "hyperparameters = {'epochs': 1}\n", + "hyperparameters = {'epochs': 5}\n", "estimator_parameters = {'entry_point':'sign_language_train.py',\n", " 'instance_type': 'ml.m5.2xlarge',\n", " 'instance_count': 1,\n", @@ -1124,7 +1124,13 @@ }, "outputs": [], "source": [ - "IMAGE_URI = '763104351884.dkr.ecr.us-east-1.amazonaws.com/tensorflow-inference:2.3.1-cpu-py37-ubuntu18.04'\n", + "from sagemaker.image_uris import retrieve\n", + "IMAGE_URI = retrieve(\n", + " framework=\"tensorflow\",version=TF_FRAMEWORK_VERSION,\n", + " image_scope='inference', \n", + " instance_type='ml.m5.xlarge',\n", + " region=sagemaker_session.boto_region_name)\n", + "\n", "model_data_prefix = f's3://{BUCKET}/{PREFIX}/mme/'" ] }, @@ -1461,6 +1467,22 @@ "predicted_label = np.argmax(y_pred['predictions'][0])\n", "print(f'Predicted Label: [{predicted_label}]')" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "predictor.delete_endpoint()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {