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).

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