Skip to content

Commit 0d28014

Browse files
sboshinnadiaya
authored andcommitted
fix: fixing py2 support for latest TF version (#1148)
1 parent ee2c345 commit 0d28014

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/sagemaker/tensorflow/estimator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class TensorFlow(Framework):
203203
_LOWEST_SCRIPT_MODE_ONLY_VERSION = [1, 13]
204204
# 1.15.0 still supports py2
205205
# we will need to update this version number if future versions still support py2
206-
_HIGHEST_PYTHON_2_VERSION = [1, 15]
206+
_HIGHEST_PYTHON_2_VERSION = [1, 15, 0]
207207

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

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

376376
def _validate_requirements_file(self, requirements_file):
377377
"""Placeholder docstring"""

tests/unit/test_tf_estimator.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,13 @@ def test_py2_version_deprecated(sagemaker_session):
988988
assert msg in str(e.value)
989989

990990

991+
def test_py2_version_is_not_deprecated(sagemaker_session):
992+
estimator = _build_tf(
993+
sagemaker_session=sagemaker_session, framework_version="1.15.0", py_version="py2"
994+
)
995+
assert estimator.py_version == "py2"
996+
997+
991998
def test_py3_is_default_version_before_tf1_14(sagemaker_session):
992999
estimator = _build_tf(sagemaker_session=sagemaker_session, framework_version="1.13")
9931000

0 commit comments

Comments
 (0)