Skip to content

Commit da5d048

Browse files
authored
Merge branch 'zwei' into image-uris-migration
2 parents 9546f96 + c4bb695 commit da5d048

File tree

114 files changed

+2744
-1371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+2744
-1371
lines changed

CHANGELOG.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,79 @@
11
# Changelog
22

3+
## v1.72.0 (2020-07-29)
4+
5+
### Features
6+
7+
* Neo: Add Granular Target Description support for compilation
8+
9+
### Documentation Changes
10+
11+
* Add xgboost doc on bring your own model
12+
* fix typos on processing docs
13+
14+
## v1.71.1 (2020-07-27)
15+
16+
### Bug Fixes and Other Changes
17+
18+
* remove redundant information from the user_agent string.
19+
20+
### Testing and Release Infrastructure
21+
22+
* use unique model name in TFS integ tests
23+
* use pytest-cov instead of coverage
24+
25+
## v1.71.0 (2020-07-23)
26+
27+
### Features
28+
29+
* Add mpi support for mxnet estimator api
30+
31+
### Bug Fixes and Other Changes
32+
33+
* use 'sagemaker' logger instead of root logger
34+
* account for "py36" and "py37" in image tag parsing
35+
36+
## v1.70.2 (2020-07-22)
37+
38+
### Bug Fixes and Other Changes
39+
40+
* convert network_config in processing_config to dict
41+
42+
### Documentation Changes
43+
44+
* Add ECR URI Estimator example
45+
46+
## v1.70.1 (2020-07-21)
47+
48+
### Bug Fixes and Other Changes
49+
50+
* Nullable fields in processing_config
51+
52+
## v1.70.0 (2020-07-20)
53+
54+
### Features
55+
56+
* Add model monitor support for us-gov-west-1
57+
* support TFS 2.2
58+
59+
### Bug Fixes and Other Changes
60+
61+
* reshape Artifacts into data frame in ExperimentsAnalytics
62+
63+
### Documentation Changes
64+
65+
* fix MXNet version info for requirements.txt support
66+
67+
## v1.69.0 (2020-07-09)
68+
69+
### Features
70+
71+
* Add ModelClientConfig Fields for Batch Transform
72+
73+
### Documentation Changes
74+
75+
* add KFP Processing component
76+
377
## v2.0.0.rc1 (2020-07-08)
478

579
### Breaking Changes

buildspec-unittests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ phases:
77
- TOX_PARALLEL_NO_SPINNER=1
88
- PY_COLORS=0
99
- start_time=`date +%s`
10-
- tox -e flake8,pylint,twine,black-check
10+
- tox -e flake8,pylint,twine,black-check --parallel all
1111
- ./ci-scripts/displaytime.sh 'flake8,pylint,twine,black-check' $start_time
1212

1313
- start_time=`date +%s`
14-
- tox -e sphinx,doc8
14+
- tox -e sphinx,doc8 --parallel all
1515
- ./ci-scripts/displaytime.sh 'sphinx,doc8' $start_time
1616

1717
# run unit tests

doc/amazon_sagemaker_processing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ Amazon SageMaker Processing allows you to run steps for data pre- or post-proces
1010
Background
1111
==========
1212

13-
Amazon SageMaker lets developers and data scientists train and deploy machine learning models. With Amazon SageMaker Processing, you can run processing jobs on for data processing steps in your machine learning pipeline, which accept data from Amazon S3 as input, and put data into Amazon S3 as output.
13+
Amazon SageMaker lets developers and data scientists train and deploy machine learning models. With Amazon SageMaker Processing, you can run processing jobs for data processing steps in your machine learning pipeline. Processing jobs accept data from Amazon S3 as input and store data into Amazon S3 as output.
1414

1515
.. image:: ./amazon_sagemaker_processing_image1.png
1616

1717
Setup
1818
=====
1919

20-
The fastest way to run get started with Amazon SageMaker Processing is by running a Jupyter notebook. You can follow the `Getting Started with Amazon SageMaker`_ guide to start running notebooks on Amazon SageMaker.
20+
The fastest way to get started with Amazon SageMaker Processing is by running a Jupyter notebook. You can follow the `Getting Started with Amazon SageMaker`_ guide to start running notebooks on Amazon SageMaker.
2121

