Skip to content

Commit 390f4ed

Browse files
rsareddy0329Roja Reddy Sareddy
andauthored
Added code block to describe update_endpoint option in sagemaker model_builder (#4834)
Co-authored-by: Roja Reddy Sareddy <[email protected]>
1 parent 6f61647 commit 390f4ed

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

deploy_and_monitor/sm-model_builder/model_builder_handshake.ipynb

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,21 @@
259259
"print(result)"
260260
]
261261
},
262+
{
263+
"metadata": {},
264+
"cell_type": "code",
265+
"outputs": [],
266+
"execution_count": null,
267+
"source": [
268+
"# Update existing endpoint\n",
269+
"predictor = model_builder.deploy(\n",
270+
" endpoint_name=f\"{alias}-xgboost-deploy-realtime\",\n",
271+
" initial_instance_count=3,\n",
272+
" update_endpoint=True, # Updates existing endpoint\n",
273+
")"
274+
],
275+
"id": "74b554744208fa27"
276+
},
262277
{
263278
"cell_type": "markdown",
264279
"id": "fbd0e6f6e92d0aeb",
@@ -285,6 +300,24 @@
285300
"print(result)"
286301
]
287302
},
303+
{
304+
"metadata": {},
305+
"cell_type": "code",
306+
"outputs": [],
307+
"execution_count": null,
308+
"source": [
309+
"predictor = model_builder.deploy(\n",
310+
" endpoint_name=f\"{alias}-xgboost-deploy-serverless\",\n",
311+
" inference_config=ServerlessInferenceConfig(memory_size_in_mb=1024),\n",
312+
" update_endpoint=True,\n",
313+
")\n",
314+
"\n",
315+
"sklearn_input = np.array([1.0, 2.0, 3.0, 4.0])\n",
316+
"result = predictor.predict(sklearn_input)\n",
317+
"print(result)"
318+
],
319+
"id": "305dca02732c0eac"
320+
},
288321
{
289322
"cell_type": "markdown",
290323
"id": "93818038782f105d",
@@ -317,6 +350,28 @@
317350
"print(result)"
318351
]
319352
},
353+
{
354+
"metadata": {},
355+
"cell_type": "code",
356+
"outputs": [],
357+
"execution_count": null,
358+
"source": [
359+
"predictor = model_builder.deploy(\n",
360+
" endpoint_name=f\"{alias}-xgboost-deploy-async\",\n",
361+
" inference_config=AsyncInferenceConfig(\n",
362+
" output_path=s3_path_join(\n",
363+
" \"s3://\", bucket, f\"{default_bucket_prefix_path}async_inference/update_output_prefix\"\n",
364+
" )\n",
365+
" ),\n",
366+
" update_endpoint=True,\n",
367+
")\n",
368+
"\n",
369+
"sklearn_input = np.array([1.0, 2.0, 3.0, 4.0])\n",
370+
"result = predictor.predict(sklearn_input)\n",
371+
"print(result)"
372+
],
373+
"id": "bbb56866e2faf7b"
374+
},
320375
{
321376
"cell_type": "markdown",
322377
"id": "2ff3e043b5f5f8d7",

0 commit comments

Comments
 (0)