CreateModelPackage - Amazon SageMaker
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

CreateModelPackage

Creates a model package that you can use to create SageMaker models or list on Amazon Marketplace, or a versioned model that is part of a model group. Buyers can subscribe to model packages listed on Amazon Marketplace to create models in SageMaker.

To create a model package by specifying a Docker container that contains your inference code and the Amazon S3 location of your model artifacts, provide values for InferenceSpecification. To create a model from an algorithm resource that you created or subscribed to in Amazon Marketplace, provide a value for SourceAlgorithmSpecification.

Note

There are two types of model packages:

  • Versioned - a model that is part of a model group in the model registry.

  • Unversioned - a model package that is not part of a model group.

Request Syntax

{ "AdditionalInferenceSpecifications": [ { "Containers": [ { "AdditionalS3DataSource": { "CompressionType": "string", "S3DataType": "string", "S3Uri": "string" }, "ContainerHostname": "string", "Environment": { "string" : "string" }, "Framework": "string", "FrameworkVersion": "string", "Image": "string", "ImageDigest": "string", "ModelDataSource": { "S3DataSource": { "CompressionType": "string", "ModelAccessConfig": { "AcceptEula": boolean }, "S3DataType": "string", "S3Uri": "string" } }, "ModelDataUrl": "string", "ModelInput": { "DataInputConfig": "string" }, "NearestModelName": "string", "ProductId": "string" } ], "Description": "string", "Name": "string", "SupportedContentTypes": [ "string" ], "SupportedRealtimeInferenceInstanceTypes": [ "string" ], "SupportedResponseMIMETypes": [ "string" ], "SupportedTransformInstanceTypes": [ "string" ] } ], "CertifyForMarketplace": boolean, "ClientToken": "string", "CustomerMetadataProperties": { "string" : "string" }, "Domain": "string", "DriftCheckBaselines": { "Bias": { "ConfigFile": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" }, "PostTrainingConstraints": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" }, "PreTrainingConstraints": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" } }, "Explainability": { "ConfigFile": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" }, "Constraints": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" } }, "ModelDataQuality": { "Constraints": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" }, "Statistics": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" } }, "ModelQuality": { "Constraints": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" }, "Statistics": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" } } }, "InferenceSpecification": { "Containers": [ { "AdditionalS3DataSource": { "CompressionType": "string", "S3DataType": "string", "S3Uri": "string" }, "ContainerHostname": "string", "Environment": { "string" : "string" }, "Framework": "string", "FrameworkVersion": "string", "Image": "string", "ImageDigest": "string", "ModelDataSource": { "S3DataSource": { "CompressionType": "string", "ModelAccessConfig": { "AcceptEula": boolean }, "S3DataType": "string", "S3Uri": "string" } }, "ModelDataUrl": "string", "ModelInput": { "DataInputConfig": "string" }, "NearestModelName": "string", "ProductId": "string" } ], "SupportedContentTypes": [ "string" ], "SupportedRealtimeInferenceInstanceTypes": [ "string" ], "SupportedResponseMIMETypes": [ "string" ], "SupportedTransformInstanceTypes": [ "string" ] }, "MetadataProperties": { "CommitId": "string", "GeneratedBy": "string", "ProjectId": "string", "Repository": "string" }, "ModelApprovalStatus": "string", "ModelMetrics": { "Bias": { "PostTrainingReport": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" }, "PreTrainingReport": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" }, "Report": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" } }, "Explainability": { "Report": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" } }, "ModelDataQuality": { "Constraints": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" }, "Statistics": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" } }, "ModelQuality": { "Constraints": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" }, "Statistics": { "ContentDigest": "string", "ContentType": "string", "S3Uri": "string" } } }, "ModelPackageDescription": "string", "ModelPackageGroupName": "string", "ModelPackageName": "string", "SamplePayloadUrl": "string", "SkipModelValidation": "string", "SourceAlgorithmSpecification": { "SourceAlgorithms": [ { "AlgorithmName": "string", "ModelDataSource": { "S3DataSource": { "CompressionType": "string", "ModelAccessConfig": { "AcceptEula": boolean }, "S3DataType": "string", "S3Uri": "string" } }, "ModelDataUrl": "string" } ] }, "SourceUri": "string", "Tags": [ { "Key": "string", "Value": "string" } ], "Task": "string", "ValidationSpecification": { "ValidationProfiles": [ { "ProfileName": "string", "TransformJobDefinition": { "BatchStrategy": "string", "Environment": { "string" : "string" }, "MaxConcurrentTransforms": number, "MaxPayloadInMB": number, "TransformInput": { "CompressionType": "string", "ContentType": "string", "DataSource": { "S3DataSource": { "S3DataType": "string", "S3Uri": "string" } }, "SplitType": "string" }, "TransformOutput": { "Accept": "string", "AssembleWith": "string", "KmsKeyId": "string", "S3OutputPath": "string" }, "TransformResources": { "InstanceCount": number, "InstanceType": "string", "VolumeKmsKeyId": "string" } } } ], "ValidationRole": "string" } }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

AdditionalInferenceSpecifications

An array of additional Inference Specification objects. Each additional Inference Specification specifies artifacts based on this model package that can be used on inference endpoints. Generally used with SageMaker Neo to store the compiled artifacts.

Type: Array of AdditionalInferenceSpecificationDefinition objects

Array Members: Minimum number of 1 item. Maximum number of 15 items.

Required: No

CertifyForMarketplace

