From 684e953875955ae38c130db6753bac9ae9c114d6 Mon Sep 17 00:00:00 2001 From: Shantanu Tripathi Date: Thu, 18 May 2023 16:12:07 -0700 Subject: [PATCH 1/4] Add TF 2.12.1 images to the SM PySDK --- .../image_uri_config/tensorflow.json | 77 ++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/src/sagemaker/image_uri_config/tensorflow.json b/src/sagemaker/image_uri_config/tensorflow.json index b2250f6a39..20d2f79aa6 100644 --- a/src/sagemaker/image_uri_config/tensorflow.json +++ b/src/sagemaker/image_uri_config/tensorflow.json @@ -320,7 +320,8 @@ "2.8": "2.8.4", "2.9": "2.9.3", "2.10": "2.10.1", - "2.11": "2.11.0" + "2.11": "2.11.1", + "2.12": "2.12.1" }, "versions": { "1.10.0": { @@ -1938,6 +1939,80 @@ "us-west-2": "763104351884" }, "repository": "tensorflow-inference" + }, + "2.11.1": { + "registries": { + "af-south-1": "626614931356", + "ap-east-1": "871362719292", + "ap-northeast-1": "763104351884", + "ap-northeast-2": "763104351884", + "ap-northeast-3": "364406365360", + "ap-south-1": "763104351884", + "ap-south-2": "772153158452", + "ap-southeast-1": "763104351884", + "ap-southeast-2": "763104351884", + "ap-southeast-3": "907027046896", + "ap-southeast-4": "457447274322", + "ca-central-1": "763104351884", + "cn-north-1": "727897471807", + "cn-northwest-1": "727897471807", + "eu-central-1": "763104351884", + "eu-central-2": "380420809688", + "eu-north-1": "763104351884", + "eu-south-1": "692866216735", + "eu-south-2": "503227376785", + "eu-west-1": "763104351884", + "eu-west-2": "763104351884", + "eu-west-3": "763104351884", + "me-south-1": "217643126080", + "sa-east-1": "763104351884", + "us-east-1": "763104351884", + "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", + "us-gov-west-1": "442386744353", + "us-iso-east-1": "886529160074", + "us-isob-east-1": "094389454867", + "us-west-1": "763104351884", + "us-west-2": "763104351884" + }, + "repository": "tensorflow-inference" + }, + "2.12.1": { + "registries": { + "af-south-1": "626614931356", + "ap-east-1": "871362719292", + "ap-northeast-1": "763104351884", + "ap-northeast-2": "763104351884", + "ap-northeast-3": "364406365360", + "ap-south-1": "763104351884", + "ap-south-2": "772153158452", + "ap-southeast-1": "763104351884", + "ap-southeast-2": "763104351884", + "ap-southeast-3": "907027046896", + "ap-southeast-4": "457447274322", + "ca-central-1": "763104351884", + "cn-north-1": "727897471807", + "cn-northwest-1": "727897471807", + "eu-central-1": "763104351884", + "eu-central-2": "380420809688", + "eu-north-1": "763104351884", + "eu-south-1": "692866216735", + "eu-south-2": "503227376785", + "eu-west-1": "763104351884", + "eu-west-2": "763104351884", + "eu-west-3": "763104351884", + "me-south-1": "217643126080", + "sa-east-1": "763104351884", + "us-east-1": "763104351884", + "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", + "us-gov-west-1": "442386744353", + "us-iso-east-1": "886529160074", + "us-isob-east-1": "094389454867", + "us-west-1": "763104351884", + "us-west-2": "763104351884" + }, + "repository": "tensorflow-inference" } } }, From 50fb2184c82d78b11ad15421f4df24e40b92d1ee Mon Sep 17 00:00:00 2001 From: Shantanu Tripathi Date: Thu, 18 May 2023 17:13:46 -0700 Subject: [PATCH 2/4] Modify fixture tf_full_py_version to return py310 in case of tf>=2.12 --- tests/conftest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 7db96893fe..12a669e15c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -526,7 +526,9 @@ def tf_full_py_version(tf_full_version): return "py37" if version < Version("2.8"): return "py38" - return "py39" + if version < Version("2.12"): + return "py39" + return "py310" @pytest.fixture(scope="module") From e73b458fb9f279f45deb3136dd57939a8b043436 Mon Sep 17 00:00:00 2001 From: Shantanu Tripathi Date: Sun, 21 May 2023 14:50:17 -0700 Subject: [PATCH 3/4] Add possiblity to accomodate for training/inference version mismatch --- src/sagemaker/tensorflow/model.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sagemaker/tensorflow/model.py b/src/sagemaker/tensorflow/model.py index 1f162cef60..903b25b6ba 100644 --- a/src/sagemaker/tensorflow/model.py +++ b/src/sagemaker/tensorflow/model.py @@ -185,6 +185,14 @@ def __init__( ) self.framework_version = framework_version + ## Inference framework version is being introduced to accomodate the mismatch between tensorflow and tensorflow serving releases, + ## wherein the TF and TFS might have different patch versions, but end up hosting the model of same TF version. For eg., the + ## upstream TFS-2.12.0 release was a bad release and hence a new TFS-2.12.1 release was made to host models from TF-2.12.0. + training_inference_version_mismatch_dict = {"2.12.0": "2.12.1"} + self.inference_framework_version = training_inference_version_mismatch_dict.get( + framework_version, framework_version + ) + super(TensorFlowModel, self).__init__( model_data=model_data, role=role, @@ -457,7 +465,7 @@ def _get_image_uri( return image_uris.retrieve( self._framework_name, region_name or self.sagemaker_session.boto_region_name, - version=self.framework_version, + version=self.inference_framework_version, instance_type=instance_type, accelerator_type=accelerator_type, image_scope="inference", From 1c98b5c4d075dac51e4daf60a58aff6dab7d9f44 Mon Sep 17 00:00:00 2001 From: Shantanu Tripathi Date: Mon, 22 May 2023 01:20:14 -0700 Subject: [PATCH 4/4] Format using pylint and flake8 --- src/sagemaker/tensorflow/model.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sagemaker/tensorflow/model.py b/src/sagemaker/tensorflow/model.py index 746e2d3101..705b7667dd 100644 --- a/src/sagemaker/tensorflow/model.py +++ b/src/sagemaker/tensorflow/model.py @@ -185,9 +185,11 @@ def __init__( ) self.framework_version = framework_version - ## Inference framework version is being introduced to accomodate the mismatch between tensorflow and tensorflow serving releases, - ## wherein the TF and TFS might have different patch versions, but end up hosting the model of same TF version. For eg., the - ## upstream TFS-2.12.0 release was a bad release and hence a new TFS-2.12.1 release was made to host models from TF-2.12.0. + # Inference framework version is being introduced to accomodate the mismatch between + # tensorflow and tensorflow serving releases, wherein the TF and TFS might have different + # patch versions, but end up hosting the model of same TF version. For eg., the upstream + # TFS-2.12.0 release was a bad release and hence a new TFS-2.12.1 release was made to host + # models from TF-2.12.0. training_inference_version_mismatch_dict = {"2.12.0": "2.12.1"} self.inference_framework_version = training_inference_version_mismatch_dict.get( framework_version, framework_version