Transformer¶
-
class
sagemaker.transformer.
Transformer
(model_name, instance_count, instance_type, strategy=None, assemble_with=None, output_path=None, output_kms_key=None, accept=None, max_concurrent_transforms=None, max_payload=None, tags=None, env=None, base_transform_job_name=None, sagemaker_session=None, volume_kms_key=None)¶ Bases:
object
A class for handling creating and interacting with Amazon SageMaker transform jobs.
Initialize a
Transformer
.- Parameters
model_name (str) – Name of the SageMaker model being used for the transform job.
instance_count (int) – Number of EC2 instances to use.
instance_type (str) – Type of EC2 instance to use, for example, ‘ml.c4.xlarge’.
strategy (str) – The strategy used to decide how to batch records in a single request (default: None). Valid values: ‘MultiRecord’ and ‘SingleRecord’.
assemble_with (str) – How the output is assembled (default: None). Valid values: ‘Line’ or ‘None’.
output_path (str) – S3 location for saving the transform result. If not specified, results are stored to a default bucket.
output_kms_key (str) – Optional. KMS key ID for encrypting the transform output (default: None).
accept (str) – The accept header passed by the client to the inference endpoint. If it is supported by the endpoint, it will be the format of the batch transform output.
max_concurrent_transforms (int) – The maximum number of HTTP requests to be made to each individual transform container at one time.
max_payload (int) – Maximum size of the payload in a single HTTP request to the container in MB.
tags (list[dict]) – List of tags for labeling a transform job (default: None). For more, see the SageMaker API documentation for Tag.
env (dict) – Environment variables to be set for use during the transform job (default: None).
base_transform_job_name (str) – Prefix for the transform job when the
transform()
method launches. If not specified, a default prefix will be generated based on the training image name that was used to train the model associated with the transform job.sagemaker_session (sagemaker.session.Session) – Session object which manages interactions with Amazon SageMaker APIs and any other AWS services needed. If not specified, the estimator creates one using the default AWS configuration chain.
volume_kms_key (str) – Optional. KMS key ID for encrypting the volume attached to the ML compute instance (default: None).
-
transform
(**kwargs)¶
-
delete_model
()¶ Delete the corresponding SageMaker model for this Transformer.
-
wait
(logs=True)¶ Placeholder docstring
-
stop_transform_job
(wait=True)¶ Stop latest running batch transform job.
-
classmethod
attach
(transform_job_name, sagemaker_session=None)¶ Attach an existing transform job to a new Transformer instance
- Parameters
transform_job_name (str) – Name for the transform job to be attached.
sagemaker_session (sagemaker.session.Session) – Session object which manages interactions with Amazon SageMaker APIs and any other AWS services needed. If not specified, one will be created using the default AWS configuration chain.
- Returns
The Transformer instance with the specified transform job attached.
- Return type