CreateModelPackage - Amazon SageMaker Service
AWS services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with AWS services in China.

CreateModelPackage

Creates a model package that you can use to create Amazon SageMaker models or list on AWS Marketplace, or a versioned model that is part of a model group. Buyers can subscribe to model packages listed on AWS Marketplace to create models in Amazon 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 AWS 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

{ "CertifyForMarketplace": boolean, "ClientToken": "string", "InferenceSpecification": { "Containers": [ { "ContainerHostname": "string", "Image": "string", "ImageDigest": "string", "ModelDataUrl": "string", "ProductId": "string" } ], "SupportedContentTypes": [ "string" ], "SupportedRealtimeInferenceInstanceTypes": [ "string" ], "SupportedResponseMIMETypes": [ "string" ], "SupportedTransformInstanceTypes": [ "string" ] }, "MetadataProperties": { "CommitId": "string", "GeneratedBy": "string", "ProjectId": "string", "Repository": "string" }, "ModelApprovalStatus": "string", "ModelMetrics": { "Bias": { "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", "SourceAlgorithmSpecification": { "SourceAlgorithms": [ { "AlgorithmName": "string", "ModelDataUrl": "string" } ] }, "Tags": [ { "Key": "string", "Value": "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.

CertifyForMarketplace

Whether to certify the model package for listing on AWS 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

InferenceSpecification

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

  • 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 of the model 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 63.

Pattern: ^[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

SourceAlgorithmSpecification

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

Type: SourceAlgorithmSpecification object

Required: No

Tags

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

Type: Array of Tag objects

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

Required: No

ValidationSpecification

Specifies configurations for one or more transform jobs that Amazon 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[a-z\-]*:sagemaker:[a-z0-9\-]*:[0-9]{12}:model-package/.*

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 an experiment, trial, or trial component.

HTTP Status Code: 400

ResourceLimitExceeded

You have exceeded an Amazon 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 AWS SDKs, see the following: