AWS Security ChangesHomeSearch

AWS sagemaker documentation change

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

File: sagemaker/latest/dg/data-parallel-framework-estimator.md

Summary

Updated documentation to reflect SageMaker Python SDK v3 changes: replaced PyTorch/TensorFlow estimator examples with new ModelTrainer API, added legacy SDK section with distribution options, fixed formatting and links.

Security assessment

The changes focus on API updates and code examples migration from framework-specific estimators to the new ModelTrainer interface. No security vulnerabilities, configurations, or features are mentioned. Changes are instructional about SDK usage without security context.

Diff

diff --git a/sagemaker/latest/dg/data-parallel-framework-estimator.md b/sagemaker/latest/dg/data-parallel-framework-estimator.md
index 41063fdd5..7dd85f7fa 100644
--- a//sagemaker/latest/dg/data-parallel-framework-estimator.md
+++ b//sagemaker/latest/dg/data-parallel-framework-estimator.md
@@ -9 +9 @@
-You can launch distributed training by adding the `distribution` argument to the SageMaker AI framework estimators, [`PyTorch`](https://sagemaker.readthedocs.io/en/stable/frameworks/pytorch/sagemaker.pytorch.html#sagemaker.pytorch.estimator.PyTorch) or [`TensorFlow`](https://sagemaker.readthedocs.io/en/stable/frameworks/tensorflow/sagemaker.tensorflow.html#tensorflow-estimator). For more details, choose one of the frameworks supported by the SageMaker AI distributed data parallelism (SMDDP) library from the following selections.
+You can launch distributed training by adding the `distribution` argument to the SageMaker AI framework estimators, [`PyTorch`](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_train.html) or [`TensorFlow`](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_train.html). For more details, choose one of the frameworks supported by the SageMaker AI distributed data parallelism (SMDDP) library from the following selections.
@@ -11 +11 @@ You can launch distributed training by adding the `distribution` argument to the
-PyTorch
+SageMaker Python SDK v3
@@ -53 +53 @@ If you chose to replace NCCL `AllReduce` with SMDDP `AllReduce`, you should choo
-The following code sample shows the basic structure of a PyTorch estimator with distributed training options.
+The following code sample shows the basic structure of a ModelTrainer with distributed training options.
@@ -56 +56,3 @@ The following code sample shows the basic structure of a PyTorch estimator with
-    from sagemaker.pytorch import PyTorch
+    from sagemaker.train import ModelTrainer
+    from sagemaker.train.configs import SourceCode, Compute, InputData
+    from sagemaker.core import image_uris
@@ -58,5 +60,5 @@ The following code sample shows the basic structure of a PyTorch estimator with
-    pt_estimator = PyTorch(
-        base_job_name="training_job_name_prefix",
-        source_dir="subdirectory-to-your-code",
-        entry_point="adapted-training-script.py",
-        role="SageMakerRole",
+    # Retrieve the training image for the desired PyTorch version
+    training_image = image_uris.retrieve(
+        framework="pytorch",
+        region="us-west-2",
+        version="2.0.1",
@@ -64 +66,8 @@ The following code sample shows the basic structure of a PyTorch estimator with
-        framework_version="2.0.1",
+        instance_type="ml.p4d.24xlarge",
+        image_scope="training"
+    )
+    
+    source_code = SourceCode(
+        source_dir="subdirectory-to-your-code",
+        entry_script="adapted-training-script.py"
+    )
@@ -66,2 +75,3 @@ The following code sample shows the basic structure of a PyTorch estimator with
-        # For running a multi-node distributed training job, specify a value greater than 1
-        # Example: 2,3,4,..8
+    compute = Compute(
+        # For running a multi-node distributed training job, specify a value greater than 1
+        # Example: 2,3,4,..8
@@ -70 +80 @@ The following code sample shows the basic structure of a PyTorch estimator with
-        # Instance types supported by the SageMaker AI data parallel library: 
+        # Instance types supported by the SageMaker AI data parallel library: 
@@ -72 +82,9 @@ The following code sample shows the basic structure of a PyTorch estimator with
-        instance_type="ml.p4d.24xlarge",
+        instance_type="ml.p4d.24xlarge"
+    )
+    
+    pt_model_trainer = ModelTrainer(
+        training_image=training_image,
+        base_job_name="training_job_name_prefix",
+        source_code=source_code,
+        role="SageMakerRole",
+        compute=compute,
@@ -80 +98,3 @@ The following code sample shows the basic structure of a PyTorch estimator with
-    pt_estimator.fit("s3://bucket/path/to/training/data")
+    pt_model_trainer.train(input_data_config=[
+        InputData(channel_name="training", data_source="s3://bucket/path/to/training/data")
+    ])
@@ -99 +119 @@ For example, the tree-structured directory should look like the following.
-For more information about specifying the source directory to place the `requirements.txt` file along with your training script and a job submission, see [Using third-party libraries](https://sagemaker.readthedocs.io/en/stable/frameworks/pytorch/using_pytorch.html#id12) in the _Amazon SageMaker AI Python SDK documentation_.
+For more information about specifying the source directory to place the `requirements.txt` file along with your training script and a job submission, see [Using third-party libraries](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_train.html) in the _Amazon SageMaker AI Python SDK documentation_.
@@ -116 +136 @@ For more information about specifying the source directory to place the `require
-TensorFlow
+SageMaker Python SDK v2 (Legacy)
@@ -118,0 +139,50 @@ TensorFlow
+**PyTorch**
+
+The following launcher options are available for launching PyTorch distributed training.
+
+  * `pytorchddp` – This option runs `mpirun` and sets up environment variables needed for running PyTorch distributed training on SageMaker AI. To use this option, pass the following dictionary to the `distribution` parameter.
+    
+        { "pytorchddp": { "enabled": True } }
+
+  * `torch_distributed` – This option runs `torchrun` and sets up environment variables needed for running PyTorch distributed training on SageMaker AI. To use this option, pass the following dictionary to the `distribution` parameter.
+    
+        { "torch_distributed": { "enabled": True } }
+
+  * `smdistributed` – This option also runs `mpirun` but with `smddprun` that sets up environment variables needed for running PyTorch distributed training on SageMaker AI.
+    
+        { "smdistributed": { "dataparallel": { "enabled": True } } }
+
+
+
+
+The following code sample shows the basic structure of a PyTorch estimator with distributed training options.
+    
+    
+    from sagemaker.pytorch import PyTorch
+    
+    pt_estimator = PyTorch(
+        base_job_name="training_job_name_prefix",
+        source_dir="subdirectory-to-your-code",
+        entry_point="adapted-training-script.py",
+        role="SageMakerRole",
+        py_version="py310",
+        framework_version="2.0.1",
+    
+        # For running a multi-node distributed training job, specify a value greater than 1
+        # Example: 2,3,4,..8
+        instance_count=2,
+    
+        # Instance types supported by the SageMaker AI data parallel library: 
+        # ml.p4d.24xlarge, ml.p4de.24xlarge
+        instance_type="ml.p4d.24xlarge",
+    
+        # Activate distributed training with SMDDP
+        distribution={ "pytorchddp": { "enabled": True } }  # mpirun, activates SMDDP AllReduce OR AllGather
+        # distribution={ "torch_distributed": { "enabled": True } }  # torchrun, activates SMDDP AllGather
+        # distribution={ "smdistributed": { "dataparallel": { "enabled": True } } }  # mpirun, activates SMDDP AllReduce OR AllGather
+    )
+    
+    pt_estimator.fit("s3://bucket/path/to/training/data")
+
+**TensorFlow**
+
@@ -127 +197 @@ The SMDDP library discontinued support for TensorFlow and is no longer available
-        base_job_name = "training_job_name_prefix",
+        base_job_name = "training_job_name_prefix",
@@ -133 +203 @@ The SMDDP library discontinued support for TensorFlow and is no longer available
-        # For running a multi-node distributed training job, specify a value greater than 1
+        # For running a multi-node distributed training job, specify a value greater than 1
@@ -137,2 +207,2 @@ The SMDDP library discontinued support for TensorFlow and is no longer available
-        # Instance types supported by the SageMaker AI data parallel library: 
-        # ml.p4d.24xlarge, ml.p3dn.24xlarge, and ml.p3.16xlarge
+        # Instance types supported by the SageMaker AI data parallel library: 
+        # ml.p4d.24xlarge, ml.p3dn.24xlarge, and ml.p3.16xlarge
@@ -141,2 +211,2 @@ The SMDDP library discontinued support for TensorFlow and is no longer available
-        # Training using the SageMaker AI data parallel distributed training strategy
-        distribution=**{ "smdistributed": { "dataparallel": { "enabled": True } } }**
+        # Training using the SageMaker AI data parallel distributed training strategy
+        distribution={ "smdistributed": { "dataparallel": { "enabled": True } } }