

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Neptune ML 阶段的实例选择
<a name="machine-learning-on-graphs-instance-selection"></a>

Neptune ML 处理的不同阶段使用不同的 SageMaker AI 实例。在这里，我们将讨论如何为每个阶段选择合适的实例类型。您可以在 [Amazon SageMaker 定价](https://aws.amazon.com/sagemaker/pricing/)中找到有关 SageMaker AI 实例类型和定价的信息。

## 选择进行数据处理的实例
<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` 实例。

**注意**  
如果需要超过 384GB 的内存，Neptune ML 将使用 `ml.r5d.24xlarge` 实例。

您可以在位于您用于模型训练的 Amazon S3 位置的 `infer_instance_recommendation.json` 文件中查看 Neptune ML 推荐的实例类型。下面是该文件内容的示例：

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