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.
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
create-model-package
[--model-package-name <value>]
[--model-package-group-name <value>]
[--model-package-description <value>]
[--inference-specification <value>]
[--validation-specification <value>]
[--source-algorithm-specification <value>]
[--certify-for-marketplace | --no-certify-for-marketplace]
[--tags <value>]
[--model-approval-status <value>]
[--metadata-properties <value>]
[--model-metrics <value>]
[--client-token <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
--model-package-name
(string)
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.
--model-package-group-name
(string)
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.
--model-package-description
(string)
A description of the model package.
--inference-specification
(structure)
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.
Containers -> (list)
The Amazon ECR registry path of the Docker image that contains the inference code.
(structure)
Describes the Docker container for the model package.
ContainerHostname -> (string)
The DNS host name for the Docker container.
Image -> (string)
The Amazon EC2 Container Registry (Amazon ECR) path where inference code is stored.
If you are using your own custom algorithm instead of an algorithm provided by Amazon SageMaker, the inference code must meet Amazon SageMaker requirements. Amazon SageMaker supports both
registry/repository[:tag]
andregistry/repository[@digest]
image path formats. For more information, see Using Your Own Algorithms with Amazon SageMaker .ImageDigest -> (string)
An MD5 hash of the training algorithm that identifies the Docker image used for training.
ModelDataUrl -> (string)
The Amazon S3 path where the model artifacts, which result from model training, are stored. This path must point to a single
gzip
compressed tar archive (.tar.gz
suffix).Note
The model artifacts must be in an S3 bucket that is in the same region as the model package.
ProductId -> (string)
The AWS Marketplace product ID of the model package.
SupportedTransformInstanceTypes -> (list)
A list of the instance types on which a transformation job can be run or on which an endpoint can be deployed.
This parameter is required for unversioned models, and optional for versioned models.
(string)
SupportedRealtimeInferenceInstanceTypes -> (list)
A list of the instance types that are used to generate inferences in real-time.
This parameter is required for unversioned models, and optional for versioned models.
(string)
SupportedContentTypes -> (list)
The supported MIME types for the input data.
(string)
SupportedResponseMIMETypes -> (list)
The supported MIME types for the output data.
(string)
Shorthand Syntax:
Containers=[{ContainerHostname=string,Image=string,ImageDigest=string,ModelDataUrl=string,ProductId=string},{ContainerHostname=string,Image=string,ImageDigest=string,ModelDataUrl=string,ProductId=string}],SupportedTransformInstanceTypes=string,string,SupportedRealtimeInferenceInstanceTypes=string,string,SupportedContentTypes=string,string,SupportedResponseMIMETypes=string,string
JSON Syntax:
{
"Containers": [
{
"ContainerHostname": "string",
"Image": "string",
"ImageDigest": "string",
"ModelDataUrl": "string",
"ProductId": "string"
}
...
],
"SupportedTransformInstanceTypes": ["ml.m4.xlarge"|"ml.m4.2xlarge"|"ml.m4.4xlarge"|"ml.m4.10xlarge"|"ml.m4.16xlarge"|"ml.c4.xlarge"|"ml.c4.2xlarge"|"ml.c4.4xlarge"|"ml.c4.8xlarge"|"ml.p2.xlarge"|"ml.p2.8xlarge"|"ml.p2.16xlarge"|"ml.p3.2xlarge"|"ml.p3.8xlarge"|"ml.p3.16xlarge"|"ml.c5.xlarge"|"ml.c5.2xlarge"|"ml.c5.4xlarge"|"ml.c5.9xlarge"|"ml.c5.18xlarge"|"ml.m5.large"|"ml.m5.xlarge"|"ml.m5.2xlarge"|"ml.m5.4xlarge"|"ml.m5.12xlarge"|"ml.m5.24xlarge", ...],
"SupportedRealtimeInferenceInstanceTypes": ["ml.t2.medium"|"ml.t2.large"|"ml.t2.xlarge"|"ml.t2.2xlarge"|"ml.m4.xlarge"|"ml.m4.2xlarge"|"ml.m4.4xlarge"|"ml.m4.10xlarge"|"ml.m4.16xlarge"|"ml.m5.large"|"ml.m5.xlarge"|"ml.m5.2xlarge"|"ml.m5.4xlarge"|"ml.m5.12xlarge"|"ml.m5.24xlarge"|"ml.m5d.large"|"ml.m5d.xlarge"|"ml.m5d.2xlarge"|"ml.m5d.4xlarge"|"ml.m5d.12xlarge"|"ml.m5d.24xlarge"|"ml.c4.large"|"ml.c4.xlarge"|"ml.c4.2xlarge"|"ml.c4.4xlarge"|"ml.c4.8xlarge"|"ml.p2.xlarge"|"ml.p2.8xlarge"|"ml.p2.16xlarge"|"ml.p3.2xlarge"|"ml.p3.8xlarge"|"ml.p3.16xlarge"|"ml.c5.large"|"ml.c5.xlarge"|"ml.c5.2xlarge"|"ml.c5.4xlarge"|"ml.c5.9xlarge"|"ml.c5.18xlarge"|"ml.c5d.large"|"ml.c5d.xlarge"|"ml.c5d.2xlarge"|"ml.c5d.4xlarge"|"ml.c5d.9xlarge"|"ml.c5d.18xlarge"|"ml.g4dn.xlarge"|"ml.g4dn.2xlarge"|"ml.g4dn.4xlarge"|"ml.g4dn.8xlarge"|"ml.g4dn.12xlarge"|"ml.g4dn.16xlarge"|"ml.r5.large"|"ml.r5.xlarge"|"ml.r5.2xlarge"|"ml.r5.4xlarge"|"ml.r5.12xlarge"|"ml.r5.24xlarge"|"ml.r5d.large"|"ml.r5d.xlarge"|"ml.r5d.2xlarge"|"ml.r5d.4xlarge"|"ml.r5d.12xlarge"|"ml.r5d.24xlarge"|"ml.inf1.xlarge"|"ml.inf1.2xlarge"|"ml.inf1.6xlarge"|"ml.inf1.24xlarge", ...],
"SupportedContentTypes": ["string", ...],
"SupportedResponseMIMETypes": ["string", ...]
}
--validation-specification
(structure)
Specifies configurations for one or more transform jobs that Amazon SageMaker runs to test the model package.
ValidationRole -> (string)
The IAM roles to be used for the validation of the model package.
ValidationProfiles -> (list)
An array of
ModelPackageValidationProfile
objects, each of which specifies a batch transform job that Amazon SageMaker runs to validate your model package.(structure)
Contains data, such as the inputs and targeted instance types that are used in the process of validating the model package.
The data provided in the validation profile is made available to your buyers on AWS Marketplace.
ProfileName -> (string)
The name of the profile for the model package.
TransformJobDefinition -> (structure)
The
TransformJobDefinition
object that describes the transform job used for the validation of the model package.MaxConcurrentTransforms -> (integer)
The maximum number of parallel requests that can be sent to each instance in a transform job. The default value is 1.
MaxPayloadInMB -> (integer)
The maximum payload size allowed, in MB. A payload is the data portion of a record (without metadata).
BatchStrategy -> (string)
A string that determines the number of records included in a single mini-batch.
SingleRecord
means only one record is used per mini-batch.MultiRecord
means a mini-batch is set to contain as many records that can fit within theMaxPayloadInMB
limit.Environment -> (map)
The environment variables to set in the Docker container. We support up to 16 key and values entries in the map.
key -> (string)
value -> (string)
TransformInput -> (structure)
A description of the input source and the way the transform job consumes it.
DataSource -> (structure)
Describes the location of the channel data, which is, the S3 location of the input data that the model can consume.
S3DataSource -> (structure)
The S3 location of the data source that is associated with a channel.
S3DataType -> (string)
If you choose
S3Prefix
,S3Uri
identifies a key name prefix. Amazon SageMaker uses all objects with the specified key name prefix for batch transform.If you choose
ManifestFile
,S3Uri
identifies an object that is a manifest file containing a list of object keys that you want Amazon SageMaker to use for batch transform.The following values are compatible:
ManifestFile
,S3Prefix
The following value is not compatible:
AugmentedManifestFile
S3Uri -> (string)
Depending on the value specified for the
S3DataType
, identifies either a key name prefix or a manifest. For example:
A key name prefix might look like this:
s3://bucketname/exampleprefix
.A manifest might look like this:
s3://bucketname/example.manifest
The manifest is an S3 object which is a JSON file with the following format:[ {"prefix": "s3://customer_bucket/some/prefix/"},
"relative/path/to/custdata-1",
"relative/path/custdata-2",
...
"relative/path/custdata-N"
]
The preceding JSON matches the followingS3Uris
:s3://customer_bucket/some/prefix/relative/path/to/custdata-1
s3://customer_bucket/some/prefix/relative/path/custdata-2
...
s3://customer_bucket/some/prefix/relative/path/custdata-N
The complete set ofS3Uris
in this manifest constitutes the input data for the channel for this datasource. The object that eachS3Uris
points to must be readable by the IAM role that Amazon SageMaker uses to perform tasks on your behalf.ContentType -> (string)
The multipurpose internet mail extension (MIME) type of the data. Amazon SageMaker uses the MIME type with each http call to transfer data to the transform job.
CompressionType -> (string)
If your transform data is compressed, specify the compression type. Amazon SageMaker automatically decompresses the data for the transform job accordingly. The default value is
None
.SplitType -> (string)
The method to use to split the transform job’s data files into smaller batches. Splitting is necessary when the total size of each object is too large to fit in a single request. You can also use data splitting to improve performance by processing multiple concurrent mini-batches. The default value for
SplitType
isNone
, which indicates that input data files are not split, and request payloads contain the entire contents of an input object. Set the value of this parameter toLine
to split records on a newline character boundary.SplitType
also supports a number of record-oriented binary data formats. Currently, the supported record formats are:
RecordIO
TFRecord
When splitting is enabled, the size of a mini-batch depends on the values of the
BatchStrategy
andMaxPayloadInMB
parameters. When the value ofBatchStrategy
isMultiRecord
, Amazon SageMaker sends the maximum number of records in each request, up to theMaxPayloadInMB
limit. If the value ofBatchStrategy
isSingleRecord
, Amazon SageMaker sends individual records in each request.Note
Some data formats represent a record as a binary payload wrapped with extra padding bytes. When splitting is applied to a binary data format, padding is removed if the value of
BatchStrategy
is set toSingleRecord
. Padding is not removed if the value ofBatchStrategy
is set toMultiRecord
.For more information about
RecordIO
, see Create a Dataset Using RecordIO in the MXNet documentation. For more information aboutTFRecord
, see Consuming TFRecord data in the TensorFlow documentation.TransformOutput -> (structure)
Identifies the Amazon S3 location where you want Amazon SageMaker to save the results from the transform job.
S3OutputPath -> (string)
The Amazon S3 path where you want Amazon SageMaker to store the results of the transform job. For example,
s3://bucket-name/key-name-prefix
.For every S3 object used as input for the transform job, batch transform stores the transformed data with an .``out`` suffix in a corresponding subfolder in the location in the output prefix. For example, for the input data stored at
s3://bucket-name/input-name-prefix/dataset01/data.csv
, batch transform stores the transformed data ats3://bucket-name/output-name-prefix/input-name-prefix/data.csv.out
. Batch transform doesn’t upload partially processed objects. For an input S3 object that contains multiple records, it creates an .``out`` file only if the transform job succeeds on the entire file. When the input contains multiple S3 objects, the batch transform job processes the listed S3 objects and uploads only the output for successfully processed objects. If any object fails in the transform job batch transform marks the job as failed to prompt investigation.Accept -> (string)
The MIME type used to specify the output data. Amazon SageMaker uses the MIME type with each http call to transfer data from the transform job.
AssembleWith -> (string)
Defines how to assemble the results of the transform job as a single S3 object. Choose a format that is most convenient to you. To concatenate the results in binary format, specify
None
. To add a newline character at the end of every transformed record, specifyLine
.KmsKeyId -> (string)
The AWS Key Management Service (AWS KMS) key that Amazon SageMaker uses to encrypt the model artifacts at rest using Amazon S3 server-side encryption. The
KmsKeyId
can be any of the following formats:
Key ID:
1234abcd-12ab-34cd-56ef-1234567890ab
Key ARN:
arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
Alias name:
alias/ExampleAlias
Alias name ARN:
arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias
If you don’t provide a KMS key ID, Amazon SageMaker uses the default KMS key for Amazon S3 for your role’s account. For more information, see KMS-Managed Encryption Keys in the Amazon Simple Storage Service Developer Guide.
The KMS key policy must grant permission to the IAM role that you specify in your CreateModel request. For more information, see Using Key Policies in AWS KMS in the AWS Key Management Service Developer Guide .
TransformResources -> (structure)
Identifies the ML compute instances for the transform job.
InstanceType -> (string)
The ML compute instance type for the transform job. If you are using built-in algorithms to transform moderately sized datasets, we recommend using ml.m4.xlarge or
ml.m5.large
instance types.InstanceCount -> (integer)
The number of ML compute instances to use in the transform job. For distributed transform jobs, specify a value greater than 1. The default value is
1
.VolumeKmsKeyId -> (string)
The AWS Key Management Service (AWS KMS) key that Amazon SageMaker uses to encrypt model data on the storage volume attached to the ML compute instance(s) that run the batch transform job. The
VolumeKmsKeyId
can be any of the following formats:
Key ID:
1234abcd-12ab-34cd-56ef-1234567890ab
Key ARN:
arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
Alias name:
alias/ExampleAlias
Alias name ARN:
arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias
JSON Syntax:
{
"ValidationRole": "string",
"ValidationProfiles": [
{
"ProfileName": "string",
"TransformJobDefinition": {
"MaxConcurrentTransforms": integer,
"MaxPayloadInMB": integer,
"BatchStrategy": "MultiRecord"|"SingleRecord",
"Environment": {"string": "string"
...},
"TransformInput": {
"DataSource": {
"S3DataSource": {
"S3DataType": "ManifestFile"|"S3Prefix"|"AugmentedManifestFile",
"S3Uri": "string"
}
},
"ContentType": "string",
"CompressionType": "None"|"Gzip",
"SplitType": "None"|"Line"|"RecordIO"|"TFRecord"
},
"TransformOutput": {
"S3OutputPath": "string",
"Accept": "string",
"AssembleWith": "None"|"Line",
"KmsKeyId": "string"
},
"TransformResources": {
"InstanceType": "ml.m4.xlarge"|"ml.m4.2xlarge"|"ml.m4.4xlarge"|"ml.m4.10xlarge"|"ml.m4.16xlarge"|"ml.c4.xlarge"|"ml.c4.2xlarge"|"ml.c4.4xlarge"|"ml.c4.8xlarge"|"ml.p2.xlarge"|"ml.p2.8xlarge"|"ml.p2.16xlarge"|"ml.p3.2xlarge"|"ml.p3.8xlarge"|"ml.p3.16xlarge"|"ml.c5.xlarge"|"ml.c5.2xlarge"|"ml.c5.4xlarge"|"ml.c5.9xlarge"|"ml.c5.18xlarge"|"ml.m5.large"|"ml.m5.xlarge"|"ml.m5.2xlarge"|"ml.m5.4xlarge"|"ml.m5.12xlarge"|"ml.m5.24xlarge",
"InstanceCount": integer,
"VolumeKmsKeyId": "string"
}
}
}
...
]
}
--source-algorithm-specification
(structure)
Details about the algorithm that was used to create the model package.
SourceAlgorithms -> (list)
A list of the algorithms that were used to create a model package.
(structure)
Specifies an algorithm that was used to create the model package. The algorithm must be either an algorithm resource in your Amazon SageMaker account or an algorithm in AWS Marketplace that you are subscribed to.
ModelDataUrl -> (string)
The Amazon S3 path where the model artifacts, which result from model training, are stored. This path must point to a single
gzip
compressed tar archive (.tar.gz
suffix).Note
The model artifacts must be in an S3 bucket that is in the same region as the algorithm.
AlgorithmName -> (string)
The name of an algorithm that was used to create the model package. The algorithm must be either an algorithm resource in your Amazon SageMaker account or an algorithm in AWS Marketplace that you are subscribed to.
Shorthand Syntax:
SourceAlgorithms=[{ModelDataUrl=string,AlgorithmName=string},{ModelDataUrl=string,AlgorithmName=string}]
JSON Syntax:
{
"SourceAlgorithms": [
{
"ModelDataUrl": "string",
"AlgorithmName": "string"
}
...
]
}
--certify-for-marketplace
| --no-certify-for-marketplace
(boolean)
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.
--tags
(list)
A list of key value pairs associated with the model. For more information, see Tagging AWS resources in the AWS General Reference Guide .
(structure)
Describes a tag.
Key -> (string)
The tag key.
Value -> (string)
The tag value.
Shorthand Syntax:
Key=string,Value=string ...
JSON Syntax:
[
{
"Key": "string",
"Value": "string"
}
...
]
--model-approval-status
(string)
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.Possible values:
Approved
Rejected
PendingManualApproval
--metadata-properties
(structure)
Metadata properties of the tracking entity, trial, or trial component.
CommitId -> (string)
The commit ID.
Repository -> (string)
The repository.
GeneratedBy -> (string)
The entity this entity was generated by.
ProjectId -> (string)
The project ID.
Shorthand Syntax:
CommitId=string,Repository=string,GeneratedBy=string,ProjectId=string
JSON Syntax:
{
"CommitId": "string",
"Repository": "string",
"GeneratedBy": "string",
"ProjectId": "string"
}
--model-metrics
(structure)
A structure that contains model metrics reports.
ModelQuality -> (structure)
Metrics that measure the quality of a model.
Statistics -> (structure)
Model quality statistics.
ContentType -> (string)
ContentDigest -> (string)
S3Uri -> (string)
Constraints -> (structure)
Model quality constraints.
ContentType -> (string)
ContentDigest -> (string)
S3Uri -> (string)
ModelDataQuality -> (structure)
Metrics that measure the quality of the input data for a model.
Statistics -> (structure)
Data quality statistics for a model.
ContentType -> (string)
ContentDigest -> (string)
S3Uri -> (string)
Constraints -> (structure)
Data quality constraints for a model.
ContentType -> (string)
ContentDigest -> (string)
S3Uri -> (string)
Bias -> (structure)
Metrics that measure bais in a model.
Report -> (structure)
The bias report for a model
ContentType -> (string)
ContentDigest -> (string)
S3Uri -> (string)
Explainability -> (structure)
Metrics that help explain a model.
Report -> (structure)
The explainability report for a model.
ContentType -> (string)
ContentDigest -> (string)
S3Uri -> (string)
Shorthand Syntax:
ModelQuality={Statistics={ContentType=string,ContentDigest=string,S3Uri=string},Constraints={ContentType=string,ContentDigest=string,S3Uri=string}},ModelDataQuality={Statistics={ContentType=string,ContentDigest=string,S3Uri=string},Constraints={ContentType=string,ContentDigest=string,S3Uri=string}},Bias={Report={ContentType=string,ContentDigest=string,S3Uri=string}},Explainability={Report={ContentType=string,ContentDigest=string,S3Uri=string}}
JSON Syntax:
{
"ModelQuality": {
"Statistics": {
"ContentType": "string",
"ContentDigest": "string",
"S3Uri": "string"
},
"Constraints": {
"ContentType": "string",
"ContentDigest": "string",
"S3Uri": "string"
}
},
"ModelDataQuality": {
"Statistics": {
"ContentType": "string",
"ContentDigest": "string",
"S3Uri": "string"
},
"Constraints": {
"ContentType": "string",
"ContentDigest": "string",
"S3Uri": "string"
}
},
"Bias": {
"Report": {
"ContentType": "string",
"ContentDigest": "string",
"S3Uri": "string"
}
},
"Explainability": {
"Report": {
"ContentType": "string",
"ContentDigest": "string",
"S3Uri": "string"
}
}
}
--client-token
(string)
A unique token that guarantees that the call to this API is idempotent.
--cli-input-json
| --cli-input-yaml
(string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml
.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. Similarly, if provided yaml-input
it will print a sample input YAML that can be used with --cli-input-yaml
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
See ‘aws help’ for descriptions of global parameters.