AWS Security ChangesHomeSearch

AWS sagemaker documentation change

Service: sagemaker · 2026-06-28 · Documentation low

File: sagemaker/latest/dg/debugger-bring-your-own-container.md

Summary

Updated API references from 'Estimator' to 'ModelTrainer' throughout the document and added new code examples for SageMaker Python SDK v3 and v2 configurations

Security assessment

The changes primarily update API terminology and add configuration examples without addressing security vulnerabilities or weaknesses. There's no mention of security patches, vulnerability fixes, or security enhancements. The added Debugger functionality focuses on debugging capabilities rather than security features.

Diff

diff --git a/sagemaker/latest/dg/debugger-bring-your-own-container.md b/sagemaker/latest/dg/debugger-bring-your-own-container.md
index dd72354eb..4f77c9bbd 100644
--- a//sagemaker/latest/dg/debugger-bring-your-own-container.md
+++ b//sagemaker/latest/dg/debugger-bring-your-own-container.md
@@ -11 +11 @@ Prepare to build a custom training containerRegister Debugger Hook to Your Train
-Amazon SageMaker Debugger is available for any deep learning models that you bring to Amazon SageMaker AI. The AWS CLI, SageMaker AI `Estimator` API, and the Debugger APIs enable you to use any Docker base images to build and customize containers to train your models. To use Debugger with customized containers, you need to make a minimal change to your training script to implement the Debugger hook callback and retrieve tensors from training jobs. The following sections will walk you through how to use Debugger with Custom Training Containers.
+Amazon SageMaker Debugger is available for any deep learning models that you bring to Amazon SageMaker AI. The AWS CLI, SageMaker AI `ModelTrainer` API, and the Debugger APIs enable you to use any Docker base images to build and customize containers to train your models. To use Debugger with customized containers, you need to make a minimal change to your training script to implement the Debugger hook callback and retrieve tensors from training jobs. The following sections will walk you through how to use Debugger with Custom Training Containers.
@@ -114 +114 @@ To see the difference between using Debugger in a Deep Learning Container and in
-In script mode, the hook configuration part is removed from the script in which you set the estimator. Instead, the Debugger hook feature is merged into the training script, [ TensorFlow Keras ResNet training script in script mode](https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker-debugger/tensorflow2/tensorflow2_keras_custom_container/src/tf_keras_resnet_byoc.py). The training script imports the `smdebug` library in the required TensorFlow Keras environment to communicate with the TensorFlow ResNet50 algorithm. It also manually implements the `smdebug` hook functionality by adding the `callbacks=[hook]` argument inside the `train` function (in line 49), and by adding the manual hook configuration (in line 89) provided through SageMaker Python SDK.
+In script mode, the hook configuration part is removed from the script in which you set the ModelTrainer. Instead, the Debugger hook feature is merged into the training script, [ TensorFlow Keras ResNet training script in script mode](https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker-debugger/tensorflow2/tensorflow2_keras_custom_container/src/tf_keras_resnet_byoc.py). The training script imports the `smdebug` library in the required TensorFlow Keras environment to communicate with the TensorFlow ResNet50 algorithm. It also manually implements the `smdebug` hook functionality by adding the `callbacks=[hook]` argument inside the `train` function (in line 49), and by adding the manual hook configuration (in line 89) provided through SageMaker Python SDK.
@@ -122 +122 @@ This notebook enables Debugger in script mode in PyTorch v1.3.1 framework. PyTor
-The SageMaker AI PyTorch estimator is already in script mode by default. In the notebook, the line to activate `script_mode` is not included in the estimator configuration.
+The SageMaker AI PyTorch ModelTrainer is already in script mode by default. In the notebook, the line to activate `script_mode` is not included in the ModelTrainer configuration.
@@ -179 +179,38 @@ If you use one of the AWS Deep Learning Container base images, run the following
-After you build and push your docker container to Amazon ECR, configure a SageMaker AI estimator with your training script and the Debugger-specific parameters. After you execute the `estimator.fit()`, Debugger will collect output tensors, monitor them, and detect training issues. Using the saved tensors, you can further analyze the training job by using the `smdebug` core features and tools. Configuring a workflow of Debugger rule monitoring process with Amazon CloudWatch Events and AWS Lambda, you can automate a stopping training job process whenever the Debugger rules spots training issues.
+After you build and push your docker container to Amazon ECR, configure a SageMaker AI ModelTrainer with your training script and the Debugger-specific parameters. After you execute the `model_trainer.train()`, Debugger will collect output tensors, monitor them, and detect training issues. Using the saved tensors, you can further analyze the training job by using the `smdebug` core features and tools. Configuring a workflow of Debugger rule monitoring process with Amazon CloudWatch Events and AWS Lambda, you can automate a stopping training job process whenever the Debugger rules spots training issues.
+
+SageMaker Python SDK v3
+    
+    
+    
+    import sagemaker
+    from sagemaker.train import ModelTrainer
+    from sagemaker.core.debugger import Rule, DebuggerHookConfig, CollectionConfig, rule_configs
+    from sagemaker.core.helper.session_helper import get_execution_role
+    
+    profiler_config=ProfilerConfig(...)
+    debugger_hook_config=DebuggerHookConfig(...)
+    rules=[
+        Rule.sagemaker(rule_configs.built_in_rule()),
+        ProfilerRule.sagemaker(rule_configs.BuiltInRule())
+    ]
+    
+    from sagemaker.train.configs import SourceCode, Compute
+    
+    model_trainer=ModelTrainer(
+        training_image=byoc_image_uri,
+        source_code=SourceCode(entry_script="./debugger_custom_container_test_folder/your-training-script.py"),
+        role=get_execution_role(),
+        base_job_name='debugger-custom-container-test',
+        compute=Compute(instance_type='ml.p3.2xlarge', instance_count=1),
+        
+        # Debugger-specific parameters
+        profiler_config=profiler_config,
+        debugger_hook_config=debugger_hook_config,
+        rules=rules
+    )
+    
+    # start training
+    model_trainer.train()
+
+SageMaker Python SDK v2 (Legacy)
+