From 49a7693993ad48fda23b11a6ad45cc606d354c18 Mon Sep 17 00:00:00 2001 From: iindyk Date: Wed, 5 Apr 2023 13:45:57 -0700 Subject: [PATCH] Updating tensorflow dependency to `>=2.12,<3` and protobuf to `>=3.20.3,<5`. TF 2.12 updated their packaged protobuf C++ dependency to 3.21.9 making it incompatible with our packaged build in TFMD and s2t. Python's protobuf version 3.20.3 is the minimal version compatible with the new build and python 3.10. In general this protobuf bound lets TF dictate the version. This should fix our builds against released and nightly TF. PiperOrigin-RevId: 522143653 --- RELEASE.md | 3 +++ WORKSPACE | 4 ++-- configure.sh | 2 +- setup.py | 4 ++-- struct2tensor/struct2tensor.bzl | 2 +- struct2tensor/workspace.bzl | 4 ++-- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 3961481..cdfc1c5 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -6,6 +6,9 @@ ## Bug Fixes and Other Changes +* Depends on `tensorflow>=2.12.0,<2.13`. +* Depends on `protobuf>=3.20.3,<5`. + ## Breaking Changes ## Deprecations diff --git a/WORKSPACE b/WORKSPACE index 6692bab..8406dc2 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -41,8 +41,8 @@ tf_configure(name = "local_config_tf") # 3. Request the new archive to be mirrored on mirror.bazel.build for more # reliable downloads. -_TENSORFLOW_GIT_COMMIT = "d5b57ca93e506df258271ea00fc29cf98383a374" # tf 2.11.0 -_TENSORFLOW_ARCHIVE_SHA256 = "37abf3d45a34e11012ef60ee6dcd79e317384b62d319b6346cc2a94eb447e172" +_TENSORFLOW_GIT_COMMIT = "0db597d0d758aba578783b5bf46c889700a45085" # tf 2.12.0 +_TENSORFLOW_ARCHIVE_SHA256 = "e97c242d13e386192e3a9f60fd674461b6595b02b3a2a48edd6fb11aeee7e038" http_archive( name = "org_tensorflow", diff --git a/configure.sh b/configure.sh index 49900db..927aaed 100755 --- a/configure.sh +++ b/configure.sh @@ -62,7 +62,7 @@ SHARED_LIBRARY_DIR=${TF_LFLAGS:2} SHARED_LIBRARY_NAME=$(echo $TF_LFLAGS | rev | cut -d":" -f1 | rev) if ! [[ $TF_LFLAGS =~ .*:.* ]]; then if [[ "$(uname)" == "Darwin" ]]; then - SHARED_LIBRARY_NAME="libtensorflow_framework.dylib" + SHARED_LIBRARY_NAME="libtensorflow_framework.2.dylib" else SHARED_LIBRARY_NAME="libtensorflow_framework.so" fi diff --git a/setup.py b/setup.py index ad947d6..323a21f 100644 --- a/setup.py +++ b/setup.py @@ -77,8 +77,8 @@ def select_constraint(default, nightly=None, git_master=None): # TODO(b/263060885): Remove the explicit numpy dependency once TF works # with numpy>=1.24. 'numpy<1.24', - 'protobuf>=3.13,<4', - 'tensorflow>=2.11.0,<2.12', + 'protobuf>=3.20.3,<5', + 'tensorflow>=2.12,<3', 'tensorflow-metadata' + select_constraint( default='>=1.13.0,<1.14.0', nightly='>=1.14.0.dev', diff --git a/struct2tensor/struct2tensor.bzl b/struct2tensor/struct2tensor.bzl index 11d13c8..6b41b28 100644 --- a/struct2tensor/struct2tensor.bzl +++ b/struct2tensor/struct2tensor.bzl @@ -176,7 +176,7 @@ def s2t_proto_library_py(name, proto_library, srcs = [], deps = [], oss_deps = [ name = name, srcs = srcs, srcs_version = "PY3ONLY", - deps = ["@com_google_protobuf//:protobuf_python"] + oss_deps, + deps = ["@com_google_protobuf//:well_known_types_py_pb2"] + oss_deps, default_runtime = "@com_google_protobuf//:protobuf_python", protoc = "@com_google_protobuf//:protoc", visibility = visibility, diff --git a/struct2tensor/workspace.bzl b/struct2tensor/workspace.bzl index 71d9bdc..4f7cd6d 100644 --- a/struct2tensor/workspace.bzl +++ b/struct2tensor/workspace.bzl @@ -53,10 +53,10 @@ def struct2tensor_workspace(): urls = ["https://github.com/apache/arrow/archive/%s.zip" % ARROW_COMMIT], ) - _TFMD_COMMIT_HASH = "e34b5df6d644f32f7a30b4a5c89680fdf7b82519" # 1.13.0 + _TFMD_COMMIT_HASH = "ab1a22c7a1ad8485d52f660fbf285f6948f0f6b2" # 1.12.0 with updated protobuf http_archive( name = "com_github_tensorflow_metadata", - sha256 = "c3ef479c7b6d1e2300edf58591ba1ed9836b8088ba134dd4e9cb8b88ec887037", + sha256 = "6950a27c748c59bdac6cb5faa4215478a72f19897dee6ee6b67f5c749291f8b7", strip_prefix = "metadata-%s" % _TFMD_COMMIT_HASH, urls = [ "https://github.com/tensorflow/metadata/archive/%s.tar.gz" % _TFMD_COMMIT_HASH,