2222
.. _Getting Started with Amazon SageMaker: https://docs.aws.amazon.com/sagemaker/latest/dg/gs.html
2323

doc/api/utility/image_uris.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Image URIs
2+
----------
3+
4+
.. automodule:: sagemaker.image_uris
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

doc/frameworks/mxnet/using_mxnet.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,14 @@ If there are other packages you want to use with your script, you can include a
159159
Both ``requirements.txt`` and your training script should be put in the same folder.
160160
You must specify this folder in ``source_dir`` argument when creating an MXNet estimator.
161161

162-
The function of installing packages using ``requirements.txt`` is supported for all MXNet versions during training.
162+
The function of installing packages using ``requirements.txt`` is supported for MXNet versions 1.3.0 and higher during training.
163+
163164
When serving an MXNet model, support for this function varies with MXNet versions.
164165
For MXNet 1.6.0 or newer, ``requirements.txt`` must be under folder ``code``.
165166
The SageMaker MXNet Estimator automatically saves ``code`` in ``model.tar.gz`` after training (assuming you set up your script and ``requirements.txt`` correctly as stipulated in the previous paragraph).
166167
In the case of bringing your own trained model for deployment, you must save ``requirements.txt`` under folder ``code`` in ``model.tar.gz`` yourself or specify it through ``dependencies``.
167-
For MXNet 1.4.1, ``requirements.txt`` is not supported for inference.
168-
For MXNet 0.12.1-1.3.0, ``requirements.txt`` must be in ``source_dir``.
168+
For MXNet 0.12.1-1.2.1, 1.4.0-1.4.1, ``requirements.txt`` is not supported for inference.
169+
For MXNet 1.3.0, ``requirements.txt`` must be in ``source_dir``.
169170

170171
A ``requirements.txt`` file is a text file that contains a list of items that are installed by using ``pip install``.
171172
You can also specify the version of an item to install.

doc/frameworks/tensorflow/upgrade_from_legacy.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ For example, if you want to use JSON serialization and deserialization:
248248
from sagemaker.deserializers import JSONDeserializer
249249
from sagemaker.serializers import JSONSerializer
250250
251-
predictor.serializer = JSONSerializer()
252-
predictor.deserializer = JSONDeserializer()
251+
predictor = model.deploy(..., serializer=JSONSerializer(), deserializer=JSONDeserializer())
253252
254253
predictor.predict(data)

doc/frameworks/tensorflow/using_tf.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,28 @@ To use Python 3.7, please specify both of the args:
178178
Where the S3 url is a path to your training data within Amazon S3.
179179
The constructor keyword arguments define how SageMaker runs your training script.
180180

181+
Specify a Docker image using an Estimator
182+
-----------------------------------------
183+
184+
There are use cases, such as extending an existing pre-built Amazon SageMaker images, that require specifing a Docker image when creating an Estimator by directly specifying the ECR URI instead of the Python and framework version. For a full list of available container URIs, see `Available Deep Learning Containers Images <https://github.com/aws/deep-learning-containers/blob/master/available_images.md>`__ For more information on using Docker containers, see `Use Your Own Algorithms or Models with Amazon SageMaker <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms.html>`__.
185+
186+
When specifying the image, you must use the ``image_name=''`` arg to replace the following arg:
187+
188+
- ``py_version=''``
189+
190+
You should still specify the ``framework_version=''`` arg because the SageMaker Python SDK accomodates for differences in the images based on the version.
191+
192+
The following example uses the ``image_name=''`` arg to specify the container image, Python version, and framework version.
193+
194+
.. code:: python
195+
196+
tf_estimator = TensorFlow(entry_point='tf-train.py',
197+
role='SageMakerRole',
198+
train_instance_count=1,
199+
train_instance_type='ml.p2.xlarge',
200+
image_name='763104351884.dkr.ecr.<region>.amazonaws.com/<framework>-<job type>:<framework version>-<cpu/gpu>-<python version>-ubuntu18.04',
201+
script_mode=True)
202+
181203
For more information about the sagemaker.tensorflow.TensorFlow estimator, see `SageMaker TensorFlow Classes`_.
182204

183205
Call the fit Method

