Skip to content

Commit

Permalink
Merge branch 'zwei' into deprecate-ecr-prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenyu authored Aug 1, 2020
2 parents 987171a + 4a15832 commit 4ec292d
Show file tree
Hide file tree
Showing 29 changed files with 1,378 additions and 476 deletions.
7 changes: 7 additions & 0 deletions doc/api/utility/image_uris.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Image URIs
----------

.. automodule:: sagemaker.image_uris
:members:
:undoc-members:
:show-inheritance:
3 changes: 1 addition & 2 deletions doc/frameworks/tensorflow/upgrade_from_legacy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ For example, if you want to use JSON serialization and deserialization:
from sagemaker.deserializers import JSONDeserializer
from sagemaker.serializers import JSONSerializer
predictor.serializer = JSONSerializer()
predictor.deserializer = JSONDeserializer()
predictor = model.deploy(..., serializer=JSONSerializer(), deserializer=JSONDeserializer())
predictor.predict(data)
8 changes: 5 additions & 3 deletions doc/frameworks/xgboost/using_xgboost.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,14 @@ inference against your model.

.. code::
serializer = StringSerializer()
serializer.CONTENT_TYPE = "text/libsvm"
predictor = estimator.deploy(
initial_instance_count=1,
instance_type="ml.m5.xlarge"
instance_type="ml.m5.xlarge",
serializer=serializer
)
predictor.serializer = str
predictor.content_type = "text/libsvm"
with open("abalone") as f:
payload = f.read()
Expand Down
4 changes: 0 additions & 4 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. important::
We are working on v2.0.0. See https://github.com/aws/sagemaker-python-sdk/issues/1459
for more info on our plans and to leave feedback!

###########################
Amazon SageMaker Python SDK
###########################
Expand Down
114 changes: 90 additions & 24 deletions doc/v2.rst
Original file line number Diff line number Diff line change
@@ -1,42 +1,29 @@
##########################################################
Use Version 2.0 of the SageMaker Python SDK (experimental)
##########################################################

Development on v2.0.0 of the SageMaker Python SDK is underway.
For more info on our plans, see https://github.com/aws/sagemaker-python-sdk/issues/1459.
###########################################
Use Version 2.x of the SageMaker Python SDK
###########################################

.. contents::
:local:
:depth: 2

************
Installation
************

.. warning::
Version 2.0.0 is currently experimental, so proceed with caution. If you do run into issues or have any other feedback,
please let us know by `opening an issue <https://github.com/aws/sagemaker-python-sdk/issues/new/choose>`_
or `commenting on our planning issue <https://github.com/aws/sagemaker-python-sdk/issues/1459>`_.

To install the latest release candidate:

.. code:: bash
pip install git+git://github.com/aws/[email protected]
To install the latest version of v2:
To install the latest version:

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

*******
Changes
*******
****************
Breaking Changes
****************

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

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

``serializer`` and ``deserializer`` in ``create_model()``
---------------------------------------------------------

The ``serializer`` and ``deserializer`` arguments in
:func:`sagemaker.estimator.Estimator.create_model` have been deprecated. Please
specify serializers and deserializers in ``deploy()`` methods instead.

``content_type`` and ``accept`` in the Predictor Constructor
------------------------------------------------------------

Expand Down Expand Up @@ -127,8 +121,46 @@ write MIME types as a string,
| ``CONTENT_TYPE_NPY`` | ``"application/x-npy"`` |
+-------------------------------+--------------------------------+

Image URI Functions (e.g. ``get_image_uri``)
--------------------------------------------

The following functions have been deprecated in favor of :func:`sagemaker.image_uris.retrieve`:

- ``sagemaker.amazon_estimator.get_image_uri()``
- ``sagemaker.fw_utils.create_image_uri()``
- ``sagemaker.fw_registry.registry()``
- ``sagemaker.utils.get_ecr_image_uri_prefix()``

For more information about usage, see :func:`sagemaker.image_uris.retrieve`.

SageMaker Python SDK CLI
------------------------

The SageMaker Python SDK CLI has been deprecated.
(This is different from the AWS CLI.)

