【问题标题】:Updating Sagemaker Endpoint with new Endpoint Configuration使用新的端点配置更新 Sagemaker 端点
【发布时间】:2020-07-11 01:19:50
【问题描述】:

对 Sagemaker 重新训练模型的自动化有点困惑。

目前我有一个带有 Sagemaker LinearLerner 模型的笔记本实例,用于执行分类任务。因此,我使用Estimator 进行训练,然后部署创建Endpoint 的模型。之后使用Lambda 函数调用此端点,我将其添加到API Gateway 接收可用于POST 请求并带回响应的api 端点。

现在我面临着再培训的问题。为此,我使用serverless 方法和lambda 函数获取 training_jobs 的环境变量。但是 Sagemaker 不允许重写训练作业并且只能创建新作业的问题。我的目标是在新的训练作业和新的端点配置将应用于现有端点时自动化部分,我不需要在 API 网关中更改任何内容。是否有可能以某种方式自动将新的端点配置附加到现有端点?

谢谢

【问题讨论】:

    标签: python endpoint amazon-sagemaker


    【解决方案1】:

    如果我对问题的理解正确,您应该可以在培训工作快结束时使用CreateEndpointConfig,然后使用UpdateEndpoint

    Deploys the new EndpointConfig specified in the request, switches to using newly created endpoint, and then deletes resources provisioned for the endpoint using the previous EndpointConfig (there is no availability loss).

    如果 API Gateway / Lambda 通过端点 ARN 路由,则在使用 UpdateEndpoint 后不应更改。

    【讨论】:

      【解决方案2】:

      是的,使用UpdateEndpoint 端点。但是,如果您使用的是 Python Sagemaker SDK,请注意,可能会有一些文档浮动要求您调用

      model.deploy(..., update_endpoint=True)
      

      这在 Sagemaker SDK 的 v2 中显然已被弃用:

      您应该改用Predictor class to perform this update

      from sagemaker.predictor import Predictor
      predictor = Predictor(endpoint_name="YOUR-ENDPOINT-NAME", sagemaker_session=sagemaker_session_object)
      predictor.update_endpoint(instance_type="ml.t2.large", initial_instance_count=1)
      

      【讨论】:

      • 无法将模型注册表中的模型版本传递给预测器,那么预测器如何知道在模型包组中使用哪个模型版本?
      猜你喜欢
      • 2022-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-04
      • 1970-01-01
      • 1970-01-01
      • 2017-07-26
      相关资源
      最近更新 更多