Aggiornamento dei dettagli di una versione del modello - Amazon SageMaker AI

Aggiornamento dei dettagli di una versione del modello

Puoi visualizzare e aggiornare i dettagli di una versione specifica del modello utilizzando AWS SDK per Python (Boto3) o la console di Amazon SageMaker Studio.

Importante

Amazon SageMaker AI integra le schede del modello nel registro dei modelli. Un pacchetto di modelli registrato nel registro dei modelli include come componente una scheda del modello semplificata. Per ulteriori informazioni, consulta Schema della scheda del modello del pacchetto di modelli (Studio).

Visualizzazione e aggiornamento dei dettagli di una versione del modello (Boto3)

Per visualizzare i dettagli di una versione del modello usando boto3, completa la seguente procedura.

  1. Chiama l’operazione API list_model_packages per visualizzare le versioni del modello in un gruppo di modelli.

    sm_client.list_model_packages(ModelPackageGroupName="ModelGroup1")

    La risposta è un elenco riepilogativo dei pacchetti di modelli. Puoi ottenere il nome della risorsa Amazon (ARN) delle versioni del modello da questo elenco.

    {'ModelPackageSummaryList': [{'ModelPackageGroupName': 'AbaloneMPG-16039329888329896', 'ModelPackageVersion': 1, 'ModelPackageArn': 'arn:aws:sagemaker:us-east-2:123456789012:model-package/ModelGroup1/1', 'ModelPackageDescription': 'TestMe', 'CreationTime': datetime.datetime(2020, 10, 29, 1, 27, 46, 46000, tzinfo=tzlocal()), 'ModelPackageStatus': 'Completed', 'ModelApprovalStatus': 'Approved'}], 'ResponseMetadata': {'RequestId': '12345678-abcd-1234-abcd-aabbccddeeff', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amzn-requestid': '12345678-abcd-1234-abcd-aabbccddeeff', 'content-type': 'application/x-amz-json-1.1', 'content-length': '349', 'date': 'Mon, 23 Nov 2020 04:56:50 GMT'}, 'RetryAttempts': 0}}
  2. Richiama describe_model_package per i dettagli della versione del modello. Puoi trasmettere l'ARN di una versione del modello da cui hai ricevuto l'output della chiamata a list_model_packages.

    sm_client.describe_model_package(ModelPackageName="arn:aws:sagemaker:us-east-2:123456789012:model-package/ModelGroup1/1")

    L'output di questa chiamata è un oggetto JSON con i dettagli della versione del modello.

    {'ModelPackageGroupName': 'ModelGroup1', 'ModelPackageVersion': 1, 'ModelPackageArn': 'arn:aws:sagemaker:us-east-2:123456789012:model-package/ModelGroup/1', 'ModelPackageDescription': 'Test Model', 'CreationTime': datetime.datetime(2020, 10, 29, 1, 27, 46, 46000, tzinfo=tzlocal()), 'InferenceSpecification': {'Containers': [{'Image': '257758044811.dkr.ecr.us-east-2.amazonaws.com/sagemaker-xgboost:1.0-1-cpu-py3', 'ImageDigest': 'sha256:99fa602cff19aee33297a5926f8497ca7bcd2a391b7d600300204eef803bca66', 'ModelDataUrl': 's3://sagemaker-us-east-2-123456789012/ModelGroup1/pipelines-0gdonccek7o9-AbaloneTrain-stmiylhtIR/output/model.tar.gz'}], 'SupportedTransformInstanceTypes': ['ml.m5.xlarge'], 'SupportedRealtimeInferenceInstanceTypes': ['ml.t2.medium', 'ml.m5.xlarge'], 'SupportedContentTypes': ['text/csv'], 'SupportedResponseMIMETypes': ['text/csv']}, 'ModelPackageStatus': 'Completed', 'ModelPackageStatusDetails': {'ValidationStatuses': [], 'ImageScanStatuses': []}, 'CertifyForMarketplace': False, 'ModelApprovalStatus': 'PendingManualApproval', 'LastModifiedTime': datetime.datetime(2020, 10, 29, 1, 28, 0, 438000, tzinfo=tzlocal()), 'ResponseMetadata': {'RequestId': '12345678-abcd-1234-abcd-aabbccddeeff', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amzn-requestid': '212345678-abcd-1234-abcd-aabbccddeeff', 'content-type': 'application/x-amz-json-1.1', 'content-length': '1038', 'date': 'Mon, 23 Nov 2020 04:59:38 GMT'}, 'RetryAttempts': 0}}

Schema della scheda del modello del pacchetto di modelli (Studio)

Tutti i dettagli relativi alla versione del modello sono inclusi nella scheda del modello del pacchetto di modelli. La scheda del modello di un pacchetto di modelli rappresenta un utilizzo speciale, con uno schema semplificato, della Scheda del modello Amazon SageMaker. Lo schema della scheda del modello del pacchetto di modelli è mostrato nell’elenco a discesa espandibile seguente.

{ "title": "SageMakerModelCardSchema", "description": "Schema of a model package’s model card.", "version": "0.1.0", "type": "object", "additionalProperties": false, "properties": { "model_overview": { "description": "Overview about the model.", "type": "object", "additionalProperties": false, "properties": { "model_creator": { "description": "Creator of model.", "type": "string", "maxLength": 1024 }, "model_artifact": { "description": "Location of the model artifact.", "type": "array", "maxContains": 15, "items": { "type": "string", "maxLength": 1024 } } } }, "intended_uses": { "description": "Intended usage of model.", "type": "object", "additionalProperties": false, "properties": { "purpose_of_model": { "description": "Reason the model was developed.", "type": "string", "maxLength": 2048 }, "intended_uses": { "description": "Intended use cases.", "type": "string", "maxLength": 2048 }, "factors_affecting_model_efficiency": { "type": "string", "maxLength": 2048 }, "risk_rating": { "description": "Risk rating for model card.", "$ref": "#/definitions/risk_rating" }, "explanations_for_risk_rating": { "type": "string", "maxLength": 2048 } } }, "business_details": { "description": "Business details of model.", "type": "object", "additionalProperties": false, "properties": { "business_problem": { "description": "Business problem solved by the model.", "type": "string", "maxLength": 2048 }, "business_stakeholders": { "description": "Business stakeholders.", "type": "string", "maxLength": 2048 }, "line_of_business": { "type": "string", "maxLength": 2048 } } }, "training_details": { "description": "Overview about the training.", "type": "object", "additionalProperties": false, "properties": { "objective_function": { "description": "The objective function for which the model is optimized.", "function": { "$ref": "#/definitions/objective_function" }, "notes": { "type": "string", "maxLength": 1024 } }, "training_observations": { "type": "string", "maxLength": 1024 }, "training_job_details": { "type": "object", "additionalProperties": false, "properties": { "training_arn": { "description": "SageMaker Training job ARN.", "type": "string", "maxLength": 1024 }, "training_datasets": { "description": "Location of the model datasets.", "type": "array", "maxContains": 15, "items": { "type": "string", "maxLength": 1024 } }, "training_environment": { "type": "object", "additionalProperties": false, "properties": { "container_image": { "description": "SageMaker training image URI.", "type": "array", "maxContains": 15, "items": { "type": "string", "maxLength": 1024 } } } }, "training_metrics": { "type": "array", "items": { "maxItems": 50, "$ref": "#/definitions/training_metric" } }, "user_provided_training_metrics": { "type": "array", "items": { "maxItems": 50, "$ref": "#/definitions/training_metric" } }, "hyper_parameters": { "type": "array", "items": { "maxItems": 100, "$ref": "#/definitions/training_hyper_parameter" } }, "user_provided_hyper_parameters": { "type": "array", "items": { "maxItems": 100, "$ref": "#/definitions/training_hyper_parameter" } } } } } }, "evaluation_details": { "type": "array", "default": [], "items": { "type": "object", "required": [ "name" ], "additionalProperties": false, "properties": { "name": { "type": "string", "pattern": ".{1,63}" }, "evaluation_observation": { "type": "string", "maxLength": 2096 }, "evaluation_job_arn": { "type": "string", "maxLength": 256 }, "datasets": { "type": "array", "items": { "type": "string", "maxLength": 1024 }, "maxItems": 10 }, "metadata": { "description": "Additional attributes associated with the evaluation results.", "type": "object", "additionalProperties": { "type": "string", "maxLength": 1024 } }, "metric_groups": { "type": "array", "default": [], "items": { "type": "object", "required": [ "name", "metric_data" ], "properties": { "name": { "type": "string", "pattern": ".{1,63}" }, "metric_data": { "type": "array", "items": { "anyOf": [ { "$ref": "#/definitions/simple_metric" }, { "$ref": "#/definitions/linear_graph_metric" }, { "$ref": "#/definitions/bar_chart_metric" }, { "$ref": "#/definitions/matrix_metric" } ] } } } } } } } }, "additional_information": { "additionalProperties": false, "type": "object", "properties": { "ethical_considerations": { "description": "Ethical considerations for model users.", "type": "string", "maxLength": 2048 }, "caveats_and_recommendations": { "description": "Caveats and recommendations for model users.", "type": "string", "maxLength": 2048 }, "custom_details": { "type": "object", "additionalProperties": { "$ref": "#/definitions/custom_property" } } } } }, "definitions": { "source_algorithms": { "type": "array", "minContains": 1, "maxContains": 1, "items": { "type": "object", "additionalProperties": false, "required": [ "algorithm_name" ], "properties": { "algorithm_name": { "description": "The name of the algorithm used to create the model package. The algorithm must be either an algorithm resource in your SageMaker AI account or an algorithm in Marketplace AWS that you are subscribed to.", "type": "string", "maxLength": 170 }, "model_data_url": { "description": "Amazon S3 path where the model artifacts, which result from model training, are stored.", "type": "string", "maxLength": 1024 } } } }, "inference_specification": { "type": "object", "additionalProperties": false, "required": [ "containers" ], "properties": { "containers": { "description": "Contains inference related information used to create model package.", "type": "array", "minContains": 1, "maxContains": 15, "items": { "type": "object", "additionalProperties": false, "required": [ "image" ], "properties": { "model_data_url": { "description": "Amazon S3 path where the model artifacts, which result from model training, are stored.", "type": "string", "maxLength": 1024 }, "image": { "description": "Inference environment path. The Amazon Elastic Container Registry (Amazon ECR) path where inference code is stored.", "type": "string", "maxLength": 255 }, "nearest_model_name": { "description": "The name of a pre-trained machine learning benchmarked by an Amazon SageMaker Inference Recommender model that matches your model.", "type": "string" } } } } } }, "risk_rating": { "description": "Risk rating of model.", "type": "string", "enum": [ "High", "Medium", "Low", "Unknown" ] }, "custom_property": { "description": "Additional property.", "type": "string", "maxLength": 1024 }, "objective_function": { "description": "Objective function for which the training job is optimized.", "additionalProperties": false, "properties": { "function": { "type": "string", "enum": [ "Maximize", "Minimize" ] }, "facet": { "type": "string", "maxLength": 63 }, "condition": { "type": "string", "maxLength": 63 } } }, "training_metric": { "description": "Training metric data.", "type": "object", "required": [ "name", "value" ], "additionalProperties": false, "properties": { "name": { "type": "string", "pattern": ".{1,255}" }, "notes": { "type": "string", "maxLength": 1024 }, "value": { "type": "number" } } }, "training_hyper_parameter": { "description": "Training hyperparameter.", "type": "object", "required": [ "name", "value" ], "additionalProperties": false, "properties": { "name": { "type": "string", "pattern": ".{1,255}" }, "value": { "type": "string", "pattern": ".{1,255}" } } }, "linear_graph_metric": { "type": "object", "required": [ "name", "type", "value" ], "additionalProperties": false, "properties": { "name": { "type": "string", "pattern": ".{1,255}" }, "notes": { "type": "string", "maxLength": 1024 }, "type": { "type": "string", "enum": [ "linear_graph" ] }, "value": { "anyOf": [ { "type": "array", "items": { "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 2 }, "minItems": 1 } ] }, "x_axis_name": { "$ref": "#/definitions/axis_name_string" }, "y_axis_name": { "$ref": "#/definitions/axis_name_string" } } }, "bar_chart_metric": { "type": "object", "required": [ "name", "type", "value" ], "additionalProperties": false, "properties": { "name": { "type": "string", "pattern": ".{1,255}" }, "notes": { "type": "string", "maxLength": 1024 }, "type": { "type": "string", "enum": [ "bar_chart" ] }, "value": { "anyOf": [ { "type": "array", "items": { "type": "number" }, "minItems": 1 } ] }, "x_axis_name": { "$ref": "#/definitions/axis_name_array" }, "y_axis_name": { "$ref": "#/definitions/axis_name_string" } } }, "matrix_metric": { "type": "object", "required": [ "name", "type", "value" ], "additionalProperties": false, "properties": { "name": { "type": "string", "pattern": ".{1,255}" }, "notes": { "type": "string", "maxLength": 1024 }, "type": { "type": "string", "enum": [ "matrix" ] }, "value": { "anyOf": [ { "type": "array", "items": { "type": "array", "items": { "type": "number" }, "minItems": 1, "maxItems": 20 }, "minItems": 1, "maxItems": 20 } ] }, "x_axis_name": { "$ref": "#/definitions/axis_name_array" }, "y_axis_name": { "$ref": "#/definitions/axis_name_array" } } }, "simple_metric": { "description": "Metric data.", "type": "object", "required": [ "name", "type", "value" ], "additionalProperties": false, "properties": { "name": { "type": "string", "pattern": ".{1,255}" }, "notes": { "type": "string", "maxLength": 1024 }, "type": { "type": "string", "enum": [ "number", "string", "boolean" ] }, "value": { "anyOf": [ { "type": "number" }, { "type": "string", "maxLength": 63 }, { "type": "boolean" } ] }, "x_axis_name": { "$ref": "#/definitions/axis_name_string" }, "y_axis_name": { "$ref": "#/definitions/axis_name_string" } } }, "axis_name_array": { "type": "array", "items": { "type": "string", "maxLength": 63 } }, "axis_name_string": { "type": "string", "maxLength": 63 } } }

Visualizzazione e aggiornamento dei dettagli di una versione del modello (Studio o Studio Classic)

Per visualizzare e aggiornare i dettagli di una versione del modello, completa la procedura seguente a seconda che utilizzi Studio o Studio Classic. In Studio Classic, puoi aggiornare lo stato di approvazione per una versione del modello. Per informazioni dettagliate, consultare Aggiornamento dello stato di approvazione di un modello. In Studio, d’altra parte, SageMaker AI crea una scheda del modello per un pacchetto di modelli e l’interfaccia utente della versione del modello offre opzioni per aggiornare i dettagli nella scheda del modello.

Studio
  1. Apri la console di SageMaker Studio seguendo le istruzioni riportate in Avvio di Amazon SageMaker Studio.

  2. Nel riquadro di navigazione a sinistra scegli Modelli dal menu.

  3. Scegli la scheda Modelli registrati, se non è già selezionata.

  4. Immediatamente sotto l’etichetta della scheda Modelli registrati, scegli Gruppi di modelli, se non è già selezionato.

  5. Seleziona il nome del gruppo di modelli che contiene la versione del modello da visualizzare.

  6. Nell’elenco delle versioni del modello, seleziona la versione del modello da visualizzare.

  7. Scegli una delle seguenti schede.

Studio Classic
  1. Accedi ad Amazon SageMaker Studio Classic. Per ulteriori informazioni, consulta Avvio di Amazon SageMaker Studio Classic.

  2. Nel riquadro di navigazione a sinistra, scegli l’icona Home ( Black square icon representing a placeholder or empty image. ).

  3. Scegli Modelli, quindi Registro dei modelli.

  4. Dall'elenco dei gruppi di modelli, seleziona il nome del gruppo di modelli da eliminare.

  5. Viene visualizzata una nuova scheda con un elenco delle versioni del modello nel gruppo di modelli.

  6. Nell'elenco delle versioni del modello, seleziona il nome della versione del modello di cui desideri visualizzare i dettagli.

  7. Nella scheda della versione del modello che si apre, scegli una delle seguenti opzioni per visualizzare i dettagli sulla versione del modello:

    • Attività: mostra gli eventi relativi alla versione del modello, come gli aggiornamenti dello stato di approvazione.

    • Qualità del modello: riporta le metriche relative ai controlli di qualità dei modelli Model Monitor, che confrontano le previsioni del modello con Ground Truth. Per ulteriori informazioni sui controlli di qualità dei modelli Model Monitor, consulta Qualità del modello.

    • Spiegabilità: riporta le metriche relative ai controlli di attribuzione delle funzionalità di Model Monitor, che confrontano il posizionamento relativo delle funzionalità nei dati di addestramento con quello dei dati in tempo reale. Per ulteriori informazioni sui controlli di spiegabilità di Model Monitor, consulta Deriva dell’attribuzione delle funzionalità per i modelli in produzione.

    • Bias: riporta le metriche relative ai controlli di distorsione di Model Monitor, che confrontano la distribuzione dei dati in tempo reale con i dati di addestramento. Per ulteriori informazioni sui controlli di distorsione di Model Monitor, consulta Deriva dei bias per i modelli in produzione.

    • Raccomandazione di inferenza: fornisce consigli sulle istanze iniziali per prestazioni ottimali in base al modello e ai carichi di lavoro del campione.

    • Test di carico: esegue test di carico sui tipi di istanze prescelti quando fornisci requisiti di produzione specifici, come vincoli di latenza e velocità effettiva.

    • Specifiche di inferenza: visualizza i tipi di istanze per i processi di inferenza e trasformazione in tempo reale e le informazioni sui container Amazon ECR.

    • Informazioni: mostra informazioni quali il progetto a cui è associata la versione del modello, la pipeline che ha generato il modello, il gruppo di modelli e la posizione del modello in Amazon S3.