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!

답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인