Skip to content

Commit a6cb1bd

Browse files
Remove hardcoded images, create setup.ipynb, add local mode training note (#5540)
1 parent 49e53e8 commit a6cb1bd

File tree

15 files changed

+283
-5958
lines changed

15 files changed

+283
-5958
lines changed

sagemaker-core/example_notebooks/get_started.ipynb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,13 @@
187187
"metadata": {},
188188
"outputs": [],
189189
"source": [
190-
"image = '141502667606.dkr.ecr.eu-west-1.amazonaws.com/sagemaker-xgboost:1.7-1'"
190+
"from sagemaker.core import image_uris\n",
191+
"\n",
192+
"image = image_uris.retrieve(\n",
193+
" framework=\"xgboost\",\n",
194+
" region=region,\n",
195+
" version='1.7-1'\n",
196+
")"
191197
]
192198
},
193199
{
@@ -687,7 +693,7 @@
687693
],
688694
"metadata": {
689695
"kernelspec": {
690-
"display_name": "Python 3 (ipykernel)",
696+
"display_name": "temp_env",
691697
"language": "python",
692698
"name": "python3"
693699
},

sagemaker-core/example_notebooks/inference_and_resource_chaining.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,13 @@
241241
"metadata": {},
242242
"outputs": [],
243243
"source": [
244-
"# Image name is hardcoded here\n",
245-
"# Image name can be programatically got by using sagemaker package and calling image_uris.retrieve\n",
246-
"# Since that is a high level abstraction that has multiple dependencies, the image URIs functionalities will live in sagemaker (V2)\n",
244+
"from sagemaker.core import image_uris\n",
247245
"\n",
248-
"image = \"433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest\""
246+
"image = image_uris.retrieve(\n",
247+
" framework=\"xgboost\",\n",
248+
" region=region,\n",
249+
" version='latest'\n",
250+
")"
249251
]
250252
},
251253
{

sagemaker-core/example_notebooks/intelligent_defaults_and_logging.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,13 @@
269269
"metadata": {},
270270
"outputs": [],
271271
"source": [
272-
"# Image name is hardcoded here\n",
273-
"# Image name can be programatically got by using sagemaker package and calling image_uris.retrieve\n",
274-
"# Since that is a high level abstraction that has multiple dependencies, the image URIs functionalities will live in sagemaker (V2)\n",
272+
"from sagemaker.core import image_uris\n",
275273
"\n",
276-
"image = \"433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest\""
274+
"image = image_uris.retrieve(\n",
275+
" framework=\"xgboost\",\n",
276+
" region=region,\n",
277+
" version='latest'\n",
278+
")"
277279
]
278280
},
279281
{

sagemaker-core/example_notebooks/sagemaker_core_overview.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,13 @@
255255
"metadata": {},
256256
"outputs": [],
257257
"source": [
258-
"# Image name is hardcoded here\n",
259-
"# Image name can be programatically got by using sagemaker package and calling image_uris.retrieve\n",
260-
"# Since that is a high level abstraction that has multiple dependencies, the image URIs functionalities will live in sagemaker (V2)\n",
258+
"from sagemaker.core import image_uris\n",
261259
"\n",
262-
"image = \"433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest\""
260+
"image = image_uris.retrieve(\n",
261+
" framework=\"xgboost\",\n",
262+
" region=region,\n",
263+
" version='latest'\n",
264+
")"
263265
]
264266
},
265267
{

sagemaker-train/example_notebooks/evaluate/benchmark_demo.ipynb

Lines changed: 19 additions & 2372 deletions
Large diffs are not rendered by default.

sagemaker-train/example_notebooks/evaluate/custom_scorer_demo.ipynb

Lines changed: 19 additions & 1503 deletions
Large diffs are not rendered by default.

sagemaker-train/example_notebooks/evaluate/llm_as_judge_demo.ipynb

Lines changed: 17 additions & 2044 deletions
Large diffs are not rendered by default.

v3-examples/inference-examples/optimize-example.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"MODEL_ID = \"meta-textgeneration-llama-3-8b-instruct\"\n",
5555
"MODEL_NAME_PREFIX = \"jumpstart-optimize-example\"\n",
5656
"ENDPOINT_NAME_PREFIX = \"jumpstart-optimize-example-endpoint\"\n",
57-
"AWS_ACCOUNT_ID = \"593793038179\"\n",
58-
"AWS_REGION = \"us-east-2\"\n",
57+
"AWS_ACCOUNT_ID = Session.account_id()\n",
58+
"AWS_REGION = Session.boto_region_name\n",
5959
"\n",
6060
"# Generate unique identifiers\n",
6161
"unique_id = str(uuid.uuid4())[:8]\n",

v3-examples/inference-examples/train-inference-e2e-example.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"TRAINING_JOB_PREFIX = \"e2e-v3-pytorch\"\n",
6262
"\n",
6363
"# AWS Configuration\n",
64-
"AWS_REGION = \"us-west-2\"\n",
64+
"AWS_REGION = Session.boto_region_name\n",
6565
"PYTORCH_TRAINING_IMAGE = f\"763104351884.dkr.ecr.{AWS_REGION}.amazonaws.com/pytorch-training:1.13.1-cpu-py39\"\n",
6666
"\n",
6767
"# Generate unique identifiers\n",

v3-examples/ml-ops-examples/v3-mlflow-train-inference-e2e-example.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"metadata": {},
3535
"outputs": [],
3636
"source": [
37-
"# Install from local SDK for development (includes fixes for MLflow path resolution issues)\n",
38-
"%pip install -e ../../sagemaker-core -e ../../sagemaker-train -e ../../sagemaker-serve -e ../../sagemaker-mlops -e ../../. \"mlflow==3.4.0\" --upgrade"
37+
"# Install fix for MLflow path resolution issues\n",
38+
"%pip install mlflow==3.4.0"
3939
]
4040
},
4141
{
@@ -62,6 +62,7 @@
6262
"source": [
6363
"import uuid\n",
6464
"from sagemaker.core import image_uris\n",
65+
"from sagemaker.core.helper.session_helper import Session\n",
6566
"\n",
6667
"# =============================================================================\n",
6768
"# MLflow Configuration - UPDATE THIS WITH YOUR TRACKING SERVER ARN\n",
@@ -70,7 +71,7 @@
7071
"MLFLOW_TRACKING_ARN = \"XXXXX\"\n",
7172
"\n",
7273
"# AWS Configuration\n",
73-
"AWS_REGION = \"us-east-1\"\n",
74+
"AWS_REGION = Session.boto_region_name\n",
7475
"\n",
7576
"# Get PyTorch training image dynamically\n",
7677
"PYTORCH_TRAINING_IMAGE = image_uris.retrieve(\n",
@@ -556,7 +557,7 @@
556557
],
557558
"metadata": {
558559
"kernelspec": {
559-
"display_name": ".venv",
560+
"display_name": "py3.10.14",
560561
"language": "python",
561562
"name": "python3"
562563
},
@@ -570,7 +571,7 @@
570571
"name": "python",
571572
"nbconvert_exporter": "python",
572573
"pygments_lexer": "ipython3",
573-
"version": "3.11.14"
574+
"version": "3.10.14"
574575
}
575576
},
576577
"nbformat": 4,

0 commit comments

Comments
 (0)