Skip to content

Commit b321882

Browse files
authored
Merge branch 'zwei' into move-shuffle-config
2 parents 15a295f + 4a15832 commit b321882

29 files changed

+1378
-476
lines changed

doc/api/utility/image_uris.rst

+7
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/tensorflow/upgrade_from_legacy.rst

+1-2
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/xgboost/using_xgboost.rst

+5-3
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()

doc/index.rst

-4
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
###########################

doc/v2.rst

+90-24
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,29 @@
1-
##########################################################
2-
Use Version 2.0 of the SageMaker Python SDK (experimental)
3-
##########################################################
4-
5-
Development on v2.0.0 of the SageMaker Python SDK is underway.
6-
For more info on our plans, see https://github.com/aws/sagemaker-python-sdk/issues/1459.
1+
###########################################
2+
Use Version 2.x of the SageMaker Python SDK
3+
###########################################
74

85
.. contents::
96
:local:
7+
:depth: 2
108

119
************
1210
Installation
1311
************
1412

15-
.. warning::
16-
Version 2.0.0 is currently experimental, so proceed with caution. If you do run into issues or have any other feedback,
17-
please let us know by `opening an issue <https://github.com/aws/sagemaker-python-sdk/issues/new/choose>`_
18-
or `commenting on our planning issue <https://github.com/aws/sagemaker-python-sdk/issues/1459>`_.
19-
20-
To install the latest release candidate:
21-
22-
.. code:: bash
23-
24-
pip install git+git://github.com/aws/[email protected]
25-
26-
To install the latest version of v2:
13+
To install the latest version:
2714

2815
.. code:: bash
2916
30-
pip install git+git://github.com/aws/sagemaker-python-sdk.git@zwei
17+
pip install --upgrade sagemaker
3118
3219
If you are executing this pip install command in a notebook, make sure to restart your kernel.
3320

34-
*******
35-
Changes
36-
*******
21+
****************
22+
Breaking Changes
23+
****************
3724

3825
This section is for major changes that may require updates to your SageMaker Python SDK code.
39-
You can also see what changes have been made in the `CHANGELOG <https://github.com/aws/sagemaker-python-sdk/blob/zwei/CHANGELOG.md>`_.
26+
For the full list of changes, see the `CHANGELOG <https://github.com/aws/sagemaker-python-sdk/blob/master/CHANGELOG.md>`_.
4027

4128
Deprecations
4229
============
@@ -94,6 +81,13 @@ Please instantiate the objects instead.
9481
The ``update_endpoint`` argument in ``deploy()`` methods for estimators and models has been deprecated.
9582
Please use :func:`sagemaker.predictor.Predictor.update_endpoint` instead.
9683

84+
``serializer`` and ``deserializer`` in ``create_model()``
85+
---------------------------------------------------------
86+
87+
The ``serializer`` and ``deserializer`` arguments in
88+
:func:`sagemaker.estimator.Estimator.create_model` have been deprecated. Please
89+
specify serializers and deserializers in ``deploy()`` methods instead.
90+
9791
``content_type`` and ``accept`` in the Predictor Constructor
9892
------------------------------------------------------------
9993

@@ -127,8 +121,46 @@ write MIME types as a string,
127121
| ``CONTENT_TYPE_NPY`` | ``"application/x-npy"`` |
128122
+-------------------------------+--------------------------------+
129123

124+
Image URI Functions (e.g. ``get_image_uri``)
125+
--------------------------------------------
126+
127+
The following functions have been deprecated in favor of :func:`sagemaker.image_uris.retrieve`:
128+
129+
- ``sagemaker.amazon_estimator.get_image_uri()``
130+
- ``sagemaker.fw_utils.create_image_uri()``
131+
- ``sagemaker.fw_registry.registry()``
132+
- ``sagemaker.utils.get_ecr_image_uri_prefix()``
133+
134+
For more information about usage, see :func:`sagemaker.image_uris.retrieve`.
135+
136+
SageMaker Python SDK CLI
137+
------------------------
138+
139+
The SageMaker Python SDK CLI has been deprecated.
140+
(This is different from the AWS CLI.)
141+
142+
``enable_cloudwatch_metrics`` for Estimators and Models
143+
-------------------------------------------------------
144+
145+
The parameter ``enable_cloudwatch_metrics`` has been deprecated.
146+
CloudWatch metrics are already emitted for all Training Jobs, etc.
147+
148+
``sagemaker.fw_utils.parse_s3_url``
149+
-----------------------------------
150+
151+
The ``sagemaker.fw_utils.parse_s3_url`` function has been deprecated.
152+
Please use :func:`sagemaker.s3.parse_s3_url` instead.
153+
154+
``sagemaker.session.ModelContainer``
155+
------------------------------------
156+
157+
The class ``sagemaker.session.ModelContainer`` has been deprecated, as it is not needed for creating inference pipelines.
158+
159+
Changes in Default Behavior
160+
===========================
161+
130162
Require ``framework_version`` and ``py_version`` for Frameworks
131-
===============================================================
163+
---------------------------------------------------------------
132164

