Skip to content

Commit 82adb10

Browse files
committed
doc: change "v2" to "version 2.0 or later"
1 parent 97cd594 commit 82adb10

File tree

6 files changed

+36
-29
lines changed

6 files changed

+36
-29
lines changed

doc/frameworks/tensorflow/upgrade_from_legacy.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Upgrade from Legacy TensorFlow Support
33
######################################
44

5-
With v2 of the SageMaker Python SDK, support for legacy SageMaker TensorFlow images has been deprecated.
5+
With version 2.0 or later of the SageMaker Python SDK, support for legacy SageMaker TensorFlow images has been deprecated.
66
This guide explains how to upgrade your SageMaker Python SDK usage.
77

88
For more information about using TensorFlow with the SageMaker Python SDK, see `Use TensorFlow with the SageMaker Python SDK <using_tf.html>`_.
@@ -67,13 +67,13 @@ For more information about implementing your own handlers, see `How to implement
6767
Continue with Legacy Versions
6868
*****************************
6969

70-
While not recommended, you can still use a legacy TensorFlow version with v2 of the SageMaker Python SDK.
70+
While not recommended, you can still use a legacy TensorFlow version with version 2.0 or later of the SageMaker Python SDK.
7171
In order to do so, you need to change how a few parameters are defined.
7272

7373
Training
7474
========
7575

76-
When creating an estimator, v2 requires the following changes:
76+
When creating an estimator, the Python SDK version 2.0 or later requires the following changes:
7777

7878
#. Explicitly specify the ECR image URI via ``image_name``.
7979
To determine the URI, you can use :func:`sagemaker.fw_utils.create_image_uri`.
@@ -87,7 +87,7 @@ the difference in code would be as follows:
8787
8888
from sagemaker.tensorflow import TensorFlow
8989
90-
# v1
90+
# v1.x
9191
estimator = TensorFlow(
9292
...
9393
source_dir="code",
@@ -99,7 +99,7 @@ the difference in code would be as follows:
9999
requirements_file="requirements.txt",
100100
)
101101
102-
# v2
102+
# v2.0 or later
103103
estimator = TensorFlow(
104104
...
105105
source_dir="code",
@@ -123,7 +123,7 @@ To provide a requirements file, define a hyperparameter named "sagemaker_require
123123
Inference
124124
=========
125125

126-
Using a legacy TensorFlow version for endpoints and batch transform can be achieved with v2 of the SageMaker Python SDK with some minor changes to your code.
126+
Using a legacy TensorFlow version for endpoints and batch transform can be achieved with version 2.0 or later of the SageMaker Python SDK with some minor changes to your code.
127127

128128
From an Estimator
129129
-----------------
@@ -134,16 +134,16 @@ To specify the number of model server workers, you need to set it through an env
134134

135135
.. code:: python
136136
137-
# v1
137+
# v1.x
138138
estimator.deploy(..., model_server_workers=4)
139139
140-
# v2
140+
# v2.0 or later
141141
estimator.deploy(..., env={"MODEL_SERVER_WORKERS": 4})
142142
143143
From a Trained Model
144144
--------------------
145145

146-
If you are starting with a trained model, v2 requires the following changes:
146+
If you are starting with a trained model, the Python SDK version 2.0 or later requires the following changes:
147147

148148
#. Use the the :class:`sagemaker.model.FrameworkModel` class.
149149
#. Explicitly specify the ECR image URI via ``image``.
@@ -155,7 +155,7 @@ the difference in code would be as follows:
155155

156156
.. code:: python
157157
158-
# v1
158+
# v1.x
159159
from sagemaker.tensorflow import TensorFlowModel
160160
161161
model = TensorFlowModel(
@@ -165,7 +165,7 @@ the difference in code would be as follows:
165165
model_server_workers=4,
166166
)
167167
168-
# v2
168+
# v2.0 or later
169169
from sagemaker.model import FrameworkModel
170170
171171
model = FrameworkModel(

src/sagemaker/cli/compatibility/v2/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""Tools to assist with upgrading to v2 of the SageMaker Python SDK."""
13+
"""Tools to assist with upgrading to version 2.0 or later of the SageMaker Python SDK."""
1414
from __future__ import absolute_import

src/sagemaker/cli/compatibility/v2/files.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class FileUpdater(object):
3030

3131
def __init__(self, input_path, output_path):
3232
"""Creates a ``FileUpdater`` for updating a file so that
33-
it is compatible with v2 of the SageMaker Python SDK.
33+
it is compatible with version 2.0 or later of the SageMaker Python SDK.
3434
3535
Args:
3636
input_path (str): Location of the input file.
@@ -44,8 +44,8 @@ def __init__(self, input_path, output_path):
4444
@abstractmethod
4545
def update(self):
4646
"""Reads the input file, updates the code so that it is
47-
compatible with v2 of the SageMaker Python SDK, and writes the
48-
updated code to an output file.
47+
compatible with version 2.0 or later of the SageMaker Python SDK,
48+
and writes the updated code to an output file.
4949
"""
5050

5151
def _make_output_dirs_if_needed(self):
@@ -66,21 +66,22 @@ class PyFileUpdater(FileUpdater):
6666

6767
def update(self):
6868
"""Reads the input Python file, updates the code so that it is
69-
compatible with v2 of the SageMaker Python SDK, and writes the
70-
updated code to an output file.
69+
compatible with version 2.0 or later of the SageMaker Python SDK,
70+
and writes the updated code to an output file.
7171
"""
7272
output = self._update_ast(self._read_input_file())
7373
self._write_output_file(output)
7474

7575
def _update_ast(self, input_ast):
7676
"""Updates an abstract syntax tree (AST) so that it is compatible
77-
with v2 of the SageMaker Python SDK.
77+
with version 2.0 or later of the SageMaker Python SDK.
7878
7979
Args:
80-
input_ast (ast.Module): AST to be updated for use with Python SDK v2.
80+
input_ast (ast.Module): AST to be updated for use with
81+
the Python SDK version 2.0 or later.
8182
8283
Returns:
83-
ast.Module: Updated AST that is compatible with Python SDK v2.
84+
ast.Module: Updated AST that is compatible with the Python SDK version 2.0 or later.
8485
"""
8586
return ASTTransformer().visit(input_ast)
8687

@@ -115,7 +116,7 @@ class JupyterNotebookFileUpdater(FileUpdater):
115116

116117
def update(self):
117118
"""Reads the input Jupyter notebook file, updates the code so that it is
118-
compatible with v2 of the SageMaker Python SDK, and writes the
119+
compatible with version 2.0 or later of the SageMaker Python SDK, and writes the
119120
updated code to an output file.
120121
"""
121122
nb_json = self._read_input_file()
@@ -128,7 +129,7 @@ def update(self):
128129

129130
def _update_code_from_cell(self, cell):
130131
"""Updates the code from a code cell so that it is
131-
compatible with v2 of the SageMaker Python SDK.
132+
compatible with version 2.0 or later of the SageMaker Python SDK.
132133
133134
Args:
134135
cell (dict): A dictionary representation of a code cell from

src/sagemaker/cli/compatibility/v2/modifiers/tf_legacy_mode.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""Classes to modify TensorFlow legacy mode code to be compatible with SageMaker Python SDK v2."""
13+
"""Classes to modify TensorFlow legacy mode code to be compatible
14+
with version 2.0 or later of the SageMaker Python SDK.
15+
"""
1416
from __future__ import absolute_import
1517

1618
import ast

src/sagemaker/cli/compatibility/v2/modifiers/tfs.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""Classes to modify TensorFlow Serving code to be compatible with SageMaker Python SDK v2."""
13+
"""Classes to modify TensorFlow Serving code to be compatible
14+
with version 2.0 or later of the SageMaker Python SDK.
15+
"""
1416
from __future__ import absolute_import
1517

1618
import ast
@@ -57,7 +59,8 @@ def node_should_be_modified(self, node):
5759
)
5860

5961
def modify_node(self, node):
60-
"""Modifies the ``ast.Call`` node to use the v2 classes for TensorFlow Serving:
62+
"""Modifies the ``ast.Call`` node to use the classes for TensorFlow Serving available in
63+
version 2.0 or later of the Python SDK:
6164
6265
- ``sagemaker.tensorflow.TensorFlowModel``
6366
- ``sagemaker.tensorflow.TensorFlowPredictor``
@@ -72,7 +75,7 @@ def modify_node(self, node):
7275
node.func.value = node.func.value.value
7376

7477
def _new_cls_name(self, cls_name):
75-
"""Returns the v2 class name."""
78+
"""Returns the updated class name."""
7679
return "TensorFlow{}".format(cls_name)
7780

7881

src/sagemaker/cli/compatibility/v2/sagemaker_upgrade_v2.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""A tool to upgrade SageMaker Python SDK code to be compatible with v2."""
13+
"""A tool to upgrade SageMaker Python SDK code to be compatible with version 2.0 or later."""
1414
from __future__ import absolute_import
1515

1616
import argparse
@@ -22,7 +22,7 @@
2222

2323

2424
def _update_file(input_file, output_file):
25-
"""Updates a file to be compatible with v2 of the SageMaker Python SDK,
25+
"""Updates a file to be compatible with version 2.0 or later of the SageMaker Python SDK,
2626
and write the updated source to the output file.
2727
2828
Args:
@@ -53,7 +53,8 @@ def _update_file(input_file, output_file):
5353
def _parse_args():
5454
"""Parses CLI arguments."""
5555
parser = argparse.ArgumentParser(
56-
description="A tool to convert files to be compatible with v2 of the SageMaker Python SDK. "
56+
description="A tool to convert files to be compatible with "
57+
"version 2.0 or later of the SageMaker Python SDK. "
5758
"Simple usage: sagemaker-upgrade-v2 --in-file foo.py --out-file bar.py"
5859
)
5960
parser.add_argument(

0 commit comments

Comments
 (0)