AWS sagemaker documentation change
Summary
Updated SageMaker Python SDK references from Estimator to ModelTrainer class and added versioned code examples (v3/v2)
Security assessment
Changes involve updating class names and adding SDK version-specific examples for remote debugging functionality. No security vulnerabilities, patches, or security features are mentioned. Changes appear to be routine documentation updates for SDK versioning.
Diff
diff --git a/sagemaker/latest/dg/train-remote-debugging.md b/sagemaker/latest/dg/train-remote-debugging.md index a1848ac48..80d8b16a7 100644 --- a//sagemaker/latest/dg/train-remote-debugging.md +++ b//sagemaker/latest/dg/train-remote-debugging.md @@ -147 +147 @@ SageMaker Python SDK -Using the estimator class in the SageMaker Python SDK, you can turn remote debugging on or off using the `enable_remote_debug` parameter or the `enable_remote_debug()` and `disable_remote_debug()` methods. +Using the ModelTrainer class in the SageMaker Python SDK, you can turn remote debugging on or off using the `enable_remote_debug` parameter or the `enable_remote_debug()` and `disable_remote_debug()` methods. @@ -152,0 +153,29 @@ To enable remote debugging when you create a new training job, set the `enable_r +SageMaker Python SDK v3SageMaker Python SDK v2 (Legacy) + +SageMaker Python SDK v3 + + + + from sagemaker.core.helper.session_helper import Session + from sagemaker.train import ModelTrainer + from sagemaker.train.configs import Compute + + session = Session() + + model_trainer = ModelTrainer( + ..., + sagemaker_session=session, + training_image="<your_image_uri>", #must be owned by your organization or Amazon DLCs + role=role, + compute=Compute( + instance_type="ml.m5.xlarge", + instance_count=1, + ), + output_path=output_path, + max_run=1800, + enable_remote_debug=True + ) + +SageMaker Python SDK v2 (Legacy) + + @@ -172 +201,16 @@ To enable remote debugging when you create a new training job, set the `enable_r -Using the following estimator class methods, you can enable or disable remote debugging while a training job is running when the `SecondaryStatus` of the job is `Downloading` or `Training`. +Using the following ModelTrainer class methods, you can enable or disable remote debugging while a training job is running when the `SecondaryStatus` of the job is `Downloading` or `Training`. + +SageMaker Python SDK v3SageMaker Python SDK v2 (Legacy) + +SageMaker Python SDK v3 + + + + # Enable RemoteDebug + model_trainer.enable_remote_debug() + + # Disable RemoteDebug + model_trainer.disable_remote_debug() + +SageMaker Python SDK v2 (Legacy) + @@ -187,0 +232,5 @@ To enable remote debugging when you create a new training job, set the value for +SageMaker Python SDK v3SageMaker Python SDK v2 (Legacy) + +SageMaker Python SDK v3 + + @@ -217,0 +267,13 @@ To enable remote debugging when you create a new training job, set the value for +SageMaker Python SDK v2 (Legacy) + + + + import boto3 + + session = boto3.session.Session() + region = session.region_name + sm = boto3.Session(region_name=region).client("sagemaker") + + # Describe the job status + sm.describe_training_job(TrainingJobName=job_name) + @@ -299,0 +362,5 @@ To check the `SecondaryStatus` of a training job, run the following SageMaker Py +SageMaker Python SDK v3SageMaker Python SDK v2 (Legacy) + +SageMaker Python SDK v3 + + @@ -301,0 +369 @@ To check the `SecondaryStatus` of a training job, run the following SageMaker Py + from sagemaker.core.helper.session_helper import Session @@ -303 +371 @@ To check the `SecondaryStatus` of a training job, run the following SageMaker Py - session = sagemaker.Session() + session = Session() @@ -308,0 +377,20 @@ To check the `SecondaryStatus` of a training job, run the following SageMaker Py +SageMaker Python SDK v2 (Legacy) + + + + import sagemaker + + session = sagemaker.Session() + + estimator = sagemaker.estimator.Estimator( + ..., + sagemaker_session=session, + image_uri="<your_image_uri>", #must be owned by your organization or Amazon DLCs + role=role, + instance_type="ml.m5.xlarge", + instance_count=1, + output_path=output_path, + max_run=1800, + enable_remote_debug=True + ) + @@ -313,0 +402,5 @@ To check the `SecondaryStatus` of a training job, run the following SDK for Pyth +SageMaker Python SDK v3SageMaker Python SDK v2 (Legacy) + +SageMaker Python SDK v3 + + @@ -323,0 +417,33 @@ To check the `SecondaryStatus` of a training job, run the following SDK for Pyth +SageMaker Python SDK v2 (Legacy) + + + + import boto3 + + sm = boto3.Session(region_name=region).client("sagemaker") + + # Start a training job + sm.create_training_job( + ..., + TrainingJobName=job_name, + AlgorithmSpecification={ + // Specify a training Docker container image URI + // (Deep Learning Container or your own training container) to TrainingImage. + "TrainingImage": "<your_image_uri>", + "TrainingInputMode": "File" + }, + RoleArn=iam_role_arn, + OutputDataConfig=output_path, + ResourceConfig={ + "InstanceType": "ml.m5.xlarge", + "InstanceCount": 1, + "VolumeSizeInGB": 30 + }, + StoppingCondition={ + "MaxRuntimeInSeconds": 86400 + }, + **RemoteDebugConfig={ + "EnableRemoteDebug": True + }** + ) +