``enable_cloudwatch_metrics`` for Estimators and Models
-------------------------------------------------------

The parameter ``enable_cloudwatch_metrics`` has been deprecated.
CloudWatch metrics are already emitted for all Training Jobs, etc.

``sagemaker.fw_utils.parse_s3_url``
-----------------------------------

The ``sagemaker.fw_utils.parse_s3_url`` function has been deprecated.
Please use :func:`sagemaker.s3.parse_s3_url` instead.

``sagemaker.session.ModelContainer``
------------------------------------

The class ``sagemaker.session.ModelContainer`` has been deprecated, as it is not needed for creating inference pipelines.

Changes in Default Behavior
===========================

Require ``framework_version`` and ``py_version`` for Frameworks
===============================================================
---------------------------------------------------------------

Framework estimator and model classes now require ``framework_version`` and ``py_version`` instead of supplying defaults,
unless an image URI is explicitly supplied.
Expand Down Expand Up @@ -158,6 +190,25 @@ For example:
py_version="py3", # now required
)
Log Display Behavior with ``attach()``
--------------------------------------

Logs are no longer printed when using ``attach()`` with an estimator.
To view logs after attaching a training job to an estimator, use :func:`sagemaker.estimator.EstimatorBase.logs`.

``HyperparameterTuner.fit()`` and ``Transformer.transform()``
-------------------------------------------------------------

:func:`sagemaker.tuner.HyperparameterTuner.fit` and :func:`sagemaker.transformer.Transformer.transform` now wait
until the completion of the Hyperparameter Tuning Job or Batch Transform Job, respectively.
To make the function non-blocking, use ``wait=False``.

XGBoost Predictor
-----------------

The default serializer of ``sagemaker.xgboost.model.XGBoostPredictor`` has been changed from ``NumpySerializer`` to ``LibSVMSerializer``.


Parameter and Class Name Changes
================================

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

``sagemaker.serializers.LibSVMSerializer`` has been added in v2.0.

``distributions``
~~~~~~~~~~~~~~~~~

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


Inputs
------

``s3_input``
~~~~~~~~~~~~

``sagemaker.session.s3_input`` has been renamed to :class:`sagemaker.inputs.TrainingInput`.

``ShuffleConfig``
~~~~~~~~~~~~~~~~~

``sagemaker.session.ShuffleConfig`` has been renamed to :class:`sagemaker.inputs.ShuffleConfig`.

Airflow
-------

Expand Down
14 changes: 14 additions & 0 deletions src/sagemaker/automl/automl.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ def deploy(
self,
initial_instance_count,
instance_type,
serializer=None,
deserializer=None,
candidate=None,
sagemaker_session=None,
name=None,
Expand All @@ -356,6 +358,16 @@ def deploy(
in the ``Endpoint`` created from this ``Model``.
instance_type (str): The EC2 instance type to deploy this Model to.
For example, 'ml.p2.xlarge'.
serializer (:class:`~sagemaker.serializers.BaseSerializer`): A
serializer object, used to encode data for an inference endpoint
(default: None). If ``serializer`` is not None, then
``serializer`` will override the default serializer. The
default serializer is set by the ``predictor_cls``.
deserializer (:class:`~sagemaker.deserializers.BaseDeserializer`): A
deserializer object, used to decode data from an inference
endpoint (default: None). If ``deserializer`` is not None, then
``deserializer`` will override the default deserializer. The
default deserializer is set by the ``predictor_cls``.
candidate (CandidateEstimator or dict): a CandidateEstimator used for deploying
to a SageMaker Inference Pipeline. If None, the best candidate will
be used. If the candidate input is a dict, a CandidateEstimator will be
Expand Down Expand Up @@ -405,6 +417,8 @@ def deploy(
return model.deploy(
initial_instance_count=initial_instance_count,
instance_type=instance_type,
serializer=serializer,
deserializer=deserializer,
endpoint_name=endpoint_name,
tags=tags,
wait=wait,
Expand Down
14 changes: 14 additions & 0 deletions src/sagemaker/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying athis file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
"""Tools for automating code updates"""
from __future__ import absolute_import
Loading

0 comments on commit 4ec292d

Please sign in to comment.