Skip to content

Fixing py2 support for latest TF version #1148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sagemaker/tensorflow/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class TensorFlow(Framework):
_LOWEST_SCRIPT_MODE_ONLY_VERSION = [1, 13]
# 1.15.0 still supports py2
# we will need to update this version number if future versions still support py2
_HIGHEST_PYTHON_2_VERSION = [1, 15]
_HIGHEST_PYTHON_2_VERSION = [1, 15, 0]

def __init__(
self,
Expand Down Expand Up @@ -371,7 +371,7 @@ def _only_script_mode_supported(self):

def _only_python_3_supported(self):
"""Placeholder docstring"""
return [int(s) for s in self.framework_version.split(".")] >= self._HIGHEST_PYTHON_2_VERSION
return [int(s) for s in self.framework_version.split(".")] > self._HIGHEST_PYTHON_2_VERSION

def _validate_requirements_file(self, requirements_file):
"""Placeholder docstring"""
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/test_tf_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,13 @@ def test_py2_version_deprecated(sagemaker_session):
assert msg in str(e.value)


def test_py2_version_is_not_deprecated(sagemaker_session):
estimator = _build_tf(
sagemaker_session=sagemaker_session, framework_version="1.15.0", py_version="py2"
)
assert estimator.py_version == "py2"


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

Expand Down