Skip to content

doc: start v2 usage and migration documentation #1553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Overview
:maxdepth: 2

overview
v2

The SageMaker Python SDK APIs:

Expand Down
86 changes: 86 additions & 0 deletions doc/v2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
##########################################################
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.

.. contents::
:local:

************
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 [email protected]:aws/[email protected]

To install the latest version of v2:

.. code:: bash

pip install [email protected]:aws/sagemaker-python-sdk.git@zwei

If you are executing this pip install command in a notebook, make sure to restart your kernel.

*******
Changes
*******

To see what changes have been made, see the `CHANGELOG <https://github.com/aws/sagemaker-python-sdk/blob/zwei/CHANGELOG.md>`_.

*******************************
Automatically Upgrade Your Code
*******************************

To help make your transition as seamless as possible, v2 of the SageMaker Python SDK comes with a command-line tool to automate updating your code.
It automates as much as possible, but there are still syntactical and stylistic changes that cannot be performed by the script.

.. warning::
While the tool is intended to be easy to use, we recommend using it as part of a process that includes testing before and after you run the tool.

Usage
=====

Currently, the tool supports only converting one file at a time:

.. code::

$ sagemaker-upgrade-v2 --in-file input.py --out-file output.py
$ sagemaker-upgrade-v2 --in-file input.ipynb --out-file output.ipynb

You can apply it to a set of files using a loop:

.. code:: bash

$ for file in $(find input-dir); do sagemaker-upgrade-v2 --in-file $file --out-file output-dir/$file; done

Limitations
===========

Aliased Imports
---------------

The tool checks for a limited number of patterns when looking for constructors.
For example, if you are using a TensorFlow estimator, only the following invocation styles are handled:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like I'd want to see a before and after example. After reading this, I'm still not sure what changed and how much work I'd have to do if I used an aliased import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I'll populate the "Changes" section when I update the changelog in a new PR


.. code:: python

TensorFlow()
sagemaker.tensorflow.TensorFlow()
sagemaker.tensorflow.estimator.TensorFlow()

If you have aliased an import, e.g. ``from sagemaker.tensorflow import TensorFlow as TF``, the tool does not take care of updating its parameters.

TensorFlow Serving
------------------

If you are using the ``sagemaker.tensorflow.serving.Model`` class, the tool does not take care of adding a framework version or changing it to ``sagemaker.tensorflow.TensorFlowModel``.