本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
您可以自定义以下参数,以便利用 AI 实现低延迟的大型模型推理 (LMI): SageMaker
-
实例上的最大 Amazon EBS 卷大小 (
VolumeSizeInGB
) – 如果模型的大小大于 30 GB,并且您使用的实例没有本地磁盘,则应将此参数增加到略大于模型的大小。 -
He@@ alth check 超时配额 (
ContainerStartupHealthCheckTimeoutInSeconds
) — 如果您的容器设置正确,并且 CloudWatch 日志显示运行状况检查超时,则应增加此配额,以便容器有足够的时间来响应运行状况检查。 -
模型下载超时限额 (
ModelDataDownloadTimeoutInSeconds
) – 如果您的模型大小大于 40 GB,则应增加此限额,以便有足够的时间将模型从 Amazon S3 下载到实例。
以下代码片段演示了如何以编程方式配置上述参数。将示例italicized placeholder
text
中的替换为您自己的信息。
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
键的更多信息,请参阅 ProductionVariant
。
有关演示如何使用大型模型实现低延迟推理的示例,请参阅 aw GitHub s-samples 存储库中的 Amazon AI 上的生成式 SageMaker AI 推理示例