133165
Framework estimator and model classes now require ``framework_version`` and ``py_version`` instead of supplying defaults,
134166
unless an image URI is explicitly supplied.
@@ -158,6 +190,25 @@ For example:
158190
py_version="py3", # now required
159191
)
160192
193+
Log Display Behavior with ``attach()``
194+
--------------------------------------
195+
196+
Logs are no longer printed when using ``attach()`` with an estimator.
197+
To view logs after attaching a training job to an estimator, use :func:`sagemaker.estimator.EstimatorBase.logs`.
198+
199+
``HyperparameterTuner.fit()`` and ``Transformer.transform()``
200+
-------------------------------------------------------------
201+
202+
:func:`sagemaker.tuner.HyperparameterTuner.fit` and :func:`sagemaker.transformer.Transformer.transform` now wait
203+
until the completion of the Hyperparameter Tuning Job or Batch Transform Job, respectively.
204+
To make the function non-blocking, use ``wait=False``.
205+
206+
XGBoost Predictor
207+
-----------------
208+
209+
The default serializer of ``sagemaker.xgboost.model.XGBoostPredictor`` has been changed from ``NumpySerializer`` to ``LibSVMSerializer``.
210+
211+
161212
Parameter and Class Name Changes
162213
================================
163214

@@ -218,6 +269,8 @@ The follow serializer/deserializer classes have been renamed and/or moved:
218269
| ``sagemaker.predictor._JsonDeserializer`` | ``sagemaker.deserializers.JSONDeserializer`` |
219270
+--------------------------------------------------------+-------------------------------------------------------+
220271

272+
``sagemaker.serializers.LibSVMSerializer`` has been added in v2.0.
273+
221274
``distributions``
222275
~~~~~~~~~~~~~~~~~
223276

@@ -281,6 +334,19 @@ TensorFlow Serving Predictor
281334
(For the previous implementation of that class, see `Deprecate Legacy TensorFlow <#deprecate-legacy-tensorflow>`_).
282335

283336

337+
Inputs
338+
------
339+
340+
``s3_input``
341+
~~~~~~~~~~~~
342+
343+
``sagemaker.session.s3_input`` has been renamed to :class:`sagemaker.inputs.TrainingInput`.
344+
345+
``ShuffleConfig``
346+
~~~~~~~~~~~~~~~~~
347+
348+
``sagemaker.session.ShuffleConfig`` has been renamed to :class:`sagemaker.inputs.ShuffleConfig`.
349+
284350
Airflow
285351
-------
286352

src/sagemaker/automl/automl.py

+14
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ def deploy(
337337
self,
338338
initial_instance_count,
339339
instance_type,
340+
serializer=None,
341+
deserializer=None,
340342
candidate=None,
341343
sagemaker_session=None,
342344
name=None,
@@ -356,6 +358,16 @@ def deploy(
356358
in the ``Endpoint`` created from this ``Model``.
357359
instance_type (str): The EC2 instance type to deploy this Model to.
358360
For example, 'ml.p2.xlarge'.
361+
serializer (:class:`~sagemaker.serializers.BaseSerializer`): A
362+
serializer object, used to encode data for an inference endpoint
363+
(default: None). If ``serializer`` is not None, then
364+
``serializer`` will override the default serializer. The
365+
default serializer is set by the ``predictor_cls``.
366+
deserializer (:class:`~sagemaker.deserializers.BaseDeserializer`): A
367+
deserializer object, used to decode data from an inference
368+
endpoint (default: None). If ``deserializer`` is not None, then
369+
``deserializer`` will override the default deserializer. The
370+
default deserializer is set by the ``predictor_cls``.
359371
candidate (CandidateEstimator or dict): a CandidateEstimator used for deploying
360372
to a SageMaker Inference Pipeline. If None, the best candidate will
361373
be used. If the candidate input is a dict, a CandidateEstimator will be
@@ -405,6 +417,8 @@ def deploy(
405417
return model.deploy(
406418
initial_instance_count=initial_instance_count,
407419
instance_type=instance_type,
420+
serializer=serializer,
421+
deserializer=deserializer,
408422
endpoint_name=endpoint_name,
409423
tags=tags,
410424
wait=wait,

src/sagemaker/cli/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying athis file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Tools for automating code updates"""
14+
from __future__ import absolute_import

0 commit comments

Comments
 (0)