

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Amazon SageMaker HyperPod クラスターのトレーニングプラン使用率
<a name="training-plan-utilization-for-hyperpod"></a>

Amazon SageMaker HyperPod クラスターに SageMaker トレーニングプランを使用するには、クラスターを作成または更新する際にクラスターインスタンスレベルで使用するトレーニングプランを指定します。

**注記**  
HyperPod クラスターで使用するトレーニングプランのステータスは `Scheduled` または `Active` である必要があります。
クラスターの設定がトレーニングプランで指定されたアベイラビリティーゾーン (AZ) と一致していることを確認します。  
VPC のセットアップ、リソースの場所、セキュリティグループの設定については、SageMaker HyperPod ドキュメントの「[カスタム Amazon VPC で SageMaker HyperPod を設定する](sagemaker-hyperpod-prerequisites.md#sagemaker-hyperpod-prerequisites-optional-vpc)」を参照してください。  
Amazon FSx for Lustre を使用して HyperPod を設定する場合は、「[(オプション) Amazon FSx for Lustre で SageMaker HyperPod を設定する](sagemaker-hyperpod-prerequisites.md#sagemaker-hyperpod-prerequisites-optional-fsx)」で、リージョンと AZ の選択について理解し、VPC 設定要件を確認して、AZ 配置のベストプラクティスを理解しておきます。
インスタンスグループごとにプランを選択できます。ただし、クラスターのプライマリインスタンスグループにトレーニングプランを使用することはお勧めしません。プライマリノードには、トレーニングプランのキャパシティの固定期間や不連続になる可能性のある特質には沿わない、継続的かつ安定したリソースが必要であるためです。

**Topics**
+ [SageMaker AI コンソールを使用してトレーニングプランで SageMaker HyperPod クラスターを作成する](use-training-plan-for-hyperpod-creation-using-console.md)
+ [SageMaker AI コンソールを使用してトレーニングプランで SageMaker HyperPod クラスターを更新する](use-training-plan-for-hyperpod-update-using-console.md)
+ [SageMaker API を使用してトレーニングプランで SageMaker HyperPod クラスターを作成する、または AWS CLI](use-training-plan-for-hyperpod-creation-using-api-cli-sdk.md)
+ [SageMaker API を使用してトレーニングプランで SageMaker HyperPod クラスターを更新する、または AWS CLI](use-training-plan-for-hyperpod-update-using-api-cli-sdk.md)

# SageMaker AI コンソールを使用してトレーニングプランで SageMaker HyperPod クラスターを作成する
<a name="use-training-plan-for-hyperpod-creation-using-console"></a>

SageMaker AI コンソール UI からトレーニングプランを使用して SageMaker HyperPod クラスターを作成するには、次の手順に従います。

1. SageMaker AI コンソール ([https://console.aws.amazon.com/sagemaker/](https://console.aws.amazon.com/sagemaker/)) に移動します。

1. 左側のナビゲーションペインで **[Hyperpod]**、**[クラスターを作成]** の順に選択します。

1. インスタンスグループを設定する際は、コンピューティングキャパシティのニーズに合ったプランを選択できます。

![\[SageMaker HyperPod クラスター内にインスタンスグループを作成するためのモーダルウィンドウを表示する SageMaker AI コンソールインターフェイス フォームには、インスタンスグループ名、インスタンスタイプ、数量、インスタンスキャパシティ (オンデマンドプランとトレーニングプランのオプション付き)、作成時のライフサイクルスクリプトのディレクトリパスなどのフィールドが含まれています。\]](http://docs.aws.amazon.com/ja_jp/sagemaker/latest/dg/images/training-plans/tp-create-hyperpod-cluster.png)


クラスターを確認して作成します。トレーニングプランを使用するインスタンスグループは、トレーニングプランが `Active` になると、利用可能なキャパシティに応じて、指定されたターゲットインスタンス数までスケールアップします。各リザーブドキャパシティ期間が終了する 30 分前に、インスタンスグループはゼロインスタンスへのスケールダウンを開始します。このスケールダウン状態は、次のリザーブドキャパシティ期間が始まるか、プランが終了するまで維持されます。このプロセス全体を通して、正常なインスタンスグループは、現在のインスタンス数に関係なく、最初の作成後に `InService` ステータスを維持します。

# SageMaker AI コンソールを使用してトレーニングプランで SageMaker HyperPod クラスターを更新する
<a name="use-training-plan-for-hyperpod-update-using-console"></a>

SageMaker AI コンソール UI を使用して、既存の SageMaker HyperPod クラスターのトレーニングプランを更新、削除、または追加できます。SageMaker HyperPod クラスターのインスタンスグループを更新するには、次の手順に従います。

1. SageMaker AI コンソール ([https://console.aws.amazon.com/sagemaker/](https://console.aws.amazon.com/sagemaker/)) に移動します。

1. 左側のナビゲーションペインで、**[Hyperpod]** を選択します。

1. クラスター名に関連付けられたハイパーリンクを使用して、クラスターの詳細ページに移動します。

1. インスタンスグループを設定する際は、コンピューティングキャパシティのニーズに合ったプランを選択できます。

![\[SageMaker HyperPod クラスター内のインスタンスグループを更新するためのモーダルウィンドウを表示する SageMaker AI コンソールインターフェイス フォームには、インスタンスグループ名、インスタンスタイプ、数量、インスタンスキャパシティ (オンデマンドプランとトレーニングプランのオプション付き)、作成時のライフサイクルスクリプトのディレクトリパスなどのフィールドが含まれています。\]](http://docs.aws.amazon.com/ja_jp/sagemaker/latest/dg/images/training-plans/tp-update-hyperpod-clusters.png)


クラスターを確認して更新します。

# SageMaker API を使用してトレーニングプランで SageMaker HyperPod クラスターを作成する、または AWS CLI
<a name="use-training-plan-for-hyperpod-creation-using-api-cli-sdk"></a>

Amazon SageMaker HyperPod クラスターで SageMaker トレーニングプランを使用するには、[https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateCluster.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateCluster.html) オペレーションを呼び出す際に、[https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ClusterInstanceGroupSpecification.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ClusterInstanceGroupSpecification.html) の [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ClusterInstanceGroupSpecification.html#sagemaker-Type-ClusterInstanceGroupSpecification-TrainingPlanArn](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ClusterInstanceGroupSpecification.html#sagemaker-Type-ClusterInstanceGroupSpecification-TrainingPlanArn) パラメータで使用するトレーニングプランの ARN を指定します。

プランの指定された AZ に関連付けられたサブネットが、クラスターの設定の `VPCConfig` に含まれていることを確認します。[``DescribeTrainingPlan](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeTrainingPlan.html) API コールのレスポンスでトレーニングプランの `AvailabilityZone` を取得できます。

次のサンプルは、新しい SageMaker HyperPod クラスターを作成し、 `create-cluster` AWS CLI コマンドの `--instance-groups` 属性でインスタンスグループにトレーニングプランを提供する方法を示しています。

```
# Create a cluster         
aws sagemaker create-cluster \
  --cluster-name cluster-name \
  --instance-groups '[ \
        { \
            "InstanceCount": 1,\
            "InstanceGroupName": "controller-nodes",\
            "InstanceType": "ml.t3.xlarge",\
            "LifeCycleConfig": {"SourceS3Uri": source_s3_uri, "OnCreate": "on_create.sh"},\
            "ExecutionRole": "arn:aws:iam::customer_account_id:role/execution_role",\
            "ThreadsPerCore": 1,\
        },\
        { \
            "InstanceCount": 2, \
            "InstanceGroupName": "worker-nodes",\
            "InstanceType": "p4d.24xlarge",\
            "LifeCycleConfig": {"SourceS3Uri": source_s3_uri, "OnCreate": "on_create.sh"},\
            "ExecutionRole": "arn:aws:iam::customer_account_id}:role/execution_role}",\
            "ThreadsPerCore": 1,\
            "TrainingPlanArn": training_plan_arn,\
        }]'
```

を使用して HyperPod クラスターを作成する方法については AWS CLI、「」を参照してください[https://docs.aws.amazon.com/cli/latest/reference/sagemaker/create-cluster.html](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/create-cluster.html)。

クラスターを作成したら、`DescribeCluster` API を呼び出して、インスタンスグループにトレーニングプランから適切にキャパシティが割り当てられたことを喧噪できます。

```
aws sagemaker describe-cluster --cluster-name cluster-name
```

# SageMaker API を使用してトレーニングプランで SageMaker HyperPod クラスターを更新する、または AWS CLI
<a name="use-training-plan-for-hyperpod-update-using-api-cli-sdk"></a>

コマンドを使用して既存のクラスターのインスタンスグループを更新することで、トレーニングプランを追加、更新、または削除できます`update-cluster` AWS CLI 。次のサンプルは、SageMaker HyperPod クラスターを更新し、インスタンスグループに新しいトレーニングプランを提供する方法を説明しています。

```
# Update a cluster
aws sagemaker update-cluster \
  --cluster-name cluster-name \
  --instance-groups '[ \
        { \
            "InstanceCount": 1,\
            "InstanceGroupName": "controller-nodes",\
            "InstanceType": "ml.t3.xlarge",\
            "LifeCycleConfig": {"SourceS3Uri": source_s3_uri, "OnCreate": "on_create.sh"},\
            "ExecutionRole": "arn:aws:iam::customer_account_id:role/execution_role",\
            "ThreadsPerCore": 1,\
        },\
        { \
            "InstanceCount": 2, \
            "InstanceGroupName": "worker-nodes",\
            "InstanceType": "p4d.24xlarge",\
            "LifeCycleConfig": {"SourceS3Uri": source_s3_uri, "OnCreate": "on_create.sh"},\
            "ExecutionRole": "arn:aws:iam::customer_account_id}:role/execution_role}",\
            "ThreadsPerCore": 1,\
            "TrainingPlanArn": training_plan_arn,\
        },\
        {\
            "InstanceCount": 1,\
            "InstanceGroupName": "worker-nodes-2",\
            "InstanceType": "p4d.24xlarge",\
            "LifeCycleConfig": {"SourceS3Uri": source_s3_uri, "OnCreate": "on_create.sh"},\
            "ExecutionRole": "arn:aws:iam::customer_account_id:role/execution_role",\
            "ThreadsPerCore": 1,\
            "TrainingPlanArn": training_plan_arn,\
        }\
    ]'
```