Skip to content

Commit fa84753

Browse files
author
Chuyang Deng
committed
Merge branch 'ChuyangDeng-tf-2-2'
2 parents c875c47 + fe14848 commit fa84753

38 files changed

+440
-98
lines changed

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
# Changelog
22

3+
## v1.59.0 (2020-05-21)
4+
5+
### Features
6+
7+
* MXNet elastic inference support
8+
9+
### Bug Fixes and Other Changes
10+
11+
* add Batch Transform data processing options to Airflow config
12+
* add v2 warning messages
13+
* don't try to use local output path for KMS key in Local Mode
14+
15+
### Documentation Changes
16+
17+
* add instructions for how to enable 'local code' for Local Mode
18+
19+
## v1.58.4 (2020-05-20)
20+
21+
### Bug Fixes and Other Changes
22+
23+
* update AutoML default max_candidate value to use the service default
24+
* add describe_transform_job in session class
25+
26+
### Documentation Changes
27+
28+
* clarify support for requirements.txt in Tensorflow docs
29+
30+
### Testing and Release Infrastructure
31+
32+
* wait for DisassociateTrialComponent to take effect in experiment integ test cleanup
33+
34+
## v1.58.3 (2020-05-19)
35+
36+
### Bug Fixes and Other Changes
37+
38+
* update DatasetFormat key name for sagemakerCaptureJson
39+
40+
### Documentation Changes
41+
42+
* update Processing job max_runtime_in_seconds docstring
43+
344
## v1.58.2.post0 (2020-05-18)
445

546
### Documentation Changes

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ By using MXNet SageMaker Estimators, you can train and host MXNet models on Amaz
205205

206206
Supported versions of MXNet: ``0.12.1``, ``1.0.0``, ``1.1.0``, ``1.2.1``, ``1.3.0``, ``1.4.0``, ``1.4.1``, ``1.6.0``.
207207

208-
Supported versions of MXNet for Elastic Inference: ``1.3.0``, ``1.4.0``, ``1.4.1``.
208+
Supported versions of MXNet for Elastic Inference: ``1.3.0``, ``1.4.0``, ``1.4.1``, ``1.5.1``.
209209

210210
We recommend that you use the latest supported version, because that's where we focus most of our development efforts.
211211

@@ -219,7 +219,7 @@ TensorFlow SageMaker Estimators
219219

220220
By using TensorFlow SageMaker Estimators, you can train and host TensorFlow models on Amazon SageMaker.
221221

222-
Supported versions of TensorFlow: ``1.4.1``, ``1.5.0``, ``1.6.0``, ``1.7.0``, ``1.8.0``, ``1.9.0``, ``1.10.0``, ``1.11.0``, ``1.12.0``, ``1.13.1``, ``1.14.0``, ``1.15.0``, ``1.15.2``, ``2.0.0``, ``2.0.1``, ``2.1.0``.
222+
Supported versions of TensorFlow: ``1.4.1``, ``1.5.0``, ``1.6.0``, ``1.7.0``, ``1.8.0``, ``1.9.0``, ``1.10.0``, ``1.11.0``, ``1.12.0``, ``1.13.1``, ``1.14.0``, ``1.15.0``, ``1.15.2``, ``2.0.0``, ``2.0.1``, ``2.1.0``, ``2.2.0``.
223223

224224
Supported versions of TensorFlow for Elastic Inference: ``1.11.0``, ``1.12.0``, ``1.13.1``, ``1.14.0``, ``1.15.0``, ``2.0.0``.
225225

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.58.3.dev0
1+
1.59.1.dev0

doc/overview.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,26 @@ You can install all necessary for this feature dependencies using pip:
732732

733733
pip install 'sagemaker[local]' --upgrade
734734

735+
If you want to keep everything local, and not use Amazon S3 either, you can enable "local code" in one of two ways:
736+
737+
- Create a file at ``~/.sagemaker/config.yaml`` that contains:
738+
739+
.. code:: yaml
740+
741+
local:
742+
local_code: true
743+
744+
- Create a ``LocalSession`` and configure it directly:
745+
746+
.. code:: python
747+
748+
from sagemaker.local import LocalSession
749+
750+
sagemaker_session = LocalSession()
751+
sagemaker_session.config = {'local': {'local_code': True}}
752+
753+
# pass sagemaker_session to your estimator or model
754+
735755
We can take the example in `Using Estimators <#using-estimators>`__ , and use either ``local`` or ``local_gpu`` as the instance type.
736756