doc/frameworks/xgboost/using_xgboost.rst

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,14 @@ inference against your model.
192192

193193
.. code::
194194
195+
serializer = StringSerializer()
196+
serializer.CONTENT_TYPE = "text/libsvm"
197+
195198
predictor = estimator.deploy(
196199
initial_instance_count=1,
197-
instance_type="ml.m5.xlarge"
200+
instance_type="ml.m5.xlarge",
201+
serializer=serializer
198202
)
199-
predictor.serializer = str
200-
predictor.content_type = "text/libsvm"
201203
202204
with open("abalone") as f:
203205
payload = f.read()
@@ -390,6 +392,56 @@ The function should return a byte array of data serialized to ``content_type``.
390392
The default implementation expects ``prediction`` to be a NumPy array and can serialize the result to JSON, CSV, or NPY.
391393
It accepts response content types of "application/json", "text/csv", and "application/x-npy".
392394

395+
Bring Your Own Model
396+
--------------------
397+
398+
You can deploy an XGBoost model that you trained outside of SageMaker by using the Amazon SageMaker XGBoost container.
399+
Typically, you save an XGBoost model by pickling the ``Booster`` object or calling ``booster.save_model``.
400+
The XGBoost `built-in algorithm mode <https://docs.aws.amazon.com/sagemaker/latest/dg/xgboost.html#xgboost-modes>`_
401+
supports both a pickled ``Booster`` object and a model produced by ``booster.save_model``.
402+
You can also deploy an XGBoost model by using XGBoost as a framework.
403+
By using XGBoost as a framework, you have more flexibility.
404+
To deploy an XGBoost model by using XGBoost as a framework, you need to:
405+
406+
- Write an inference script.
407+
- Create the XGBoostModel object.
408+
409+
Write an Inference Script
410+
^^^^^^^^^^^^^^^^^^^^^^^^^
411+
412+
You must create an inference script that implements (at least) the ``model_fn`` function that calls the loaded model to get a prediction.
413+
414+
Optionally, you can also implement ``input_fn`` and ``output_fn`` to process input and output,
415+
and ``predict_fn`` to customize how the model server gets predictions from the loaded model.
416+
For information about how to write an inference script, see `SageMaker XGBoost Model Server <#sagemaker-xgboost-model-server>`_.
417+
Pass the filename of the inference script as the ``entry_point`` parameter when you create the `XGBoostModel` object.
418+
419+
Create an XGBoostModel Object
420+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
421+
422+
To create a model object, call the ``sagemaker.xgboost.model.XGBoostModel`` constructor,
423+
and then call its ``deploy()`` method to deploy your model for inference.
424+
425+
.. code:: python
426+
427+
xgboost_model = XGBoostModel(
428+
model_data="s3://my-bucket/my-path/model.tar.gz",
429+
role="my-role",
430+
entry_point="inference.py",
431+
framework_version="1.0-1"
432+
)
433+
434+
predictor = xgboost_model.deploy(
435+
instance_type='ml.c4.xlarge',
436+
initial_instance_count=1
437+
)
438+
439+
# If payload is a string in LIBSVM format, we need to change serializer.
440+
predictor.serializer = str
441+
predictor.predict("<label> <index1>:<value1> <index2>:<value2>")
442+
443+
To get predictions from your deployed model, you can call the ``predict()`` method.
444+
393445
Host Multiple Models with Multi-Model Endpoints
394446
-----------------------------------------------
395447

@@ -401,7 +453,6 @@ in the AWS documentation.
401453
For a sample notebook that uses Amazon SageMaker to deploy multiple XGBoost models to an endpoint, see the
402454
`Multi-Model Endpoint XGBoost Sample Notebook <https://github.com/awslabs/amazon-sagemaker-examples/blob/master/advanced_functionality/multi_model_xgboost_home_value/xgboost_multi_model_endpoint_home_value.ipynb>`_.
403455

404-
405456
*************************
406457
SageMaker XGBoost Classes
407458
*************************

doc/index.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. important::
2-
We are working on v2.0.0. See https://github.com/aws/sagemaker-python-sdk/issues/1459
3-
for more info on our plans and to leave feedback!
4-
51
###########################
62
Amazon SageMaker Python SDK
73
###########################

0 commit comments

Comments
 (0)