Whether to certify the model package for listing on Amazon Marketplace.

This parameter is optional for unversioned models, and does not apply to versioned models.

Type: Boolean

Required: No

ClientToken

A unique token that guarantees that the call to this API is idempotent.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 36.

Pattern: ^[a-zA-Z0-9-]+$

Required: No

CustomerMetadataProperties

The metadata properties associated with the model package versions.

Type: String to string map

Map Entries: Maximum number of 50 items.

Key Length Constraints: Minimum length of 1. Maximum length of 128.

Key Pattern: ^([\p{L}\p{Z}\p{N}_.:\/=+\-@]*)${1,128}

Value Length Constraints: Minimum length of 1. Maximum length of 256.

Value Pattern: ^([\p{L}\p{Z}\p{N}_.:\/=+\-@]*)${1,256}

Required: No

Domain

The machine learning domain of your model package and its components. Common machine learning domains include computer vision and natural language processing.

Type: String

Required: No

DriftCheckBaselines

Represents the drift check baselines that can be used when the model monitor is set using the model package. For more information, see the topic on Drift Detection against Previous Baselines in SageMaker Pipelines in the Amazon SageMaker Developer Guide.

Type: DriftCheckBaselines object

Required: No

InferenceSpecification

Specifies details about inference jobs that you can run with models based on this model package, including the following information:

  • The Amazon ECR paths of containers that contain the inference code and model artifacts.

  • The instance types that the model package supports for transform jobs and real-time endpoints used for inference.

  • The input and output content formats that the model package supports for inference.

Type: InferenceSpecification object

Required: No

MetadataProperties

Metadata properties of the tracking entity, trial, or trial component.

Type: MetadataProperties object

Required: No

ModelApprovalStatus

Whether the model is approved for deployment.

This parameter is optional for versioned models, and does not apply to unversioned models.

For versioned models, the value of this parameter must be set to Approved to deploy the model.

Type: String

Valid Values: Approved | Rejected | PendingManualApproval

Required: No

ModelMetrics

A structure that contains model metrics reports.

Type: ModelMetrics object

Required: No

ModelPackageDescription

A description of the model package.

Type: String

Length Constraints: Maximum length of 1024.

Pattern: [\p{L}\p{M}\p{Z}\p{S}\p{N}\p{P}]*

Required: No

ModelPackageGroupName

The name or Amazon Resource Name (ARN) of the model package group that this model version belongs to.

This parameter is required for versioned models, and does not apply to unversioned models.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 170.

Pattern: (arn:aws[a-z\-]*:sagemaker:[a-z0-9\-]*:[0-9]{12}:[a-z\-]*\/)?([a-zA-Z0-9]([a-zA-Z0-9-]){0,62})(?<!-)$

Required: No

ModelPackageName

The name of the model package. The name must have 1 to 63 characters. Valid characters are a-z, A-Z, 0-9, and - (hyphen).

This parameter is required for unversioned models. It is not applicable to versioned models.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 63.

Pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9]){0,62}$

Required: No

SamplePayloadUrl

The Amazon Simple Storage Service (Amazon S3) path where the sample payload is stored. This path must point to a single gzip compressed tar archive (.tar.gz suffix). This archive can hold multiple files that are all equally used in the load test. Each file in the archive must satisfy the size constraints of the InvokeEndpoint call.

Type: String

Length Constraints: Maximum length of 1024.

Pattern: ^(https|s3)://([^/]+)/?(.*)$

Required: No

SkipModelValidation

Indicates if you want to skip model validation.

Type: String

Valid Values: All | None

Required: No

SourceAlgorithmSpecification

Details about the algorithm that was used to create the model package.

Type: SourceAlgorithmSpecification object

Required: No

SourceUri

The URI of the source for the model package. If you want to clone a model package, set it to the model package Amazon Resource Name (ARN). If you want to register a model, set it to the model ARN.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\p{L}\p{M}\p{Z}\p{N}\p{P}]{0,1024}

Required: No

Tags

A list of key value pairs associated with the model. For more information, see Tagging Amazon resources in the Amazon General Reference Guide.

If you supply ModelPackageGroupName, your model package belongs to the model group you specify and uses the tags associated with the model group. In this case, you cannot supply a tag argument.

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 50 items.

Required: No

Task

The machine learning task your model package accomplishes. Common machine learning tasks include object detection and image classification. The following tasks are supported by Inference Recommender: "IMAGE_CLASSIFICATION" | "OBJECT_DETECTION" | "TEXT_GENERATION" |"IMAGE_SEGMENTATION" | "FILL_MASK" | "CLASSIFICATION" | "REGRESSION" | "OTHER".

Specify "OTHER" if none of the tasks listed fit your use case.

Type: String

Required: No

ValidationSpecification

Specifies configurations for one or more transform jobs that SageMaker runs to test the model package.

Type: ModelPackageValidationSpecification object

Required: No

Response Syntax

{ "ModelPackageArn": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

ModelPackageArn

The Amazon Resource Name (ARN) of the new model package.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 2048.

Pattern: ^arn:aws(-cn|-us-gov)?:sagemaker:[a-z0-9\-]{9,16}:[0-9]{12}:model-package/[\S]{1,2048}$

Errors

For information about the errors that are common to all actions, see Common Errors.

ConflictException

There was a conflict when you attempted to modify a SageMaker entity such as an Experiment or Artifact.

HTTP Status Code: 400

ResourceLimitExceeded

You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: