

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 支援的架構 AWS 區域和執行個體類型
<a name="distributed-data-parallel-support"></a>

使用 SageMaker AI 分散式資料平行處理 (SMDDP) 程式庫之前，請檢查支援的 ML 架構和執行個體類型，以及 AWS 您的帳戶和 中是否有足夠的配額 AWS 區域。

## 支援的架構
<a name="distributed-data-parallel-supported-frameworks"></a>

下表顯示 SageMaker AI 和 SMDDP 支援的深度學習架構及其版本。SMDDP 程式庫可在 [SageMaker AI 架構容器](https://github.com/aws/deep-learning-containers/blob/master/available_images.md#sagemaker-framework-containers-sm-support-only)中使用、整合在 [SageMaker 模型平行化 (SMP) 程式庫 v2 發佈的 Docker 容器](distributed-model-parallel-support-v2.md#distributed-model-parallel-supported-frameworks-v2)中，也可下載為二進位檔案。

**注意**  
若要檢查 SMDDP 程式庫的最新更新和版本備註，請參閱[SageMaker AI 資料平行化程式庫版本備註](data-parallel-release-notes.md)。

**Topics**
+ [PyTorch](#distributed-data-parallel-supported-frameworks-pytorch)
+ [PyTorch Lightning](#distributed-data-parallel-supported-frameworks-lightning)
+ [Hugging Face 轉換器](#distributed-data-parallel-supported-frameworks-transformers)
+ [TensorFlow (已棄用)](#distributed-data-parallel-supported-frameworks-tensorflow)

### PyTorch
<a name="distributed-data-parallel-supported-frameworks-pytorch"></a>


| PyTorch 版本 | SMDDP 程式庫版本 | 預先安裝 SMDDP 的 SageMaker AI 架構容器映像檔 | 預先安裝 SMDDP 的 SMP Docker 映像檔 | 二進位檔案的網址\$1\$1 | 
| --- | --- | --- | --- | --- | 
| v2.3.1 | smdistributed-dataparallel==v2.5.0 | 不適用 | 658645717510.dkr.ecr.<us-west-2>.amazonaws.com/smdistributed-modelparallel:2.4.1-gpu-py311-cu121 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/2.4.1/cu121/2024-10-09/smdistributed\$1dataparallel-2.5.0-cp311-cp311-linux\$1x86\$164.whl | 
| v2.3.0 | smdistributed-dataparallel==v2.3.0 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:2.3.0-gpu-py311-cu121-ubuntu20.04-sagemaker | 目前無法使用 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/2.3.0/cu121/2024-05-23/smdistributed\$1dataparallel-2.3.0-cp311-cp311-linux\$1x86\$164.whl | 
| v2.2.0 | smdistributed-dataparallel==v2.2.0 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:2.2.0-gpu-py310-cu121-ubuntu20.04-sagemaker | 658645717510.dkr.ecr.<region>.amazonaws.com/smdistributed-modelparallel:2.2.0-gpu-py310-cu121 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/2.2.0/cu121/2024-03-04/smdistributed\$1dataparallel-2.2.0-cp310-cp310-linux\$1x86\$164.whl | 
| 2.1.0 版 | smdistributed-dataparallel==v2.1.0 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:2.1.0-gpu-py310-cu121-ubuntu20.04-sagemaker | 658645717510.dkr.ecr.<region>.amazonaws.com/smdistributed-modelparallel:2.1.2-gpu-py310-cu121 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/2.1.0/cu121/2024-02-04/smdistributed\$1dataparallel-2.1.0-cp310-cp310-linux\$1x86\$164.whl | 
| v2.0.1 | smdistributed-dataparallel==v2.0.1 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:2.0.1-gpu-py310-cu118-ubuntu20.04-sagemaker | 不適用 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/2.0.1/cu118/2023-12-07/smdistributed\$1dataparallel-2.0.2-cp310-cp310-linux\$1x86\$164.whl | 
| v2.0.0 | smdistributed-dataparallel==v1.8.0 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:2.0.0-gpu-py310-cu118-ubuntu20.04-sagemaker | 不適用 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/2.0.0/cu118/2023-03-20/smdistributed\$1dataparallel-1.8.0-cp310-cp310-linux\$1x86\$164.whl | 
| V1.13.1 | smdistributed-dataparallel==v1.7.0 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:1.13.1-gpu-py39-cu117-ubuntu20.04-sagemaker | 不適用 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/1.13.1/cu117/2023-01-09/smdistributed\$1dataparallel-1.7.0-cp39-cp39-linux\$1x86\$164.whl | 
| v1.12.1 | smdistributed-dataparallel==v1.6.0 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:1.12.1-gpu-py38-cu113-ubuntu20.04-sagemaker | 不適用 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/1.12.1/cu113/2022-12-05/smdistributed\$1dataparallel-1.6.0-cp38-cp38-linux\$1x86\$164.whl | 
| v1.12.0 | smdistributed-dataparallel==v1.5.0 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:1.12.0-gpu-py38-cu113-ubuntu20.04-sagemaker | 不適用 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/1.12.0/cu113/2022-07-01/smdistributed\$1dataparallel-1.5.0-cp38-cp38-linux\$1x86\$164.whl | 
| v1.11.0 | smdistributed-dataparallel==v1.4.1 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:1.11.0-gpu-py38-cu113-ubuntu20.04-sagemaker | 不適用 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/1.11.0/cu113/2022-04-14/smdistributed\$1dataparallel-1.4.1-cp38-cp38-linux\$1x86\$164.whl | 

\$1\$1 二進位檔案的 URL 用於在自訂容器中安裝 SMDDP 程式庫。如需詳細資訊，請參閱[使用 SageMaker AI 分散式資料平行程式庫建立您自己的 Docker 容器](data-parallel-bring-your-own-container.md)。

**注意**  
SMDDP 程式庫可在 AWS 區域 [SageMaker AI Framework Containers](https://github.com/aws/deep-learning-containers/blob/master/available_images.md#sagemaker-framework-containers-sm-support-only) 和 [SMP Docker 映像](distributed-model-parallel-support-v2.md)正在使用的 中使用。

**注意**  
SMDDP 程式庫 v1.4.0 和更新版本可做為 PyTorch 分散式 (torch.distributed) 資料平行化 (torch.parallel.DistributedDataParallel) 的後端。根據這項變更，下列適用於 PyTorch 分散式套件的[小型分散式 API](https://sagemaker.readthedocs.io/en/stable/api/training/sdp_versions/latest/smd_data_parallel_pytorch.html#pytorch-api) 已停用。  
`smdistributed.dataparallel.torch.distributed` 已棄用。請改用 [torch.distributed](https://pytorch.org/docs/stable/distributed.html) 套件。
`smdistributed.dataparallel.torch.parallel.DistributedDataParallel` 已棄用。請改用 [torch.nn.parallel.DistributedDataParallel](https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html) API。
如果您需要使用舊版本程式庫 (v1.3.0 或更新版本)，請參閱 *SageMaker AI Python SDK 文件*中的[封存 SageMaker AI 分散式資料平行化文件](https://sagemaker.readthedocs.io/en/stable/api/training/sdp_versions/latest.html#documentation-archive)。

### PyTorch Lightning
<a name="distributed-data-parallel-supported-frameworks-lightning"></a>

SMDDP 程式庫可用於以下適用於 PyTorch 的 SageMaker AI 架構容器和 SMP Docker 容器中的 PyTorch Lightning。

**PyTorch Lightning v2**


| PyTorch Lightning 版本 | PyTorch 版本 | SMDDP 程式庫版本 | 預先安裝 SMDDP 的 SageMaker AI 架構容器映像檔 | 預先安裝 SMDDP 的 SMP Docker 映像檔 | 二進位檔案的網址\$1\$1 | 
| --- | --- | --- | --- | --- | --- | 
| 2.2.5 | 2.3.0 | smdistributed-dataparallel==v2.3.0 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:2.3.0-gpu-py311-cu121-ubuntu20.04-sagemaker | 目前無法使用 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/2.3.0/cu121/2024-05-23/smdistributed\$1dataparallel-2.3.0-cp311-cp311-linux\$1x86\$164.whl | 
| 2.2.0 | 2.2.0 | smdistributed-dataparallel==v2.2.0 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:2.2.0-gpu-py310-cu121-ubuntu20.04-sagemaker | 658645717510.dkr.ecr.<region>.amazonaws.com/smdistributed-modelparallel:2.2.0-gpu-py310-cu121 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/2.2.0/cu121/2024-03-04/smdistributed\$1dataparallel-2.2.0-cp310-cp310-linux\$1x86\$164.whl | 
| 2.1.2 | 2.1.0 | smdistributed-dataparallel==v2.1.0 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:2.1.0-gpu-py310-cu121-ubuntu20.04-sagemaker | 658645717510.dkr.ecr.<region>.amazonaws.com/smdistributed-modelparallel:2.1.2-gpu-py310-cu121 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/2.1.0/cu121/2024-02-04/smdistributed\$1dataparallel-2.1.0-cp310-cp310-linux\$1x86\$164.whl | 
| 2.1.0 | 2.0.1 | smdistributed-dataparallel==v2.0.1 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:2.0.1-gpu-py310-cu118-ubuntu20.04-sagemaker | 不適用 | https://smdataparallel.s3.amazonaws.com/binary/pytorch/2.0.1/cu118/2023-12-07/smdistributed\$1dataparallel-2.0.2-cp310-cp310-linux\$1x86\$164.whl | 

**PyTorch Lightning v1**


| PyTorch Lightning 版本 | PyTorch 版本 | SMDDP 程式庫版本 | 預先安裝 SMDDP 的 SageMaker AI 架構容器映像檔 | 二進位檔案 URL \$1\$1 | 
| --- | --- | --- | --- | --- | 
|  1.7.2 1.7.0 1.6.4 1.6.3 1.5.10  | 1.12.0 | smdistributed-dataparallel==v1.5.0 | 763104351884.dkr.ecr.<region>.amazonaws.com/pytorch-training:1.12.0-gpu-py38-cu113-ubuntu20.04-sagemaker | https://smdataparallel.s3.amazonaws.com/binary/pytorch/1.12.0/cu113/2022-07-01/smdistributed\$1dataparallel-1.5.0-cp38-cp38-linux\$1x86\$164.whl | 

\$1\$1 二進位檔案的 URL 用於在自訂容器中安裝 SMDDP 程式庫。如需詳細資訊，請參閱[使用 SageMaker AI 分散式資料平行程式庫建立您自己的 Docker 容器](data-parallel-bring-your-own-container.md)。

**注意**  
PyTorch Lightning 及公用程式程式庫 (例如 Lightning Bolts) 未預先安裝於 PyTorch DLC。在[步驟 2](https://docs.aws.amazon.com/sagemaker/latest/dg/data-parallel-use-api.html#data-parallel-framework-estimator) 建構 SageMaker AI PyTorch 估算器並提交訓練任務請求時，您必須提供 `requirements.txt`，以在 SageMaker AI PyTorch 訓練容器中安裝 `pytorch-lightning` 與 `lightning-bolts`。  

```
# requirements.txt
pytorch-lightning
lightning-bolts
```
如需指定來源目錄以放置 `requirements.txt` 檔案和訓練指令碼以及工作提交的更多相關資訊，請參閱 *Amazon SageMaker AI Python SDK 文件*中的[使用第三方程式庫](https://sagemaker.readthedocs.io/en/stable/frameworks/pytorch/using_pytorch.html#id12)。

### Hugging Face 轉換器
<a name="distributed-data-parallel-supported-frameworks-transformers"></a>

適用於 Hugging Face 的 AWS 深度學習容器使用適用於 PyTorch 和 TensorFlow 的 SageMaker 訓練容器作為其基礎映像。若要查詢 Hugging Face 轉換器程式庫版本及配對的 PyTorch 和 TensorFlow 版本，請參閱最新的 [Hugging Face 容器](https://github.com/aws/deep-learning-containers/blob/master/available_images.md#huggingface-training-containers)和[先前的 Hugging Face 容器版本](https://github.com/aws/deep-learning-containers/blob/master/available_images.md#prior-hugging-face-container-versions)。

### TensorFlow (已棄用)
<a name="distributed-data-parallel-supported-frameworks-tensorflow"></a>

**重要**  
SMDDP 程式庫已停止對 TensorFlow 的支援，且不再於 v2.11.0 之後的 TensorFlow DLC 中提供。下表列出已安裝 SMDDP 程式庫的舊版 TensorFlow DLC。


| TensorFlow 版本 | SMDDP 程式庫版本 | 
| --- | --- | 
| 2.9.1、2.10.1、2.11.0 |  smdistributed-dataparallel==v1.4.1  | 
| 2.8.3 |  smdistributed-dataparallel==v1.3.0  | 

## AWS 區域
<a name="distributed-data-parallel-availablity-zone"></a>

SMDDP 程式庫可在 SageMaker AI 的 AWS 區域 深度學習容器和 [SMP Docker 映像](distributed-model-parallel-support-v2.md)正在使用的所有 中使用。 [AWS SageMaker ](https://github.com/aws/deep-learning-containers/blob/master/available_images.md#sagemaker-framework-containers-sm-support-only) 

## 支援的執行個體類型
<a name="distributed-data-parallel-supported-instance-types"></a>

SMDDP 程式庫需要下列其中一種執行個體類型。


| 執行個體類型 | 
| --- | 
| ml.p3dn.24xlarge\$1 | 
| ml.p4d.24xlarge | 
| ml.p4de.24xlarge | 

**提示**  
若要在已啟用 EFA 的執行個體類型上正確執行分散式訓練，您應該透過設定 VPC 的安全群組來啟用執行個體之間的流量，以允許進出安全群組本身的所有傳入和傳出流量。若要了解如何設定安全群組規則，請參閱《Amazon EC2 使用者指南》**中的[步驟 1：準備啟用 EFA 的安全群組](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa-start.html#efa-start-security)。

**重要**  
\$1 SMDDP 程式庫已停止支援在 P3 執行個體上最佳化其集體通訊操作。雖然您仍然可以在 `ml.p3dn.24xlarge` 執行個體上利用 SMDDP 最佳化的 `AllReduce` 集體，但將不再提供進一步的開發支援來增強此執行個體類型的效能。請注意，SMDDP 最佳化的 `AllGather` 集體僅適用於 P4 執行個體。

如需執行個體類型的空間，請參閱 [Amazon EC2 執行個體類型頁面](https://aws.amazon.com/ec2/instance-types/)中的**加速運算**區段。有關執行個體定價資訊，請參閱 [Amazon SageMaker 定價](https://aws.amazon.com/sagemaker/pricing/)。

如果您遇到類似下列內容的錯誤訊息，請按照[請求 SageMaker AI 資源服務配額增加](https://docs.aws.amazon.com/sagemaker/latest/dg/regions-quotas.html#service-limit-increase-request-procedure)的指示進行操作。

```
ResourceLimitExceeded: An error occurred (ResourceLimitExceeded) when calling
the CreateTrainingJob operation: The account-level service limit 'ml.p3dn.24xlarge
for training job usage' is 0 Instances, with current utilization of 0 Instances
and a request delta of 1 Instances.
Please contact AWS support to request an increase for this limit.
```