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 réponse
0
Réponse acceptée

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
EXPERT
répondu il y a 4 mois
  • 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.

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions