How to add custom metadata to a model in model registry via sagemaker pipeline step?

0

based on sagemaker python sdk , i can add custom/customer metadata via (sample code below). i am planning to use sagemaker model step and register the model in a model package group and create an end to end pipeline. is it possible to add these metadata at the time of model creation or registering model ?

boto3.client('sagemaker').update_model_package( ... 
CustomerMetadataProperties = {'key1': 'value1', 'key2': 'value2'})
已提問 1 年前檢視次數 635 次
1 個回答
1
已接受的答案

Yes, it is possible. You can add custom metadata when you use the register method of the Model object in the SageMaker SDK. The Model step from SageMaker Pipelines can then be used together with this register method.

Below is a snippet of code copied from the example provided on this page, where I have added the custom_metadata_properties parameter with your example input.

register_model_step_args = pipeline_model.register(
    content_types=["application/json"],
   response_types=["application/json"],
   inference_instances=["ml.t2.medium", "ml.m5.xlarge"],
   transform_instances=["ml.m5.xlarge"],
   model_package_group_name="sipgroup",
   customer_metadata_properties={"key1": "value1", "key2": "value2"}
)

step_model_registration = ModelStep(
   name="AbaloneRegisterModel",
   step_args=register_model_step_args,
)
AWS
S_Moose
已回答 1 年前

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

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

回答問題指南