Skip to content

Commit 266a805

Browse files
eslesar-awslaurenyu
authored andcommitted
Update inference pipelines documentation (#708)
1 parent f32abfa commit 266a805

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

CHANGELOG.rst

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77

88
* doc-fix: Move workflow and PyTorch readme content into sphinx project
99
* doc-fix: Fix broken links in using_tensorflow.rst
10+
* doc-fix: Update inference pipelines documentation
1011

1112
1.18.5
1213
======

doc/overview.rst

+32-3
Original file line numberDiff line numberDiff line change
@@ -658,10 +658,10 @@ the ML Pipeline.
658658
endpoint_name = 'inference-pipeline-endpoint'
659659
sm_model = PipelineModel(name=model_name, role=sagemaker_role, models=[sparkml_model, xgb_model])
660660
661-
This will define a ``PipelineModel`` consisting of SparkML model and an XGBoost model stacked sequentially. For more
662-
information about how to train an XGBoost model, please refer to the XGBoost notebook here_.
661+
This defines a ``PipelineModel`` consisting of SparkML model and an XGBoost model stacked sequentially.
662+
For more information about how to train an XGBoost model, please refer to the XGBoost notebook here_.
663663
664-
.. _here: https://docs.aws.amazon.com/sagemaker/latest/dg/xgboost.html#xgboost-sample-notebooks
664+
.. _here: https://github.com/awslabs/amazon-sagemaker-examples/blob/master/introduction_to_amazon_algorithms/xgboost_abalone/xgboost_abalone.ipynb
665665
666666
.. code:: python
667667
@@ -671,6 +671,35 @@ This returns a predictor the same way an ``Estimator`` does when ``deploy()`` is
671671
request using this predictor, you should pass the data that the first container expects and the predictor will return the
672672
output from the last container.
673673
674+
You can also use a ``PipelineModel`` to create Transform Jobs for batch transformations. Using the same ``PipelineModel`` ``sm_model`` as above:
675+
676+
.. code:: python
677+
678+
# Only instance_type and instance_count are required.
679+
transformer = sm_model.transformer(instance_type='ml.c5.xlarge',
680+
instance_count=1,
681+
strategy='MultiRecord',
682+
max_payload=6,
683+
max_concurrent_transforms=8,
684+
accept='text/csv',
685+
assemble_with='Line',
686+
output_path='s3://my-output-bucket/path/to/my/output/data/')
687+
# Only data is required.
688+
transformer.transform(data='s3://my-input-bucket/path/to/my/csv/data',
689+
content_type='text/csv',
690+
split_type='Line')
691+
# Waits for the Pipeline Transform Job to finish.
692+
transformer.wait()
693+
694+
This runs a transform job against all the files under ``s3://mybucket/path/to/my/csv/data``, transforming the input
695+
data in order with each model container in the pipeline. For each input file that was successfully transformed, one output file in ``s3://my-output-bucket/path/to/my/output/data/``
696+
will be created with the same name, appended with '.out'.
697+
This transform job will split CSV files by newline separators, which is especially useful if the input files are large.
698+
The Transform Job assembles the outputs with line separators when writing each input file's corresponding output file.
699+
Each payload entering the first model container will be up to six megabytes, and up to eight inference requests are sent at the
700+
same time to the first model container. Because each payload consists of a mini-batch of multiple CSV records, the model
701+
containers transform each mini-batch of records.
702+
674703
For comprehensive examples on how to use Inference Pipelines please refer to the following notebooks:
675704
676705
- `inference_pipeline_sparkml_xgboost_abalone.ipynb <https://github.com/awslabs/amazon-sagemaker-examples/blob/master/advanced_functionality/inference_pipeline_sparkml_xgboost_abalone/inference_pipeline_sparkml_xgboost_abalone.ipynb>`__

0 commit comments

Comments
 (0)