Skip to content

Commit 4bbca9c

Browse files
authored
Updating Trainer wait loop refresh time (#5361)
1 parent 82c83e1 commit 4bbca9c

File tree

4 files changed

+192
-167
lines changed

4 files changed

+192
-167
lines changed

sagemaker-train/src/sagemaker/train/common_utils/trainer_wait.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,8 @@ def wait(
178178
iteration = 0
179179
while True:
180180
iteration += 1
181-
time.sleep(1)
182-
if iteration == poll:
183-
iteration = 0
184-
training_job.refresh()
181+
time.sleep(poll)
182+
training_job.refresh()
185183
clear_output(wait=False)
186184

187185
status = training_job.training_job_status

v3-examples/model-customization-examples/rlaif_finetuning_example_notebook_v3_prod.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@
7070
"from rich import print as rprint\n",
7171
"from rich.pretty import pprint\n",
7272
"from sagemaker.core.resources import ModelPackage\n",
73-
"#import os\n",
73+
"import os\n",
7474
"#os.environ['SAGEMAKER_REGION'] = 'us-east-1'\n",
7575
"#os.environ['SAGEMAKER_STAGE'] = 'prod'\n",
7676
"\n",
7777
"import boto3\n",
7878
"from sagemaker.core.helper.session_helper import Session\n",
7979
"\n",
8080
"# For MLFlow native metrics in Trainer wait, run below line with approriate region\n",
81-
"# os.environ[\"SAGEMAKER_MLFLOW_CUSTOM_ENDPOINT\"] = \"https://mlflow.sagemaker.us-east-1.app.aws\"\n",
81+
"os.environ[\"SAGEMAKER_MLFLOW_CUSTOM_ENDPOINT\"] = \"https://mlflow.sagemaker.us-west-2.app.aws\"\n",
8282
"\n"
8383
]
8484
},

v3-examples/model-customization-examples/rlvr_finetuning_example_notebook_v3-prod.ipynb

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,8 @@
2323
},
2424
{
2525
"cell_type": "code",
26-
"execution_count": 1,
2726
"id": "10c2ef37-2425-4676-bc80-6d278d4e609a",
2827
"metadata": {},
29-
"outputs": [
30-
{
31-
"data": {
32-
"text/html": [
33-
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7fbfbf; text-decoration-color: #7fbfbf\">[12/02/25 17:54:14] </span><span style=\"color: #0069ff; text-decoration-color: #0069ff; font-weight: bold\">INFO </span> Found credentials in shared credentials file: ~<span style=\"color: #e100e1; text-decoration-color: #e100e1\">/.aws/credentials</span> <a href=\"file:///Users/rsareddy/workplace/virtual_envs/sagemaker-v3/lib/python3.12/site-packages/botocore/credentials.py\" target=\"_blank\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">credentials.py</span></a><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">:</span><a href=\"file:///Users/rsareddy/workplace/virtual_envs/sagemaker-v3/lib/python3.12/site-packages/botocore/credentials.py#1364\" target=\"_blank\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">1364</span></a>\n",
34-
"</pre>\n"
35-
],
36-
"text/plain": [
37-
"\u001B[2;36m[12/02/25 17:54:14]\u001B[0m\u001B[2;36m \u001B[0m\u001B[1;38;2;0;105;255mINFO \u001B[0m Found credentials in shared credentials file: ~\u001B[38;2;225;0;225m/.aws/\u001B[0m\u001B[38;2;225;0;225mcredentials\u001B[0m \u001B]8;id=600716;file:///Users/rsareddy/workplace/virtual_envs/sagemaker-v3/lib/python3.12/site-packages/botocore/credentials.py\u001B\\\u001B[2mcredentials.py\u001B[0m\u001B]8;;\u001B\\\u001B[2m:\u001B[0m\u001B]8;id=966746;file:///Users/rsareddy/workplace/virtual_envs/sagemaker-v3/lib/python3.12/site-packages/botocore/credentials.py#1364\u001B\\\u001B[2m1364\u001B[0m\u001B]8;;\u001B\\\n"
38-
]
39-
},
40-
"metadata": {},
41-
"output_type": "display_data"
42-
},
43-
{
44-
"name": "stdout",
45-
"output_type": "stream",
46-
"text": [
47-
"sagemaker.config INFO - Not applying SDK defaults from location: /Library/Application Support/sagemaker/config.yaml\n",
48-
"sagemaker.config INFO - Not applying SDK defaults from location: /Users/rsareddy/Library/Application Support/sagemaker/config.yaml\n"
49-
]
50-
},
51-
{
52-
"data": {
53-
"text/html": [
54-
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7fbfbf; text-decoration-color: #7fbfbf\"> </span><span style=\"color: #0069ff; text-decoration-color: #0069ff; font-weight: bold\">INFO </span> Found credentials in shared credentials file: ~<span style=\"color: #e100e1; text-decoration-color: #e100e1\">/.aws/credentials</span> <a href=\"file:///Users/rsareddy/workplace/virtual_envs/sagemaker-v3/lib/python3.12/site-packages/botocore/credentials.py\" target=\"_blank\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">credentials.py</span></a><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">:</span><a href=\"file:///Users/rsareddy/workplace/virtual_envs/sagemaker-v3/lib/python3.12/site-packages/botocore/credentials.py#1364\" target=\"_blank\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">1364</span></a>\n",
55-
"</pre>\n"
56-
],
57-
"text/plain": [
58-
"\u001B[2;36m \u001B[0m\u001B[2;36m \u001B[0m\u001B[1;38;2;0;105;255mINFO \u001B[0m Found credentials in shared credentials file: ~\u001B[38;2;225;0;225m/.aws/\u001B[0m\u001B[38;2;225;0;225mcredentials\u001B[0m \u001B]8;id=25130;file:///Users/rsareddy/workplace/virtual_envs/sagemaker-v3/lib/python3.12/site-packages/botocore/credentials.py\u001B\\\u001B[2mcredentials.py\u001B[0m\u001B]8;;\u001B\\\u001B[2m:\u001B[0m\u001B]8;id=835202;file:///Users/rsareddy/workplace/virtual_envs/sagemaker-v3/lib/python3.12/site-packages/botocore/credentials.py#1364\u001B\\\u001B[2m1364\u001B[0m\u001B]8;;\u001B\\\n"
59-
]
60-
},
61-
"metadata": {},
62-
"output_type": "display_data"
63-
}
64-
],
6528
"source": [
6629
"\n",
6730
"from sagemaker.train.rlvr_trainer import RLVRTrainer\n",
@@ -73,12 +36,15 @@
7336
"\n",
7437
"\n",
7538
"import boto3\n",
39+
"import os\n",
7640
"from sagemaker.core.helper.session_helper import Session\n",
7741
"\n",
7842
"# For MLFlow native metrics in Trainer wait, run below line with approriate region\n",
79-
"# os.environ[\"SAGEMAKER_MLFLOW_CUSTOM_ENDPOINT\"] = \"https://mlflow.sagemaker.us-east-1.app.aws\"\n",
43+
"os.environ[\"SAGEMAKER_MLFLOW_CUSTOM_ENDPOINT\"] = \"https://mlflow.sagemaker.us-west-2.app.aws\"\n",
8044
"\n"
81-
]
45+
],
46+
"outputs": [],
47+
"execution_count": null
8248
},
8349
{
8450
"cell_type": "markdown",

0 commit comments

Comments
 (0)