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!

没有答案

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则