

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

# Neptune ML 階段的執行個體選擇
<a name="machine-learning-on-graphs-instance-selection"></a>

Neptune ML 處理的不同階段使用不同的 SageMaker AI 執行個體。在此，我們討論如何為每個階段選擇正確的執行個體類型。您可以在 Amazon SageMaker 定價中找到 SageMaker AI 執行個體類型和定價的相關資訊。 [Amazon SageMaker ](https://aws.amazon.com/sagemaker/pricing/)

## 選取執行個體進行資料處理
<a name="machine-learning-on-graphs-processing-instance-size"></a>

SageMaker AI [資料處理](machine-learning-on-graphs-processing.md)步驟需要一個[處理執行個體](https://docs.aws.amazon.com/sagemaker/latest/dg/processing-job.html)，該執行個體具有足夠的記憶體和磁碟儲存空間，可用於輸入、中繼和輸出資料。所需的特定記憶體和磁碟儲存體容量取決於 Neptune ML 圖形的特性及其匯出的特徵。

根據預設，Neptune ML 會選擇其記憶體十倍於磁碟上所匯出圖形資料大小的最小 `ml.r5` 執行個體。

## 選取執行個體進行模型訓練和模型轉換
<a name="machine-learning-on-graphs-training-transform-instance-size"></a>

選取正確的執行個體類型進行[模型訓練](https://docs.aws.amazon.com/sagemaker/latest/dg/how-it-works-training.html)或[模型轉換](https://docs.aws.amazon.com/sagemaker/latest/dg/how-it-works-batch.html)，取決於任務類型、圖形大小和您的周轉需求。GPU 執行個體可提供最佳效能。我們通常建議 `p3` 和 `g4dn` 序列執行個體。您也可以使用 `p2` 或 `p4d` 執行個體。

根據預設，Neptune ML 會選擇其記憶體超過模型訓練和模型轉換所需的最小 GPU 執行個體。您可以在 Amazon S3 資料處理輸出位置的 `train_instance_recommendation.json` 檔案中找到該選擇的內容。以下是 `train_instance_recommendation.json` 檔案的內容範例：

```
{ 
  "instance":     "(the recommended instance type for model training and transform)",
  "cpu_instance": "(the recommended instance type for base processing instance)", 
  "disk_size":    "(the estimated disk space required)",
  "mem_size":     "(the estimated memory required)"
}
```

## 為推論端點選取執行個體
<a name="machine-learning-on-graphs-inference-endpoint-instance-size"></a>

為[推論端點](machine-learning-on-graphs-inference-endpoint.md)選取正確的執行個體類型，取決於任務類型、圖形大小和預算。根據預設，Neptune ML 會選擇其記憶體超過推論端點所需的最小`ml.m5d`執行個體。

**注意**  
如果需要超過 384 GB 的記憶體，Neptune ML 會使用 `ml.r5d.24xlarge` 執行個體。

您可以在 `infer_instance_recommendation.json` 檔案中查看 Neptune ML 建議的執行個體類型，此檔案位於您用於模型訓練的 Amazon S3 位置。以下是該檔案的內容範例：

```
{ 
  "instance" :   "(the recommended instance type for an inference endpoint)",
  "disk_size" :  "(the estimated disk space required)",
  "mem_size" :   "(the estimated memory required)"
}
```