737757
.. code:: python

doc/using_tf.rst

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ For general information about using the SageMaker Python SDK, see :ref:`overview
2020

2121
.. contents::
2222

23-
Supported versions of TensorFlow for Elastic Inference: ``1.11``, ``1.12``, ``1.13``, ``1.14``.
23+
Supported versions of TensorFlow for Elastic Inference: ``1.11``, ``1.12``, ``1.13``, ``1.14``, ``1.15``, ``2.0``.
2424

2525

2626
*****************************
@@ -133,6 +133,34 @@ In your training script the channels will be stored in environment variables ``S
133133
``output_path``.
134134

135135

136+
Use third-party libraries
137+
-------------------------
138+
139+
If there are other packages you want to use with your script, you can use a ``requirements.txt`` to install other dependencies at runtime.
140+
141+
For training, support for installing packages using ``requirements.txt`` varies by TensorFlow version as follows:
142+
143+
- For TensorFlow 1.11 or newer using Script Mode without Horovod, TensorFlow 1.15.2 with Python 3.7 or newer, and TensorFlow 2.2 or newer:
144+
- Include a ``requirements.txt`` file in the same directory as your training script.
145+
- You must specify this directory using the ``source_dir`` argument when creating a TensorFlow estimator.
146+
- For older versions of TensorFlow using Script Mode with Horovod:
147+
- Write a shell script for your entry point that first calls ``pip install -r requirements.txt``, then runs your training script.
148+
- For an example of using shell scripts, see `this example notebook <https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker-python-sdk/tensorflow_script_mode_using_shell_commands/tensorflow_script_mode_using_shell_commands.ipynb>`__.
149+
- For older versions of TensorFlow using Legacy Mode:
150+
- Specify the path to your ``requirements.txt`` file using the ``requirements_file`` argument.
151+
152+
For serving, support for installing packages using ``requirements.txt`` varies by TensorFlow version as follows:
153+
154+
- For TensorFlow 1.11 or newer:
155+
- Include a ``requirements.txt`` file in the ``code`` directory.
156+
- For older versions of TensorFlow:
157+
- Specify the path to your ``requirements.txt`` file using the ``SAGEMAKER_REQUIREMENTS`` environment variable.
158+
159+
A ``requirements.txt`` file is a text file that contains a list of items that are installed by using ``pip install``.
160+
You can also specify the version of an item to install.
161+
For information about the format of a ``requirements.txt`` file, see `Requirements Files <https://pip.pypa.io/en/stable/user_guide/#requirements-files>`__ in the pip documentation.
162+
163+
136164
Create an Estimator
137165
===================
138166

@@ -215,7 +243,7 @@ Calling ``fit`` starts a SageMaker training job. The training job will execute t
215243
- starts asynchronous training
216244

217245
If the ``wait=False`` flag is passed to ``fit``, then it returns immediately. The training job continues running
218-
asynchronously. Later, a Tensorflow estimator can be obtained by attaching to the existing training job.
246+
asynchronously. Later, a TensorFlow estimator can be obtained by attaching to the existing training job.
219247
If the training job is not finished, it starts showing the standard output of training and wait until it completes.
220248
After attaching, the estimator can be deployed as usual.
221249

@@ -882,8 +910,7 @@ in the following code:
882910
You can also bring in external dependencies to help with your data
883911
processing. There are 2 ways to do this:
884912

885-
1. If you included ``requirements.txt`` in your ``source_dir`` or in
886-
your dependencies, the container installs the Python dependencies at runtime using ``pip install -r``:
913+
1. If your model archive contains ``code/requirements.txt``, the container will install the Python dependencies at runtime using ``pip install -r``.
887914

888915
.. code::
889916

src/sagemaker/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"""Placeholder docstring"""
1414
from __future__ import absolute_import
1515

16+
import logging
17+
import sys
1618
import importlib_metadata
1719

1820
from sagemaker import estimator, parameter, tuner # noqa: F401
@@ -61,3 +63,10 @@
6163
from sagemaker.automl.candidate_estimator import CandidateEstimator, CandidateStep # noqa: F401
6264

