diff --git a/WORKSPACE b/WORKSPACE index 7b29e56f17..a75b8d7762 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -66,7 +66,8 @@ http_archive( url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.0.tar.gz", ) -load("@rules_python//python:repositories.bzl", "py_repositories") +load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") +python_register_toolchains("python", ignore_root_user_error = True, python_version = "3.10") py_repositories() @@ -111,13 +112,13 @@ http_archive( ], ) -# XNNPACK on 2024-07-16 +# XNNPACK on 2024-09-24 http_archive( name = "XNNPACK", # `curl -L | shasum -a 256` - sha256 = "08489dff917a8009bf2187995fc8e0a33a2207eef466e400302bbf3ef40e4811", - strip_prefix = "XNNPACK-3014fb625c73f3b1ce1f6d3e45f1e216f9cb7105", - url = "https://github.com/google/XNNPACK/archive/3014fb625c73f3b1ce1f6d3e45f1e216f9cb7105.zip", + sha256 = "feecde71526d955a0125f7ddd28b9f2d282cd6fca6c1c6bde48f29f86365dd0b", + strip_prefix = "XNNPACK-9007aa93227010168e615f9c6552035040c94a15", + url = "https://github.com/google/XNNPACK/archive/9007aa93227010168e615f9c6552035040c94a15.zip", ) # TODO: This is an are indirect depedency. We should factor it out. @@ -560,10 +561,12 @@ http_archive( ) # TensorFlow repo should always go after the other external dependencies. -# TF on 2024-07-18. -_TENSORFLOW_GIT_COMMIT = "117a62ac439ed87eb26f67208be60e01c21960de" -# curl -L https://github.com/tensorflow/tensorflow/archive/117a62ac439ed87eb26f67208be60e01c21960de.tar.gz | shasum -a 256 -_TENSORFLOW_SHA256 = "2a1e56f9f83f99e2b9d01a184bc6f409209b36c98fb94b6d5db3f0ab20ec33f2" +# TF on 2024-09-24 +_TENSORFLOW_GIT_COMMIT = "5329ec8dd396487982ef3e743f98c0195af39a6b" + +# curl -L https://github.com/tensorflow/tensorflow/archive/.tar.gz | shasum -a 256 +_TENSORFLOW_SHA256 = "eb1f8d740d59ea3dee91108ab1fc19d91c4e9ac2fd17d9ab86d865c3c43d81c9" + http_archive( name = "org_tensorflow", urls = [ @@ -589,6 +592,36 @@ tf_workspace3() load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2") tf_workspace2() +load( + "@org_tensorflow//third_party/gpus/cuda/hermetic:cuda_json_init_repository.bzl", + "cuda_json_init_repository", +) + +cuda_json_init_repository() + +load( + "@cuda_redist_json//:distributions.bzl", + "CUDA_REDISTRIBUTIONS", + "CUDNN_REDISTRIBUTIONS", +) +load( + "@org_tensorflow//third_party/gpus/cuda/hermetic:cuda_redist_init_repositories.bzl", + "cuda_redist_init_repositories", + "cudnn_redist_init_repository", +) +cuda_redist_init_repositories( + cuda_redistributions = CUDA_REDISTRIBUTIONS, +) +cudnn_redist_init_repository( + cudnn_redistributions = CUDNN_REDISTRIBUTIONS, +) + +load( + "@org_tensorflow//third_party/gpus/cuda/hermetic:cuda_configure.bzl", + "cuda_configure", +) +cuda_configure(name = "local_config_cuda") + # Edge TPU http_archive( name = "libedgetpu", diff --git a/mediapipe/tasks/c/text/text_embedder/text_embedder_test.cc b/mediapipe/tasks/c/text/text_embedder/text_embedder_test.cc index f67b7ccc45..951237896f 100644 --- a/mediapipe/tasks/c/text/text_embedder/text_embedder_test.cc +++ b/mediapipe/tasks/c/text/text_embedder/text_embedder_test.cc @@ -91,7 +91,7 @@ TEST(TextEmbedderTest, SucceedsWithCosineSimilarity) { double similarity; text_embedder_cosine_similarity(&result0.embeddings[0], &result1.embeddings[0], &similarity, nullptr); - double expected_similarity = 0.97565; + double expected_similarity = 0.98513 + 0.00512937; EXPECT_LE(abs(similarity - expected_similarity), kPrecision); text_embedder_close_result(&result0); diff --git a/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc b/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc index 507acbbb6e..c4f63aab63 100644 --- a/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc +++ b/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc @@ -46,7 +46,7 @@ using ::testing::HasSubstr; using ::testing::Optional; constexpr int kMaxSeqLen = 128; -const float kPrecision = 1e-6; +const float kPrecision = 1e-5; constexpr char kTestDataDirectory[] = "/mediapipe/tasks/testdata/text/"; constexpr char kTestBertModelPath[] = "bert_text_classifier.tflite"; constexpr char kInvalidModelPath[] = "i/do/not/exist.tflite"; @@ -251,8 +251,8 @@ TEST_F(TextClassifierTest, BertLongPositive) { categories.push_back( {/*index=*/0, /*score=*/0.023313, /*category_name=*/"negative"}); #else - categories.push_back({1, 0.981590, "positive"}); - categories.push_back({0, 0.018409, "negative"}); + categories.push_back({1, 0.983276, "positive"}); + categories.push_back({0, 0.016723, "negative"}); #endif // _WIN32 expected.classifications.emplace_back( diff --git a/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc b/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc index e70eacc9a4..25940856c6 100644 --- a/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc +++ b/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc @@ -82,7 +82,7 @@ TEST_F(EmbedderTest, SucceedsWithMobileBert) { #elif defined(__FMA__) ASSERT_NEAR(result0.embeddings[0].float_embedding[0], 21.3605f, kEpsilon); #else - ASSERT_NEAR(result0.embeddings[0].float_embedding[0], 21.1785f, kEpsilon); + ASSERT_NEAR(result0.embeddings[0].float_embedding[0], 21.2054f, kEpsilon); #endif // _WIN32 MP_ASSERT_OK_AND_ASSIGN( @@ -92,7 +92,7 @@ TEST_F(EmbedderTest, SucceedsWithMobileBert) { #ifdef __FMA__ ASSERT_NEAR(result1.embeddings[0].float_embedding[0], 21.254150f, kEpsilon); #else - ASSERT_NEAR(result1.embeddings[0].float_embedding[0], 20.322639f, kEpsilon); + ASSERT_NEAR(result1.embeddings[0].float_embedding[0], 19.684337f, kEpsilon); #endif // Check cosine similarity. diff --git a/third_party/org_tensorflow_system_python.diff b/third_party/org_tensorflow_system_python.diff index bd569f1501..a05c94b38f 100644 --- a/third_party/org_tensorflow_system_python.diff +++ b/third_party/org_tensorflow_system_python.diff @@ -95,45 +95,6 @@ index 018b6e1004c..cf355612386 100644 ":c_api_types", ":c_api_without_op_resolver_without_alwayslink", ":common", -diff --git a/tensorflow/tools/toolchains/cpus/aarch64/aarch64_compiler_configure.bzl b/tensorflow/tools/toolchains/cpus/aarch64/aarch64_compiler_configure.bzl -index 00cd6983ca3..d9c5ef16f9b 100644 ---- a/tensorflow/tools/toolchains/cpus/aarch64/aarch64_compiler_configure.bzl -+++ b/tensorflow/tools/toolchains/cpus/aarch64/aarch64_compiler_configure.bzl -@@ -1,7 +1,7 @@ - """Configurations of AARCH64 builds used with Docker container.""" - - load("//tensorflow/tools/toolchains:cpus/aarch64/aarch64.bzl", "remote_aarch64_configure") --load("//third_party/py:python_configure.bzl", "remote_python_configure") -+load("//third_party/py/non_hermetic:python_configure.bzl", "remote_python_configure") - load("//third_party/remote_config:remote_platform_configure.bzl", "remote_platform_configure") - - def ml2014_tf_aarch64_configs(name_container_map, env): -diff --git a/tensorflow/tools/toolchains/remote_config/rbe_config.bzl b/tensorflow/tools/toolchains/remote_config/rbe_config.bzl -index ae776c2a2fd..108e79edbd7 100644 ---- a/tensorflow/tools/toolchains/remote_config/rbe_config.bzl -+++ b/tensorflow/tools/toolchains/remote_config/rbe_config.bzl -@@ -4,7 +4,7 @@ load("//tensorflow/tools/toolchains/remote_config:containers.bzl", "containers") - load("//third_party/gpus:cuda_configure.bzl", "remote_cuda_configure") - load("//third_party/gpus:rocm_configure.bzl", "remote_rocm_configure") - load("//third_party/nccl:nccl_configure.bzl", "remote_nccl_configure") --load("//third_party/py:python_configure.bzl", "local_python_configure", "remote_python_configure") -+load("//third_party/py/non_hermetic:python_configure.bzl", "local_python_configure", "remote_python_configure") - load("//third_party/remote_config:remote_platform_configure.bzl", "remote_platform_configure") - load("//third_party/tensorrt:tensorrt_configure.bzl", "remote_tensorrt_configure") - -diff --git a/tensorflow/workspace2.bzl b/tensorflow/workspace2.bzl -index 380a1a93585..3f3e12a0617 100644 ---- a/tensorflow/workspace2.bzl -+++ b/tensorflow/workspace2.bzl -@@ -44,7 +44,7 @@ load("//third_party/nasm:workspace.bzl", nasm = "repo") - load("//third_party/nccl:nccl_configure.bzl", "nccl_configure") - load("//third_party/opencl_headers:workspace.bzl", opencl_headers = "repo") - load("//third_party/pasta:workspace.bzl", pasta = "repo") --load("//third_party/py:python_configure.bzl", "python_configure") -+load("//third_party/py/non_hermetic:python_configure.bzl", "python_configure") - load("//third_party/py/ml_dtypes:workspace.bzl", ml_dtypes = "repo") - load("//third_party/pybind11_abseil:workspace.bzl", pybind11_abseil = "repo") - load("//third_party/pybind11_bazel:workspace.bzl", pybind11_bazel = "repo") diff --git a/third_party/py/non_hermetic/BUILD b/third_party/py/non_hermetic/BUILD new file mode 100644 index 00000000000..d14731cafcd