Kei*_*thx 7 python endpoint amazon-sagemaker
与 Sagemaker 重新训练模型的自动化有点混淆。
目前我有一个带有 Sagemaker 模型的笔记本实例来LinearLerner执行分类任务。因此,Estimator我正在进行训练,然后部署模型创建Endpoint. 之后使用Lambda函数调用此端点,我将其添加到API Gateway接收 api 端点,该端点可用于 POST 请求并使用类发送回响应。
现在我面临着再培训的问题。为此,我使用serverless方法和lambda函数获取training_jobs的环境变量。但问题是Sagemaker不允许重写训练作业,你只能创建新的训练作业。我的目标是当新的训练作业和新的端点配置将应用于现有端点时自动化该部分,我不需要更改 API 网关中的任何内容。是否可以通过某种方式自动将新的端点配置附加到现有端点?
谢谢
是的,使用UpdateEndpoint端点。但是,如果您使用的是 Python Sagemaker SDK,请注意,可能会有一些文档要求您调用
model.deploy(..., update_endpoint=True)
Run Code Online (Sandbox Code Playgroud)
这显然在 Sagemaker SDK v2 中已被弃用:
您应该使用该类Predictor 来执行此更新:
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)
Run Code Online (Sandbox Code Playgroud)
如果我正确理解了这个问题,您应该能够在训练作业结束时使用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 网关/Lambda 通过端点 ARN 路由,则在使用UpdateEndpoint.
| 归档时间: |
|
| 查看次数: |
6520 次 |
| 最近记录: |