6365
__version__ = importlib_metadata.version("sagemaker")
66+
67+
if sys.version[0] == "2":
68+
logging.getLogger("sagemaker").warning(
69+
"SageMaker Python SDK v2 will no longer support Python 2. "
70+
"Please see https://github.com/aws/sagemaker-python-sdk/issues/1459 "
71+
"for more information"
72+
)

src/sagemaker/amazon/amazon_estimator.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,11 @@ def get_image_uri(region_name, repo_name, repo_version=1):
616616
repo_name:
617617
repo_version:
618618
"""
619+
logger.warning(
620+
"'get_image_uri' method will be deprecated in favor of 'ImageURIProvider' class "
621+
"in SageMaker Python SDK v2."
622+
)
623+
619624
if repo_name == "xgboost":
620625
if not _is_latest_xgboost_version(repo_version):
621626
logging.warning(

src/sagemaker/automl/automl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(
3939
encrypt_inter_container_traffic=False,
4040
vpc_config=None,
4141
problem_type=None,
42-
max_candidates=500,
42+
max_candidates=None,
4343
max_runtime_per_training_job_in_seconds=None,
4444
total_job_runtime_in_seconds=None,
4545
job_objective=None,

src/sagemaker/estimator.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
UploadedCode,
4040
validate_source_dir,
4141
_region_supports_debugger,
42+
parameter_v2_rename_warning,
4243
)
4344
from sagemaker.job import _Job
4445
from sagemaker.local import LocalSession
@@ -1273,6 +1274,7 @@ def __init__(
12731274
https://docs.aws.amazon.com/sagemaker/latest/dg/API_AlgorithmSpecification.html#SageMaker-Type-AlgorithmSpecification-EnableSageMakerMetricsTimeSeries
12741275
(default: ``None``).
12751276
"""
1277+
logging.warning(parameter_v2_rename_warning("image_name", "image_uri"))
12761278
self.image_name = image_name
12771279
self.hyperparam_dict = hyperparameters.copy() if hyperparameters else {}
12781280
super(Estimator, self).__init__(
@@ -1637,6 +1639,8 @@ def __init__(
16371639
self.container_log_level = container_log_level
16381640
self.code_location = code_location
16391641
self.image_name = image_name
1642+
if image_name is not None:
1643+
logging.warning(parameter_v2_rename_warning("image_name", "image_uri"))
16401644

16411645
self.uploaded_code = None
16421646

@@ -1722,11 +1726,14 @@ def _stage_user_code_in_s3(self):
17221726
code_bucket = self.sagemaker_session.default_bucket()
17231727
code_s3_prefix = "{}/{}".format(self._current_job_name, "source")
17241728
kms_key = None
1725-
17261729
elif self.code_location is None:
17271730
code_bucket, _ = parse_s3_url(self.output_path)
17281731
code_s3_prefix = "{}/{}".format(self._current_job_name, "source")
17291732
kms_key = self.output_kms_key
1733+
elif local_mode:
1734+
code_bucket, key_prefix = parse_s3_url(self.code_location)
1735+
code_s3_prefix = "/".join(filter(None, [key_prefix, self._current_job_name, "source"]))
1736+
kms_key = None
17301737
else:
17311738
code_bucket, key_prefix = parse_s3_url(self.code_location)
17321739
code_s3_prefix = "/".join(filter(None, [key_prefix, self._current_job_name, "source"]))

src/sagemaker/fw_utils.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
instantiated with positional or keyword arguments.
3535
"""
3636

37-
EMPTY_FRAMEWORK_VERSION_WARNING = "No framework_version specified, defaulting to version {}."
37+
EMPTY_FRAMEWORK_VERSION_WARNING = (
38+
"No framework_version specified, defaulting to version {}. "
39+
"framework_version will be required in SageMaker Python SDK v2."
40+
)
3841
LATER_FRAMEWORK_VERSION_WARNING = (
3942
"This is not the latest supported version. "
4043
"If you would like to use version {latest}, "
@@ -52,6 +55,10 @@
5255
"fully leverage all GPU cores; the parameter server will be configured to run "
5356
"only one worker per host regardless of the number of GPUs."
5457
)
58+
PARAMETER_V2_RENAME_WARNING = (
59+
"Parameter {v1_parameter_name} will be renamed to {v2_parameter_name} "
60+
"in SageMaker Python SDK v2."
61+
)
5562

5663

5764
EMPTY_FRAMEWORK_VERSION_ERROR = (
@@ -253,6 +260,11 @@ def create_image_uri(
253260
Returns:
254261
str: The appropriate image URI based on the given parameters.
255262
"""
263+
logger.warning(
264+
"'create_image_uri' will be deprecated in favor of 'ImageURIProvider' class "
265+
"in SageMaker Python SDK v2."
266+
)
267+
256268
optimized_families = optimized_families or []
257269

258270
if py_version and py_version not in VALID_PY_VERSIONS:
@@ -647,6 +659,17 @@ def python_deprecation_warning(framework, latest_supported_version):
647659
)
648660

649661

662+
def parameter_v2_rename_warning(v1_parameter_name, v2_parameter_name):
663+
"""
664+
Args:
665+
v1_parameter_name: parameter name used in SageMaker Python SDK v1
666+
v2_parameter_name: parameter name used in SageMaker Python SDK v2
667+
"""
668+
return PARAMETER_V2_RENAME_WARNING.format(
669+
v1_parameter_name=v1_parameter_name, v2_parameter_name=v2_parameter_name
670+
)
671+
672+
650673
def _region_supports_debugger(region_name):
651674
"""Returns boolean indicating whether the region supports Amazon SageMaker Debugger.
652675

src/sagemaker/inputs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
"""Amazon SageMaker channel configurations for S3 data sources and file system data sources"""
1414
from __future__ import absolute_import, print_function
1515

16+
import logging
17+
1618
FILE_SYSTEM_TYPES = ["FSxLustre", "EFS"]
1719
FILE_SYSTEM_ACCESS_MODES = ["ro", "rw"]
1820

21+
logger = logging.getLogger("sagemaker")
22+
1923

2024
class s3_input(object):
2125
"""Amazon SageMaker channel configurations for S3 data sources.
@@ -76,6 +80,9 @@ def __init__(
7680
this channel. See the SageMaker API documentation for more info:
7781
https://docs.aws.amazon.com/sagemaker/latest/dg/API_ShuffleConfig.html
7882
"""
83+
logger.warning(
84+
"'s3_input' class will be renamed to 'TrainingInput' in SageMaker Python SDK v2."
85+
)
7986

8087
self.config = {
8188
"DataSource": {"S3DataSource": {"S3DataType": s3_data_type, "S3Uri": s3_data}}

src/sagemaker/model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ def __init__(
108108
model_kms_key (str): KMS key ARN used to encrypt the repacked
109109
model archive file if the model is repacked
110110
"""
111+
LOGGER.warning(fw_utils.parameter_v2_rename_warning("image", "image_uri"))
112+
111113
self.model_data = model_data
112114
self.image = image
113115
self.role = role

src/sagemaker/mxnet/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ With the SageMaker Python SDK, you can train and host MXNet models on Amazon Sag
66

77
Supported versions of MXNet: ``0.12.1``, ``1.0.0``, ``1.1.0``, ``1.2.1``, ``1.3.0``, ``1.4.0``, ``1.4.1``, ``1.6.0``.
88

9-
Supported versions of MXNet for Elastic Inference: ``1.3.0``, ``1.4.0``, ``1.4.1``.
9+
Supported versions of MXNet for Elastic Inference: ``1.3.0``, ``1.4.0``, ``1.4.1``, ``1.5.1``.
1010

1111
Supported versions of MXNet for Inferentia: ``1.5.1``.
1212

src/sagemaker/mxnet/estimator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
framework_version_from_tag,
2222
empty_framework_version_warning,
2323
python_deprecation_warning,
24+
parameter_v2_rename_warning,
2425
is_version_equal_or_higher,
2526
warn_if_parameter_server_with_multi_gpu,
2627
)
@@ -129,6 +130,7 @@ def __init__(
129130
)
130131

131132
if distributions is not None:
133+
logger.warning(parameter_v2_rename_warning("distributions", "distribution"))
132134
train_instance_type = kwargs.get("train_instance_type")
133135
warn_if_parameter_server_with_multi_gpu(
134136
training_instance_type=train_instance_type, distributions=distributions

0 commit comments

Comments
 (0)