unable to list models in the registry

0

I am using below code in sagemaker pipeline (pipeline.py) to register the model in step_register

model = Model( image_uri=container, model_data=step_training.properties.ModelArtifacts.S3ModelArtifacts, sagemaker_session=pipeline_session, #sagemaker_session=sagemaker_session, role=role, ) pipeline = Pipeline( name=f"RecommendationDevPipeline", parameters=[processing_instance_type, instance_count, input_data,model_approval_status], steps=[step_feature_engineering,step_training,step_register], sagemaker_session=pipeline_session, #sagemaker_session=sagemaker_session, )

I see model group and model versions on studio console. But unable to list models using below code once pipeline.py creates and registers a model to model registry

import boto3 client = boto3.client('sagemaker') response = client.list_models( #SortBy='Name'|'CreationTime', SortOrder='Descending', #NextToken='string', MaxResults=10 #NameContains='random-model'

)

1 回答
0

Hi,

You should start by following the syntax of https://boto3.amazonaws.com/v1/documentation/api/1.26.98/reference/services/sagemaker/client/list_models.html

response = client.list_models(
    SortBy='Name'|'CreationTime',
    SortOrder='Ascending'|'Descending',
    NextToken='string',
    MaxResults=123,
    NameContains='string',
    CreationTimeBefore=datetime(2015, 1, 1),
    CreationTimeAfter=datetime(2015, 1, 1)
)

Then you can incrementally add and remove parameters from a working example to implement the filtering on name, date, etc. that you need.

Best,

Didier

profile pictureAWS
专家
已回答 4 个月前
  • Hi, the same syntax has already been followed. The problem is that I am able to list models which are built through sagemaker notebooks but unable to list models which are build through sagemaker studio pipeline (a part of the pipeline.py code is mentioned above).

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

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

回答问题的准则

相关内容