Skip to content

Commit 6aac58d

Browse files
author
Niklas Palm
committed
Fetch model from known prefix
1 parent ada1a8a commit 6aac58d

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

05_deployment/sagemaker-deploy-model-for-inference.ipynb

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,7 @@
111111
"metadata": {},
112112
"outputs": [],
113113
"source": [
114-
"# Get S3 URI of the model artifact\n",
115-
"s3_client = boto3.client('s3')\n",
116-
"model_dir = s3_client.list_objects_v2(Bucket=bucket, Delimiter='/', Prefix=f'{prefix}/{prefix}')['CommonPrefixes'][-1]['Prefix']\n",
117-
"bird_model_path = f's3://{bucket}/{model_dir}output/model.tar.gz'\n",
114+
"bird_model_path = f's3://{bucket}/{prefix}/outputs/model/model.tar.gz'\n",
118115
"print(f'bird_model_path: {bird_model_path}')"
119116
]
120117
},
@@ -175,9 +172,17 @@
175172
},
176173
{
177174
"cell_type": "code",
178-
"execution_count": null,
175+
"execution_count": 5,
179176
"metadata": {},
180-
"outputs": [],
177+
"outputs": [
178+
{
179+
"name": "stdout",
180+
"output_type": "stream",
181+
"text": [
182+
"---!Endpoint [tensorflow-inference-2022-11-06-20-50-11-918] deployed\n"
183+
]
184+
}
185+
],
181186
"source": [
182187
"from sagemaker.tensorflow import TensorFlowModel\n",
183188
"\n",
@@ -223,7 +228,23 @@
223228
"cell_type": "code",
224229
"execution_count": null,
225230
"metadata": {},
226-
"outputs": [],
231+
"outputs": [
232+
{
233+
"name": "stderr",
234+
"output_type": "stream",
235+
"text": [
236+
"update_endpoint is a no-op in sagemaker>=2.\n",
237+
"See: https://sagemaker.readthedocs.io/en/stable/v2.html for details.\n"
238+
]
239+
},
240+
{
241+
"name": "stdout",
242+
"output_type": "stream",
243+
"text": [
244+
"-"
245+
]
246+
}
247+
],
227248
"source": [
228249
"from sagemaker.tensorflow import TensorFlowModel\n",
229250
"\n",
@@ -347,13 +368,6 @@
347368
" cv_utils.predict_bird_from_file(inputfile,predictor,possible_classes)"
348369
]
349370
},
350-
{
351-
"cell_type": "markdown",
352-
"metadata": {},
353-
"source": [
354-
"## Clean Up"
355-
]
356-
},
357371
{
358372
"cell_type": "code",
359373
"execution_count": null,
@@ -367,7 +381,7 @@
367381
"kernelspec": {
368382
"display_name": "Python 3 (Data Science)",
369383
"language": "python",
370-
"name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-east-1:081325390199:image/datascience-1.0"
384+
"name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:eu-west-1:470317259841:image/datascience-1.0"
371385
},
372386
"language_info": {
373387
"codemirror_mode": {

0 commit comments

Comments
 (0)