create_model_package
¶
create_model_package(
*,
config_overrides: Optional[SageMakerClientConfig] = None,
model_package_name: Optional[EntityName] = None,
model_package_group_name: Optional[ArnOrName] = None,
model_package_description: Optional[EntityDescription] = None,
model_package_registration_type: Optional[ModelPackageRegistrationType] = None,
inference_specification: Optional[InferenceSpecification] = None,
validation_specification: Optional[ModelPackageValidationSpecification] = None,
source_algorithm_specification: Optional[SourceAlgorithmSpecification] = None,
certify_for_marketplace: Optional[CertifyForMarketplace] = None,
tags: Optional[TagList] = None,
model_approval_status: Optional[ModelApprovalStatus] = None,
metadata_properties: Optional[MetadataProperties] = None,
model_metrics: Optional[ModelMetrics] = None,
client_token: Optional[ClientToken] = None,
domain: Optional[String] = None,
task: Optional[String] = None,
sample_payload_url: Optional[S3Uri] = None,
customer_metadata_properties: Optional[CustomerMetadataMap] = None,
drift_check_baselines: Optional[DriftCheckBaselines] = None,
additional_inference_specifications: Optional[
AdditionalInferenceSpecifications
] = None,
skip_model_validation: Optional[SkipModelValidation] = None,
source_uri: Optional[ModelPackageSourceUri] = None,
security_config: Optional[ModelPackageSecurityConfig] = None,
model_card: Optional[ModelPackageModelCard] = None,
model_life_cycle: Optional[ModelLifeCycle] = None,
managed_storage_type: Optional[ManagedStorageType] = None,
) -> CreateModelPackageOutput
Creates a model package that you can use to create SageMaker models or list on Amazon Web Services Marketplace, or a versioned model that is part of a model group. Buyers can subscribe to model packages listed on Amazon Web Services 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 Web Services Marketplace, provide a value for SourceAlgorithmSpecification.
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.
Parameters:
-
model_package_name(Optional[EntityName], default:None) –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(Optional[ArnOrName], default:None) –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.
-
model_package_description(Optional[EntityDescription], default:None) –A description of the model package.
-
model_package_registration_type(Optional[ModelPackageRegistrationType], default:None) –The package registration type of the model package input.
-
inference_specification(Optional[InferenceSpecification], default:None) –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.
-
-
validation_specification(Optional[ModelPackageValidationSpecification], default:None) –Specifies configurations for one or more transform jobs that SageMaker runs to test the model package.
-
source_algorithm_specification(Optional[SourceAlgorithmSpecification], default:None) –Details about the algorithm that was used to create the model package.
-
certify_for_marketplace(Optional[CertifyForMarketplace], default:None) –Whether to certify the model package for listing on Amazon Web Services Marketplace.
This parameter is optional for unversioned models, and does not apply to versioned models.
-
tags(Optional[TagList], default:None) –A list of key value pairs associated with the model. For more information, see Tagging Amazon Web Services resources in the Amazon Web Services 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 atagargument. -
model_approval_status(Optional[ModelApprovalStatus], default:None) –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
Approvedto deploy the model. -
model_metrics(Optional[ModelMetrics], default:None) –A structure that contains model metrics reports.
-
client_token(Optional[ClientToken], default:None) –A unique token that guarantees that the call to this API is idempotent.
-
domain(Optional[String], default:None) –The machine learning domain of your model package and its components. Common machine learning domains include computer vision and natural language processing.
-
task(Optional[String], default:None) –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.
-
sample_payload_url(Optional[S3Uri], default:None) –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.
-
customer_metadata_properties(Optional[CustomerMetadataMap], default:None) –The metadata properties associated with the model package versions.
-
drift_check_baselines(Optional[DriftCheckBaselines], default:None) –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.
-
additional_inference_specifications(Optional[AdditionalInferenceSpecifications], default:None) –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.
-
skip_model_validation(Optional[SkipModelValidation], default:None) –Indicates if you want to skip model validation.
-
source_uri(Optional[ModelPackageSourceUri], default:None) –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.
-
security_config(Optional[ModelPackageSecurityConfig], default:None) –The KMS Key ID (
KMSKeyId) used for encryption of model package information. -
model_card(Optional[ModelPackageModelCard], default:None) –The model card associated with the model package. Since
ModelPackageModelCardis tied to a model package, it is a specific usage of a model card and its schema is simplified compared to the schema ofModelCard. TheModelPackageModelCardschema does not includemodel_package_details, andmodel_overviewis composed of themodel_creatorandmodel_artifactproperties. For more information about the model package model card schema, see Model package model card schema. For more information about the model card associated with the model package, see View the Details of a Model Version. -
model_life_cycle(Optional[ModelLifeCycle], default:None) –A structure describing the current state of the model in its life cycle.
-
managed_storage_type(Optional[ManagedStorageType], default:None) –The storage type of the model package.
Raises:
-
ConflictException–There was a conflict when you attempted to modify a SageMaker entity such as an
ExperimentorArtifact. -
ResourceLimitExceeded–You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_sagemaker/_services/sage_maker.py
6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 | |