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

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

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

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

관련 콘텐츠