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 Respuesta
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
EXPERTO
respondido hace 4 meses
  • 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).

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas