PipelineModel — sagemaker 2.247.0 documentation (original) (raw)

class sagemaker.pipeline.PipelineModel(models, role=None, predictor_cls=None, name=None, vpc_config=None, sagemaker_session=None, enable_network_isolation=None)

Bases: object

A pipeline of SageMaker Model instances.

This pipeline can be deployed as an Endpoint on SageMaker.

Initialize a SageMaker Model instance.

The Model can be used to build an Inference Pipeline comprising of multiple model containers.

Parameters:

pipeline_container_def(instance_type=None)

The pipeline definition for deploying this model.

This is the dict created by sagemaker.pipeline_container_def().

The instance type to be used may be specified.

Subclasses can override this to provide custom container definitions for deployment to a specific instance type. Called by deploy().

Parameters:

instance_type (str) – The EC2 instance type to deploy this Model to. For example, ‘ml.p2.xlarge’.

Returns:

A list of container definition objects usable with the CreateModel API in the scenario of multiple containers (Inference Pipeline).

Return type:

list[dict[str, str]]

deploy(initial_instance_count, instance_type, serializer=None, deserializer=None, endpoint_name=None, tags=None, wait=True, update_endpoint=False, data_capture_config=None, kms_key=None, volume_size=None, model_data_download_timeout=None, container_startup_health_check_timeout=None)

Deploy the Model to an Endpoint.

It optionally return a Predictor.

Create a SageMaker Model and EndpointConfig, and deploy anEndpoint from this Model. If self.predictor_cls is not None, this method returns a the result of invoking self.predictor_cls on the created endpoint name.

The name of the created model is accessible in the name field of this Model after deploy returns

The name of the created endpoint is accessible in theendpoint_name field of this Model after deploy returns.

Parameters:

Returns:

Invocation ofself.predictor_cls on the created endpoint name, if self.predictor_clsis not None. Otherwise, return None.

Return type:

Optional[Callable[[string, sagemaker.session.Session], Any]]

create(instance_type)

Create a SageMaker Model Entity

Parameters:

instance_type (str) – The EC2 instance type that this Model will be used for, this is only used to determine if the image needs GPU support or not.

register(content_types=None, response_types=None, inference_instances=None, transform_instances=None, model_package_name=None, model_package_group_name=None, image_uri=None, model_metrics=None, metadata_properties=None, marketplace_cert=False, approval_status=None, description=None, drift_check_baselines=None, customer_metadata_properties=None, domain=None, sample_payload_url=None, task=None, framework=None, framework_version=None, nearest_model_name=None, data_input_configuration=None, skip_model_validation=None, source_uri=None, model_card=None)

Creates a model package for creating SageMaker models or listing on Marketplace.

Parameters:

Returns:

If sagemaker_session is a PipelineSession instance, returns pipeline step

arguments. Otherwise, returns None

transformer(instance_count, instance_type, strategy=None, assemble_with=None, output_path=None, output_kms_key=None, accept=None, env=None, max_concurrent_transforms=None, max_payload=None, tags=None, volume_kms_key=None)

Return a Transformer that uses this Model.

Parameters:

delete_model()

Delete the SageMaker model backing this pipeline model.

This does not delete the list of SageMaker models used in multiple containers to build the inference pipeline.