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 réponse
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
EXPERT
répondu il y a 4 mois
  • 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).

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions