

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

# 大型模型推理的 SageMaker AI 端点参数
<a name="large-model-inference-hosting"></a>

 您可以自定义以下参数，以协助使用 SageMaker AI 进行低延迟的大型模型推理（LMI）：
+  **实例上的最大 Amazon EBS 卷大小 (`VolumeSizeInGB`)** – 如果模型的大小大于 30 GB，并且您使用的实例没有本地磁盘，则应将此参数增加到略大于模型的大小。
+  **运行状况检查超时限额 (`ContainerStartupHealthCheckTimeoutInSeconds`)** – 如果您的容器设置正确，且 CloudWatch 日志指示运行状况检查超时，则应增加此限额，以便容器有足够的时间来响应运行状况检查。
+  **模型下载超时限额 (`ModelDataDownloadTimeoutInSeconds`)** – 如果您的模型大小大于 40 GB，则应增加此限额，以便有足够的时间将模型从 Amazon S3 下载到实例。

以下代码片段演示了如何以编程方式配置上述参数。请将示例中的*斜体占位符文本*替换为您自己的信息。

```
import boto3

aws_region = "aws-region"
sagemaker_client = boto3.client('sagemaker', region_name=aws_region)

# The name of the endpoint. The name must be unique within an AWS Region in your AWS account.
endpoint_name = "endpoint-name"

# Create an endpoint config name.
endpoint_config_name = "endpoint-config-name"

# The name of the model that you want to host.
model_name = "the-name-of-your-model"

instance_type = "instance-type"

sagemaker_client.create_endpoint_config(
    EndpointConfigName = endpoint_config_name
    ProductionVariants=[
        {
            "VariantName": "variant1", # The name of the production variant.
            "ModelName": model_name,
            "InstanceType": instance_type, # Specify the compute instance type.
            "InitialInstanceCount": 1, # Number of instances to launch initially.
            "VolumeSizeInGB": 256, # Specify the size of the Amazon EBS volume.
            "ModelDataDownloadTimeoutInSeconds": 1800, # Specify the model download timeout in seconds.
            "ContainerStartupHealthCheckTimeoutInSeconds": 1800, # Specify the health checkup timeout in seconds
        },
    ],
)

sagemaker_client.create_endpoint(EndpointName=endpoint_name, EndpointConfigName=endpoint_config_name)
```

 有关 `ProductionVariants` 键的更多信息，请参阅 [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ProductionVariant.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ProductionVariant.html)。

有关如何利用大型模型实现低延迟推理的示例，请参阅 aws-samples GitHub 存储库中的 [Amazon SageMaker AI 上的生成式人工智能推理示例](https://github.com/aws-samples/sagemaker-genai-hosting-examples/tree/main)。