Automatically detect and deploy the latest sagemaker model on sagemaker model registry to the endpoint. Value addition: replace/update the existing endpoint (with same name)

1

Hi,

I have a sagemaker pipeline (training pipeline) which creates a new version of the ML model on a periodical basis with retraining and pushes that version to model registry inside a studio. I want a deployment pipeline to automatically pick the latest model version from sagemaker model registry and deploy the model into an endpoint. I would like to know the full details of the deployment pipeline (services and generic script).

If you can also suggest me how to update/replace the existing older endpoint with the new one (or may be replacing the older model within the existing endpoint with the new model version) it would be a great value addition! The only constraint here is that the endpoint name should be same (say 'delivery-model-latest')

1 個回答
0
已接受的答案

Hi,

AWS SageMaker list-models ( see https://awscli.amazonaws.com/v2/documentation/api/latest/reference/sagemaker/list-models.html for CLI version - See https://boto3.amazonaws.com/v1/documentation/api/1.26.98/reference/services/sagemaker/client/list_models.html for Python) will allow you to list all models.

There is a sort-by parameter with which you can sort by creationTime.

Re. update, you can add you new model and remove the oldest one by following https://docs.aws.amazon.com/sagemaker/latest/dg/add-models-to-endpoint.html

If you need to be more sophisticated (blue/green deployment, etc.), please follow https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateEndpoint.html

Finally, best practices for model deployment: https://docs.aws.amazon.com/sagemaker/latest/dg/deployment-best-practices.html

Best,

Didier

profile pictureAWS
專家
已回答 4 個月前
  • How to 'automatically' implement this? In other words, how would the deployment pipeline know that a recent model has appeared in model registry?

    Re. update, how to replace the first version with the second (I don't want two models at a time in the endpoint)?

  • Hi, you pipeline (after it created a new model) has to list the models active behind the endpoint. Then, using the creation time of such models, the pipeline removes the oldest model and replaces it with the newly created one.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南