|
| 1 | +################################## |
| 2 | +Use v2 of the SageMaker Python SDK |
| 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. |
| 7 | + |
| 8 | +.. contents:: |
| 9 | + :local: |
| 10 | + |
| 11 | +************ |
| 12 | +Installation |
| 13 | +************ |
| 14 | + |
| 15 | +.. warning:: |
| 16 | + v2 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/sagemaker-python-sdk.git@v2.0.0.rc0 |
| 25 | +
|
| 26 | +To install the latest version of v2: |
| 27 | + |
| 28 | +.. code:: bash |
| 29 | +
|
| 30 | + pip install git+git@github.com:aws/sagemaker-python-sdk.git@zwei |
| 31 | +
|
| 32 | +If you are executing this pip install command in a notebook, make sure to restart your kernel. |
| 33 | + |
| 34 | +******* |
| 35 | +Changes |
| 36 | +******* |
| 37 | + |
| 38 | +To see what changes have been made, see the `CHANGELOG <https://github.com/aws/sagemaker-python-sdk/blob/zwei/CHANGELOG.md>`_. |
| 39 | + |
| 40 | +******************************* |
| 41 | +Automatically Upgrade Your Code |
| 42 | +******************************* |
| 43 | + |
| 44 | +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. |
| 45 | +It automates as much as possible, but there are still syntactical and stylistic changes that cannot be performed by the script. |
| 46 | + |
| 47 | +.. warning:: |
| 48 | + 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. |
| 49 | + |
| 50 | +Usage |
| 51 | +===== |
| 52 | + |
| 53 | +Currently, the tool supports only converting one file at a time: |
| 54 | + |
| 55 | +.. code:: |
| 56 | +
|
| 57 | + $ sagemaker-upgrade-v2 --in-file input.py --out-file output.py |
| 58 | + $ sagemaker-upgrade-v2 --in-file input.ipynb --out-file output.ipynb |
| 59 | +
|
| 60 | +You can apply it to a set of files using a loop: |
| 61 | + |
| 62 | +.. code:: bash |
| 63 | +
|
| 64 | + $ for file in $(find input-dir); do sagemaker-upgrade-v2 --in-file $file --out-file output-dir/$file; done |
| 65 | +
|
| 66 | +Limitations |
| 67 | +=========== |
| 68 | + |
| 69 | +Aliased Imports |
| 70 | +--------------- |
| 71 | + |
| 72 | +The tool checks for a limited number of patterns when looking for constructors. |
| 73 | +For example, if you are using a TensorFlow estimator, only the following invocation styles are handled: |
| 74 | + |
| 75 | +.. code:: python |
| 76 | +
|
| 77 | + TensorFlow() |
| 78 | + sagemaker.tensorflow.TensorFlow() |
| 79 | + sagemaker.tensorflow.estimator.TensorFlow() |
| 80 | +
|
| 81 | +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. |
| 82 | + |
| 83 | +TensorFlow Serving |
| 84 | +------------------ |
| 85 | + |
| 86 | +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``. |
0 commit comments