@@ -195,17 +195,18 @@ class TensorFlow(Framework):
195195
196196 __framework_name__ = "tensorflow"
197197
198- LATEST_VERSION = "1.13 "
198+ LATEST_VERSION = "1.14 "
199199 """The latest version of TensorFlow included in the SageMaker pre-built Docker images."""
200200
201201 _LOWEST_SCRIPT_MODE_ONLY_VERSION = [1 , 13 ]
202+ _LOWEST_PYTHON_2_ONLY_VERSION = [1 , 14 ]
202203
203204 def __init__ (
204205 self ,
205206 training_steps = None ,
206207 evaluation_steps = None ,
207208 checkpoint_path = None ,
208- py_version = "py2" ,
209+ py_version = None ,
209210 framework_version = None ,
210211 model_dir = None ,
211212 requirements_file = "" ,
@@ -279,6 +280,9 @@ def __init__(
279280 logger .warning (fw .empty_framework_version_warning (TF_VERSION , self .LATEST_VERSION ))
280281 self .framework_version = framework_version or TF_VERSION
281282
283+ if not py_version :
284+ py_version = "py3" if self ._only_python_3_supported () else "py2"
285+
282286 super (TensorFlow , self ).__init__ (image_name = image_name , ** kwargs )
283287 self .checkpoint_path = checkpoint_path
284288
@@ -337,6 +341,13 @@ def _validate_args(
337341 )
338342 )
339343
344+ if py_version == "py2" and self ._only_python_3_supported ():
345+ msg = (
346+ "Python 2 containers are only available until TensorFlow version 1.13.1. "
347+ "Please use a Python 3 container."
348+ )
349+ raise AttributeError (msg )
350+
340351 if (not self ._script_mode_enabled ()) and self ._only_script_mode_supported ():
341352 logger .warning (
342353 "Legacy mode is deprecated in versions 1.13 and higher. Using script mode instead."
@@ -349,6 +360,12 @@ def _only_script_mode_supported(self):
349360 int (s ) for s in self .framework_version .split ("." )
350361 ] >= self ._LOWEST_SCRIPT_MODE_ONLY_VERSION
351362
363+ def _only_python_3_supported (self ):
364+ """Placeholder docstring"""
365+ return [
366+ int (s ) for s in self .framework_version .split ("." )
367+ ] >= self ._LOWEST_PYTHON_2_ONLY_VERSION
368+
352369 def _validate_requirements_file (self , requirements_file ):
353370 """Placeholder docstring"""
354371 if not requirements_file :
0 commit comments