Skip to content

Commit 15793e2

Browse files
nadiayaknakad
authored andcommitted
feature: add support for TF 1.15.0, PyTorch 1.3.1 and MXNet 1.6rc0. (#280)
1 parent 129460d commit 15793e2

File tree

10 files changed

+226
-40
lines changed

10 files changed

+226
-40
lines changed

src/sagemaker/fw_utils.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
OPT_IN_ACCOUNTS_BY_REGION = {"ap-east-1": "057415533634", "me-south-1": "724002660598"}
6161
ASIMOV_OPT_IN_ACCOUNTS_BY_REGION = {"ap-east-1": "871362719292", "me-south-1": "217643126080"}
6262
DEFAULT_ACCOUNT = "520713654638"
63+
ASIMOV_PROD_ACCOUNT = "763104351884"
64+
ASIMOV_DEFAULT_ACCOUNT = "028651357192"
6365

6466
MERGED_FRAMEWORKS_REPO_MAP = {
6567
"tensorflow-scriptmode": "tensorflow-training",
@@ -121,16 +123,18 @@ def _using_merged_images(region, framework, py_version, framework_version):
121123
framework_version:
122124
"""
123125
is_gov_region = region in VALID_ACCOUNTS_BY_REGION
124-
is_py3 = py_version == "py3" or py_version is None
126+
not_py2 = py_version == "py3" or py_version is None
125127
is_merged_versions = _is_merged_versions(framework, framework_version)
126128

127129
return (
128130
((not is_gov_region) or region in ASIMOV_VALID_ACCOUNTS_BY_REGION)
129131
and is_merged_versions
132+
# TODO: should be not mxnet-1.14.1-py2 instead?
130133
and (
131-
is_py3
134+
not_py2
132135
or _is_tf_14_or_later(framework, framework_version)
133136
or _is_pt_12_or_later(framework, framework_version)
137+
or _is_mxnet_16_or_later(framework, framework_version)
134138
)
135139
)
136140

@@ -162,6 +166,19 @@ def _is_pt_12_or_later(framework, framework_version):
162166
return is_pytorch and version >= asimov_lowest_pt[0 : len(version)]
163167

164168

169+
def _is_mxnet_16_or_later(framework, framework_version):
170+
"""
171+
Args:
172+
framework: Name of the frameowork
173+
framework_version: framework version
174+
"""
175+
# Asimov team now owns MXNet 1.6.0 py2 and py3
176+
asimov_lowest_pt = [1, 6, 0]
177+
version = [int(s) for s in framework_version.split(".")]
178+
is_mxnet = framework in ("mxnet", "mxnet-serving")
179+
return is_mxnet and version >= asimov_lowest_pt[0 : len(version)]
180+
181+
165182
def _registry_id(region, framework, py_version, account, framework_version):
166183
"""
167184
Args:
@@ -177,7 +194,10 @@ def _registry_id(region, framework, py_version, account, framework_version):
177194
return ASIMOV_OPT_IN_ACCOUNTS_BY_REGION.get(region)
178195
if region in ASIMOV_VALID_ACCOUNTS_BY_REGION:
179196
return ASIMOV_VALID_ACCOUNTS_BY_REGION.get(region)
180-
return "763104351884"
197+
# TODO: remove when ASIMOV images availabel in Prod
198+
if framework in ("tensorflow-serving-eia", "mxnet-serving-eia"):
199+
return ASIMOV_PROD_ACCOUNT
200+
return ASIMOV_DEFAULT_ACCOUNT
181201
if region in OPT_IN_ACCOUNTS_BY_REGION:
182202
return OPT_IN_ACCOUNTS_BY_REGION.get(region)
183203
return VALID_ACCOUNTS_BY_REGION.get(region, account)

src/sagemaker/mxnet/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Using MXNet with the SageMaker Python SDK
44

55
With the SageMaker Python SDK, you can train and host MXNet models on Amazon SageMaker.
66

7-
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``.
7+
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.6.0``.
1010

1111
For information about using MXNet with the SageMaker Python SDK, see https://sagemaker.readthedocs.io/en/stable/using_mxnet.html.
1212

src/sagemaker/mxnet/estimator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class MXNet(Framework):
3636
__framework_name__ = "mxnet"
3737
_LOWEST_SCRIPT_MODE_VERSION = ["1", "3"]
3838

39-
LATEST_VERSION = "1.4.1"
39+
LATEST_VERSION = "1.6.0"
4040
"""The latest version of MXNet included in the SageMaker pre-built Docker images."""
4141

4242
def __init__(

src/sagemaker/pytorch/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SageMaker PyTorch Estimators and Models
44

55
With PyTorch Estimators and Models, you can train and host PyTorch models on Amazon SageMaker.
66

7-
Supported versions of PyTorch: ``0.4.0``, ``1.0.0``, ``1.1.0``, ``1.2.0``.
7+
Supported versions of PyTorch: ``0.4.0``, ``1.0.0``, ``1.1.0``, ``1.2.0``, ``1.3.1``.
88

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

src/sagemaker/pytorch/estimator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PyTorch(Framework):
3535

3636
__framework_name__ = "pytorch"
3737

38-
LATEST_VERSION = "1.2.0"
38+
LATEST_VERSION = "1.3.1"
3939
"""The latest version of PyTorch included in the SageMaker pre-built Docker images."""
4040

4141
def __init__(

src/sagemaker/tensorflow/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Documentation of the previous Legacy Mode versions: `1.4.1 <https://github.com/a
2020
| You can find the Legacy Mode README `here <https://github.com/aws/sagemaker-python-sdk/tree/v1.12.0/src/sagemaker/tensorflow#tensorflow-sagemaker-estimators-and-models>`_. |
2121
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
2222

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

2525
For information about using TensorFlow with the SageMaker Python SDK, see https://sagemaker.readthedocs.io/en/stable/using_tf.html.
2626

@@ -64,7 +64,7 @@ The containers include the following Python packages:
6464
+--------------------------------+---------------+
6565
| sklean | 0.20.3 |
6666
+--------------------------------+---------------+
67-
| tensorflow | 1.13.0 |
67+
| tensorflow | 1.15.0 |
6868
+--------------------------------+---------------+
6969

7070
Script Mode TensorFlow Docker images support both Python 2.7 and Python 3.6. The Docker images extend Ubuntu 16.04.

src/sagemaker/tensorflow/estimator.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ class TensorFlow(Framework):
197197

198198
__framework_name__ = "tensorflow"
199199

200-
LATEST_VERSION = "1.14"
200+
LATEST_VERSION = "1.15"
201201
"""The latest version of TensorFlow included in the SageMaker pre-built Docker images."""
202202

203203
_LOWEST_SCRIPT_MODE_ONLY_VERSION = [1, 13]
204-
# 1.14.0 now supports py2
205-
# we will need to update this version number if future versions do not support py2 anymore
206-
_LOWEST_PYTHON_2_ONLY_VERSION = [1, 14]
204+
# 1.15.0 still supports py2
205+
# we will need to update this version number if future versions still support py2
206+
_HIGHEST_PYTHON_2_VERSION = [1, 15]
207207

208208
def __init__(
209209
self,
@@ -371,9 +371,7 @@ def _only_script_mode_supported(self):
371371

372372
def _only_python_3_supported(self):
373373
"""Placeholder docstring"""
374-
return [
375-
int(s) for s in self.framework_version.split(".")
376-
] >= self._LOWEST_PYTHON_2_ONLY_VERSION
374+
return [int(s) for s in self.framework_version.split(".")] >= self._HIGHEST_PYTHON_2_VERSION
377375

378376
def _validate_requirements_file(self, requirements_file):
379377
"""Placeholder docstring"""

tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def pytest_addoption(parser):
4242
parser.addoption("--boto-config", action="store", default=None)
4343
parser.addoption("--chainer-full-version", action="store", default=Chainer.LATEST_VERSION)
4444
parser.addoption("--mxnet-full-version", action="store", default=MXNet.LATEST_VERSION)
45-
parser.addoption("--ei-mxnet-full-version", action="store", default=MXNet.LATEST_VERSION)
45+
parser.addoption("--ei-mxnet-full-version", action="store", default="1.4.1")
4646
parser.addoption("--pytorch-full-version", action="store", default=PyTorch.LATEST_VERSION)
4747
parser.addoption(
4848
"--rl-coach-mxnet-full-version",
@@ -125,6 +125,8 @@ def chainer_version(request):
125125
return request.param
126126

127127

128+
# TODO: current version fixtures are legacy fixtures that aren't useful
129+
# and no longer verify whether images are valid
128130
@pytest.fixture(
129131
scope="module",
130132
params=[

0 commit comments

Comments
 (0)