Skip to content

Commit b36ebb1

Browse files
author
Sam Oshin
committed
Fixing py2 support for latest TF version
1 parent dba0d61 commit b36ebb1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,9 @@ def test_py2_version_deprecated(sagemaker_session):
987987
msg = "Python 2 containers are only available until January 1st, 2020. Please use a Python 3 container."
988988
assert msg in str(e.value)
989989

990+
def test_py2_version_is_not_deprecated(sagemaker_session):
991+
estimator = _build_tf(sagemaker_session=sagemaker_session, framework_version="1.15.0", py_version="py2")
992+
assert estimator.py_version == "py2"
990993

991994
def test_py3_is_default_version_before_tf1_14(sagemaker_session):
992995
estimator = _build_tf(sagemaker_session=sagemaker_session, framework_version="1.13")

0 commit comments

Comments
 (0)