Skip to content

Commit 02350ff

Browse files
authored
doc: clarify non-breaking changes after v1 forward port (#1974)
After #1939, some items are no longer breaking changes in v2. This commit updates the documentation accordingly.
1 parent b69b1d6 commit 02350ff

File tree

1 file changed

+142
-127
lines changed

1 file changed

+142
-127
lines changed

doc/v2.rst

Lines changed: 142 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ Removals
3131
Python 2 Support
3232
----------------
3333

34-
This library is no longer supported for Python 2.
34+
This library is no longer compatible with Python 2.
35+
Python 2 has been EOL since January 1, 2020.
3536
Please upgrade to Python 3 if you haven't already.
3637

3738
Remove Legacy TensorFlow
@@ -45,117 +46,44 @@ To use those versions of TensorFlow, you must specify the Docker image URI expli
4546
and configure settings via hyperparameters or environment variables rather than using SDK parameters.
4647
For more information, see `Upgrade from Legacy TensorFlow Support <frameworks/tensorflow/upgrade_from_legacy.html>`_.
4748

49+
SageMaker Python SDK CLI
50+
------------------------
51+
52+
The SageMaker Python SDK CLI has been removed.
53+
(This is different from the AWS CLI.)
54+
4855
``delete_endpoint()`` for Estimators and ``HyperparameterTuner``
4956
----------------------------------------------------------------
5057

51-
The ``delete_endpoint()`` method for estimators and ``HyperparameterTuner`` has been removed.
58+
The ``delete_endpoint()`` method for estimators and ``HyperparameterTuner`` is now a no-op.
5259
Please use :func:`sagemaker.predictor.Predictor.delete_endpoint` instead.
5360

54-
Pre-instantiated Serializer and Deserializer Objects
55-
----------------------------------------------------
56-
57-
The ``csv_serializer``, ``json_serializer``, ``npy_serializer``, ``csv_deserializer``,
58-
``json_deserializer``, and ``numpy_deserializer`` objects have been removed.
59-
60-
Please instantiate the objects instead.
61-
62-
+--------------------------------------------+------------------------------------------------+
63-
| v1.x | v2.0 and later |
64-
+============================================+================================================+
65-
| ``sagemaker.predictor.csv_serializer`` | ``sagemaker.serializers.CSVSerializer()`` |
66-
+--------------------------------------------+------------------------------------------------+
67-
| ``sagemaker.predictor.json_serializer`` | ``sagemaker.serializers.JSONSerializer()`` |
68-
+--------------------------------------------+------------------------------------------------+
69-
| ``sagemaker.predictor.npy_serializer`` | ``sagemaker.serializers.NumpySerializer()`` |
70-
+--------------------------------------------+------------------------------------------------+
71-
| ``sagemaker.predictor.csv_deserializer`` | ``sagemaker.deserializers.CSVDeserializer()`` |
72-
+--------------------------------------------+------------------------------------------------+
73-
| ``sagemaker.predictor.json_deserializer`` | ``sagemaker.deserializers.JSONDeserializer()`` |
74-
+--------------------------------------------+------------------------------------------------+
75-
| ``sagemaker.predictor.numpy_deserializer`` | ``sagemaker.deserializers.NumpyDeserializer()``|
76-
+--------------------------------------------+------------------------------------------------+
77-
7861
``update_endpoint`` in ``deploy()``
7962
-----------------------------------
8063

81-
The ``update_endpoint`` argument in ``deploy()`` methods for estimators and models has been removed.
64+
The ``update_endpoint`` argument in ``deploy()`` methods for estimators and models is now a no-op.
8265
Please use :func:`sagemaker.predictor.Predictor.update_endpoint` instead.
8366

8467
``serializer`` and ``deserializer`` in ``create_model()``
8568
---------------------------------------------------------
8669

8770
The ``serializer`` and ``deserializer`` arguments in
88-
:func:`sagemaker.estimator.Estimator.create_model` have been removed. Please
89-
specify serializers and deserializers in ``deploy()`` methods instead.
71+
:func:`sagemaker.estimator.Estimator.create_model` are now no-ops.
72+
Please specify serializers and deserializers in ``deploy()`` methods instead.
9073

9174
``content_type`` and ``accept`` in the Predictor Constructor
9275
------------------------------------------------------------
9376

94-
The ``content_type`` and ``accept`` parameters have been removed from the
77+
The ``content_type`` and ``accept`` parameters are now no-ops in the
9578
following classes and methods:
79+
9680
- ``sagemaker.predictor.Predictor``
9781
- ``sagemaker.estimator.Estimator.create_model``
9882
- ``sagemaker.algorithms.AlgorithmEstimator.create_model``
9983
- ``sagemaker.tensorflow.model.TensorFlowPredictor``
10084

10185
Please specify content types in a serializer or deserializer class instead.
10286

103-
``sagemaker.content_types``
104-
---------------------------
105-
106-
The ``sagemaker.content_types`` module is removed in v2.0 and later of the
107-
SageMaker Python SDK.
108-
109-
Instead of importing constants from ``sagemaker.content_types``, explicitly
110-
write MIME types as a string,
111-
112-
+-------------------------------+--------------------------------+
113-
| v1.x | v2.0 and later |
114-
+===============================+================================+
115-
| ``CONTENT_TYPE_JSON`` | ``"application/json"`` |
116-
+-------------------------------+--------------------------------+
117-
| ``CONTENT_TYPE_CSV`` | ``"text/csv"`` |
118-
+-------------------------------+--------------------------------+
119-
| ``CONTENT_TYPE_OCTET_STREAM`` | ``"application/octet-stream"`` |
120-
+-------------------------------+--------------------------------+
121-
| ``CONTENT_TYPE_NPY`` | ``"application/x-npy"`` |
122-
+-------------------------------+--------------------------------+
123-
124-
Image URI Functions (e.g. ``get_image_uri``)
125-
--------------------------------------------
126-
127-
The following functions have been removed 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 removed.
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 removed.
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 removed.
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 removed, as it is not needed for creating inference pipelines.
158-
15987
Changes in Default Behavior
16088
===========================
16189

@@ -209,6 +137,134 @@ XGBoost Predictor
209137
The default serializer of ``sagemaker.xgboost.model.XGBoostPredictor`` has been changed from ``NumpySerializer`` to ``LibSVMSerializer``.
210138

211139

140+
Parameter Order Changes
141+
=======================
142+
143+
``sagemaker.model.Model`` Parameter Order
144+
-----------------------------------------
145+
146+
The parameter order for :class:`sagemaker.model.Model` changed: instead of ``model_data`` being first, ``image_uri`` (formerly ``image``) is first.
147+
As a result, ``model_data`` has been made into an optional parameter.
148+
149+
If you are using the :class:`sagemaker.model.Model` class, your code should be changed as follows:
150+
151+
.. code:: python
152+
153+
# v1.x
154+
Model("s3://bucket/path/model.tar.gz", "my-image:latest")
155+
156+
# v2.0 and later
157+
Model("my-image:latest", model_data="s3://bucket/path/model.tar.gz")
158+
159+
Airflow Parameter Order
160+
-----------------------
161+
162+
For :func:`sagemaker.workflow.airflow.model_config` and :func:`sagemaker.workflow.airflow.model_config_from_estimator`,
163+
``instance_type`` is no longer the first positional argument and is now an optional keyword argument.
164+
165+
Dependency Changes
166+
==================
167+
168+
SciPy
169+
-----
170+
171+
SciPy is no longer a required dependency of the SageMaker Python SDK.
172+
173+
If you use :func:`sagemaker.amazon.common.write_spmatrix_to_sparse_tensor` and
174+
don't already install SciPy in your environment, you can use our ``scipy`` installation target:
175+
176+
.. code:: bash
177+
178+
pip install sagemaker[scipy]
179+
180+
TensorFlow
181+
----------
182+
183+
The ``tensorflow`` installation target has been removed, as it is no longer needed for any SageMaker Python SDK functionality.
184+
185+
If you want to install TensorFlow, see `the TensorFlow documentation <https://www.tensorflow.org/install>`_.
186+
187+
********************
188+
Non-Breaking Changes
189+
********************
190+
191+
Deprecations
192+
============
193+
194+
Pre-instantiated Serializer and Deserializer Objects
195+
----------------------------------------------------
196+
197+
The ``csv_serializer``, ``json_serializer``, ``npy_serializer``, ``csv_deserializer``,
198+
``json_deserializer``, and ``numpy_deserializer`` objects have been deprecated.
199+
200+
Please instantiate the objects instead.
201+
202+
+--------------------------------------------+------------------------------------------------+
203+
| v1.x | v2.0 and later |
204+
+============================================+================================================+
205+
| ``sagemaker.predictor.csv_serializer`` | ``sagemaker.serializers.CSVSerializer()`` |
206+
+--------------------------------------------+------------------------------------------------+
207+
| ``sagemaker.predictor.json_serializer`` | ``sagemaker.serializers.JSONSerializer()`` |
208+
+--------------------------------------------+------------------------------------------------+
209+
| ``sagemaker.predictor.npy_serializer`` | ``sagemaker.serializers.NumpySerializer()`` |
210+
+--------------------------------------------+------------------------------------------------+
211+
| ``sagemaker.predictor.csv_deserializer`` | ``sagemaker.deserializers.CSVDeserializer()`` |
212+
+--------------------------------------------+------------------------------------------------+
213+
| ``sagemaker.predictor.json_deserializer`` | ``sagemaker.deserializers.JSONDeserializer()`` |
214+
+--------------------------------------------+------------------------------------------------+
215+
| ``sagemaker.predictor.numpy_deserializer`` | ``sagemaker.deserializers.NumpyDeserializer()``|
216+
+--------------------------------------------+------------------------------------------------+
217+
218+
``sagemaker.content_types``
219+
---------------------------
220+
221+
The ``sagemaker.content_types`` module is deprecated in v2.0 and later of the
222+
SageMaker Python SDK.
223+
224+
Instead of importing constants from ``sagemaker.content_types``, explicitly
225+
write MIME types as a string.
226+
227+
+-------------------------------+--------------------------------+
228+
| v1.x | v2.0 and later |
229+
+===============================+================================+
230+
| ``CONTENT_TYPE_JSON`` | ``"application/json"`` |
231+
+-------------------------------+--------------------------------+
232+
| ``CONTENT_TYPE_CSV`` | ``"text/csv"`` |
233+
+-------------------------------+--------------------------------+
234+
| ``CONTENT_TYPE_OCTET_STREAM`` | ``"application/octet-stream"`` |
235+
+-------------------------------+--------------------------------+
236+
| ``CONTENT_TYPE_NPY`` | ``"application/x-npy"`` |
237+
+-------------------------------+--------------------------------+
238+
239+
Image URI Functions (e.g. ``get_image_uri``)
240+
--------------------------------------------
241+
242+
The following functions have been deprecated in favor of :func:`sagemaker.image_uris.retrieve`:
243+
244+
- ``sagemaker.amazon_estimator.get_image_uri()``
245+
- ``sagemaker.fw_utils.create_image_uri()``
246+
- ``sagemaker.fw_registry.registry()``
247+
- ``sagemaker.utils.get_ecr_image_uri_prefix()``
248+
249+
For more information about usage, see :func:`sagemaker.image_uris.retrieve`.
250+
251+
``enable_cloudwatch_metrics`` for Estimators and Models
252+
-------------------------------------------------------
253+
254+
The parameter ``enable_cloudwatch_metrics`` has been deprecated.
255+
CloudWatch metrics are already emitted for all Training Jobs, etc.
256+
257+
``sagemaker.fw_utils.parse_s3_url``
258+
-----------------------------------
259+
260+
The ``sagemaker.fw_utils.parse_s3_url`` function has been deprecated.
261+
Please use :func:`sagemaker.s3.parse_s3_url` instead.
262+
263+
``sagemaker.session.ModelContainer``
264+
------------------------------------
265+
266+
The class ``sagemaker.session.ModelContainer`` has been deprecated, as it is not needed for creating inference pipelines.
267+
212268
Parameter and Class Name Changes
213269
================================
214270

@@ -285,22 +341,6 @@ The ``image_name`` parameter has been renamed to ``image_uri`` for specifying a
285341
Models
286342
------
287343

288-
``sagemaker.model.Model`` Parameter Order
289-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290-
291-
The parameter order for :class:`sagemaker.model.Model` changed: instead of ``model_data`` being first, ``image_uri`` (formerly ``image``) is first.
292-
As a result, ``model_data`` has been made into an optional parameter.
293-
294-
If you are using the :class:`sagemaker.model.Model` class, your code should be changed as follows:
295-
296-
.. code:: python
297-
298-
# v1.x
299-
Model("s3://bucket/path/model.tar.gz", "my-image:latest")
300-
301-
# v2.0 and later
302-
Model("my-image:latest", model_data="s3://bucket/path/model.tar.gz")
303-
304344
Specify Custom Serving Image
305345
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
306346

@@ -350,34 +390,9 @@ Inputs
350390
Airflow
351391
-------
352392

353-
For :func:`sagemaker.workflow.airflow.model_config` and :func:`sagemaker.workflow.airflow.model_config_from_estimator`,
354-
``instance_type`` is no longer the first positional argument and is now an optional keyword argument.
355-
356393
For :func:`sagemaker.workflow.airflow.model_config`, :func:`sagemaker.workflow.airflow.model_config_from_estimator`, and
357394
:func:`sagemaker.workflow.airflow.transform_config_from_estimator`, the ``image`` argument has been renamed to ``image_uri``.
358395

359-
Dependency Changes
360-
==================
361-
362-
SciPy
363-
-----
364-
365-
SciPy is no longer a required dependency of the SageMaker Python SDK.
366-
367-
If you use :func:`sagemaker.amazon.common.write_spmatrix_to_sparse_tensor` and
368-
don't already install SciPy in your environment, you can use our ``scipy`` installation target:
369-
370-
.. code:: bash
371-
372-
pip install sagemaker[scipy]
373-
374-
TensorFlow
375-
----------
376-
377-
The ``tensorflow`` installation target has been removed, as it is no longer needed for any SageMaker Python SDK functionality.
378-
379-
If you want to install TensorFlow, see `the TensorFlow documentation <https://www.tensorflow.org/install>`_.
380-
381396
*******************************
382397
Automatically Upgrade Your Code
383398
*******************************

0 commit comments

Comments
 (0)