如何将重新训练的 Sagemaker 模型部署到端点?

How can I deploy a re-trained Sagemaker model to an endpoint?

有了sagemaker.estimator.Estimator,我想在重新训练后重新deploy一个模型(用新数据调用fit)。

当我调用这个

estimator.deploy(initial_instance_count=1, instance_type='ml.m5.xlarge')

我收到一个错误

botocore.exceptions.ClientError: An error occurred (ValidationException) 
when calling the CreateEndpoint operation: 
Cannot create already existing endpoint "arn:aws:sagemaker:eu-east- 
1:1776401913911:endpoint/zyx".

显然我想使用像 UpdateEndpoint 这样的功能。如何从 API?

访问该功能

是的,model.deploy 在幕后创建了一个模型、一个端点配置和一个端点。当您从 already-deployed 训练有素的估算器再次调用该方法时,它将产生错误,因为 similarly-configured 端点已经部署。我鼓励你尝试什么:

  • 使用update_endpoint=True参数。来自 SageMaker SDK doc“此外,可以将链接到您的模型的不同端点配置部署到现有的 SageMaker 端点。这可以通过指定现有的 endpoint_name 参数的端点名称以及 update_endpoint 参数在您的 deploy() 调用中为真。"

  • 或者,如果您想创建一个单独的模型,您可以在 deploy

    中指定一个新的 model_name