Skip to content

Commit b917fa4

Browse files
Update rules_python to v1.6 in tf_keras.
PiperOrigin-RevId: 805440974
1 parent 5e6f651 commit b917fa4

File tree

53 files changed

+122
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+122
-82
lines changed

.bazelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ test --define=use_fast_cpp_protos=false
4545
build --incompatible_enable_cc_toolchain_resolution
4646
build --repo_env USE_HERMETIC_CC_TOOLCHAIN=1
4747

48+
# Some targets have the same py source file, but use different
49+
# configurations via `requires-` tags. This results in an action
50+
# conflict when precompiling. Disable to avoid that problem.
51+
# See https://github.com/bazel-contrib/rules_python/issues/2445
52+
build --@rules_python//python/config_settings:precompile=force_disabled
53+
4854
# This config refers to building with CUDA available. It does not necessarily
4955
# mean that we build CUDA op kernels.
5056
build:using_cuda --define=using_cuda=true

BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
2-
load("@python//:defs.bzl", "compile_pip_requirements")
32
load("@python_version_repo//:py_version.bzl", "REQUIREMENTS")
3+
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
44
load(
55
"@xla//third_party/py:py_import.bzl",
66
"py_import",

WORKSPACE

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
workspace(name = "org_keras")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
45

56
# Toolchains for ML projects hermetic builds.
67
# Details: https://github.com/google-ml-infra/rules_ml_toolchain
@@ -26,11 +27,11 @@ register_toolchains("@rules_ml_toolchain//cc:linux_x86_64_linux_x86_64_cuda")
2627

2728
http_archive(
2829
name = "xla",
29-
sha256 = "5b20a5fd981a23a5dea092f13f9279b5c2e8005b509ac141fb65f22a42ad35a9",
30-
strip_prefix = "xla-32b7537aee5a1e9145a6e11fc258347c41d6f5f8",
30+
sha256 = "96ffcfd4a52bcb75d34b426f5a26d4e83a4dcf8f05bccf98e60d415a02ac6bca",
31+
strip_prefix = "xla-5a2c4befe808fbc894b55747d3c8955852a68ae6",
3132
urls = [
32-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/openxla/xla/archive/32b7537aee5a1e9145a6e11fc258347c41d6f5f8.tar.gz",
33-
"https://github.com/openxla/xla/archive/32b7537aee5a1e9145a6e11fc258347c41d6f5f8.tar.gz",
33+
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/openxla/xla/archive/5a2c4befe808fbc894b55747d3c8955852a68ae6.tar.gz",
34+
"https://github.com/openxla/xla/archive/5a2c4befe808fbc894b55747d3c8955852a68ae6.tar.gz",
3435
],
3536
)
3637

@@ -124,14 +125,12 @@ cuda_configure(name = "local_config_cuda")
124125
# Needed by protobuf
125126
http_archive(
126127
name = "bazel_skylib",
128+
sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f",
127129
urls = [
128-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
129-
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
130+
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
131+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
130132
],
131-
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
132133
)
133-
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
134-
bazel_skylib_workspace()
135134

136135
# Needed by protobuf
137136
http_archive(
@@ -147,24 +146,45 @@ bind(
147146
actual = "@six_archive//:six",
148147
)
149148

150-
tf_http_archive(
149+
# Needed by protobuf
150+
load("@xla//third_party/absl:workspace.bzl", absl = "repo")
151+
152+
absl()
153+
154+
# Needed by protobuf
155+
http_archive(
156+
name = "rules_java",
157+
sha256 = "5449ed36d61269579dd9f4b0e532cd131840f285b389b3795ae8b4d717387dd8",
158+
urls = [
159+
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/rules_java/releases/download/8.7.0/rules_java-8.7.0.tar.gz",
160+
"https://github.com/bazelbuild/rules_java/releases/download/8.7.0/rules_java-8.7.0.tar.gz",
161+
],
162+
)
163+
164+
load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
165+
166+
rules_java_dependencies()
167+
168+
maybe(
169+
tf_http_archive,
151170
name = "com_google_protobuf",
152171
patch_file = ["@xla//third_party/protobuf:protobuf.patch"],
153-
sha256 = "f645e6e42745ce922ca5388b1883ca583bafe4366cc74cf35c3c9299005136e2",
154-
strip_prefix = "protobuf-5.28.3",
155-
urls = tf_mirror_urls("https://github.com/protocolbuffers/protobuf/archive/refs/tags/v5.28.3.zip"),
172+
sha256 = "6e09bbc950ba60c3a7b30280210cd285af8d7d8ed5e0a6ed101c72aff22e8d88",
173+
strip_prefix = "protobuf-6.31.1",
174+
urls = tf_mirror_urls("https://github.com/protocolbuffers/protobuf/archive/refs/tags/v6.31.1.zip"),
175+
repo_mapping = {
176+
"@abseil-cpp": "@com_google_absl",
177+
"@protobuf_pip_deps": "@pypi",
178+
},
156179
)
157180

158181
# ZLIB. Need by com_google_protobuf.
159-
http_archive(
182+
tf_http_archive(
160183
name = "zlib",
161184
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
162-
sha256 = "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30",
163-
strip_prefix = "zlib-1.2.13",
164-
urls = [
165-
"https://storage.googleapis.com/mirror.tensorflow.org/zlib.net/zlib-1.2.13.tar.gz",
166-
"https://zlib.net/zlib-1.2.13.tar.gz",
167-
],
185+
sha256 = "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23",
186+
strip_prefix = "zlib-1.3.1",
187+
urls = tf_mirror_urls("https://zlib.net/fossils/zlib-1.3.1.tar.gz"),
168188
)
169189

170190

tf_keras/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Contains the TF-Keras API (internal TensorFlow version).
33

44
load("@org_keras//tf_keras:tf_keras.bzl", "tf_py_test")
5-
# Placeholder: load unaliased py_library
5+
load("@rules_python//python:py_library.bzl", "py_library")
66

77
# copybara:uncomment_begin(google-only)
88
# load("//tools/build_defs/license:license.bzl", "license")

tf_keras/api/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Description:
22
# Package for TF-Keras.
33

4-
# Placeholder: load unaliased py_binary
5-
# Placeholder: load unaliased py_library
4+
load("@rules_python//python:py_binary.bzl", "py_binary")
5+
load("@rules_python//python:py_library.bzl", "py_library")
66
load("//tf_keras/api:api_gen.bzl", "generate_apis")
77
load("//tf_keras/api:api_init_files.bzl", "KERAS_API_INIT_FILES", "KERAS_API_INIT_FILES_V1")
88

tf_keras/api/api_gen.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Rules to generate the TensorFlow public API from annotated files."""
22

3-
# Placeholder: load unaliased PyInfo
3+
load("@rules_python//python:py_info.bzl", "PyInfo")
44
# Placeholder: load if_indexing_source_code
55

66
_TARGET_PATTERNS = [

tf_keras/applications/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Description:
22
# Contains the TF-Keras Application package (internal TensorFlow version).
33

4-
# Placeholder: load unaliased py_library
54
load("@org_keras//tf_keras:tf_keras.bzl", "tf_py_test")
5+
load("@rules_python//python:py_library.bzl", "py_library")
66

77
package(
88
# copybara:uncomment default_applicable_licenses = ["//tf_keras:license"],

tf_keras/benchmarks/BUILD

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# Implementation of TF-Keras benchmarks.
33

44
load("@org_keras//tf_keras:tf_keras.bzl", "cuda_py_test")
5-
# Placeholder: load unaliased py_binary
6-
# Placeholder: load unaliased py_library
7-
# Placeholder: load unaliased py_test
5+
load("@rules_python//python:py_binary.bzl", "py_binary")
6+
load("@rules_python//python:py_library.bzl", "py_library")
7+
load("@rules_python//python:py_test.bzl", "py_test")
88

99
package(
1010
# copybara:uncomment default_applicable_licenses = ["//tf_keras:license"],

tf_keras/benchmarks/layer_benchmarks/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Implementation of benchmarks on TF-Keras layers.
33

44
load("@org_keras//tf_keras:tf_keras.bzl", "tf_py_test")
5-
# Placeholder: load unaliased py_library
5+
load("@rules_python//python:py_library.bzl", "py_library")
66

77
package(
88
# copybara:uncomment default_applicable_licenses = ["//tf_keras:license"],

tf_keras/benchmarks/saved_model_benchmarks/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Implementation of TF-Keras benchmarks.
33

44
load("@org_keras//tf_keras:tf_keras.bzl", "cuda_py_test")
5-
# Placeholder: load unaliased py_library
5+
load("@rules_python//python:py_library.bzl", "py_library")
66

77
package(
88
# copybara:uncomment default_applicable_licenses = ["//tf_keras:license"],

0 commit comments

Comments
 (0)