Using MLOPS template with custom inference code

0

Hi MLOps Gurus,

I'd like to seek guidance on my below situation.

I am currently working on a Sagemaker project where I'm using the MLOPS template for model building, training, and deployment. I trained the model using the sklearn framework and registered it in the model registry. However, while creating the model deployment pipeline, I faced an issue with the default cloudformation template resources. Specifically, when attempting to use both the ModelPackageName and custom image as parameters for the model creation, I encountered an error. I discovered that Sagemaker expects a "ModelDataUrl" parameter when using a custom image.

Default Clouformation template:

Resources:
  Model:
    Type: AWS::SageMaker::Model
    Properties:
      Containers:
         - ModelPackageName: !Ref ModelPackageName
      ExecutionRoleArn: !Ref ModelExecutionRoleArn

How I modified:

Resources:
  Model:
    Type: AWS::SageMaker::Model
    Properties:
      Containers:
         - 
           Image: !Ref ImageURI
           ModelDataUrl: !Ref ModelData
           Mode: SingleModel #This defaults to single model change to "MultiModel" for MME
           Environment: {"SAGEMAKER_PROGRAM": "inference.py", 
                         "SAGEMAKER_SUBMIT_DIRECTORY": !Ref ModelData}
      ExecutionRoleArn: !Ref ModelExecutionRoleArn
                       

My question is: How can I retrieve the trained model from codebuild pipeline and add "ModelDataUrl" parameter and dynamically pass it to the endpoint-config cloudformation template every time I execute the pipeline?

Please guide me the steps to progress, thank you!

沒有答案

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

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

回答問題指南