-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathWORKSPACE
More file actions
498 lines (389 loc) · 16.2 KB
/
WORKSPACE
File metadata and controls
498 lines (389 loc) · 16.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# buildifier: disable=load-on-top
workspace(name = "litert_lm")
# UPDATED = 2026-04-07
LITERT_REF = "ceaf89c65502a698f2a368cfabc1cb2a8a65183d"
LITERT_SHA256 = "d8fec1eaabf81402d6d17b0d7ad6e6a727c2b4c16c9fdb0d56c4ff3c7076f5d1"
TENSORFLOW_REF = "3b6337f1146f8b4b61dbdd635a5cf14ef3a7d678"
TENSORFLOW_SHA256 = "af5ef7b10547191f4147f07cddec6ad6828bf66d32c5933fbf2ff2d219ee5c85"
# buildifier: disable=load-on-top
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_jar")
http_archive(
name = "rules_shell",
sha256 = "bc61ef94facc78e20a645726f64756e5e285a045037c7a61f65af2941f4c25e1",
strip_prefix = "rules_shell-0.4.1",
url = "https://github.com/bazelbuild/rules_shell/releases/download/v0.4.1/rules_shell-v0.4.1.tar.gz",
)
load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
rules_shell_dependencies()
rules_shell_toolchains()
http_archive(
name = "rules_platform",
sha256 = "0aadd1bd350091aa1f9b6f2fbcac8cd98201476289454e475b28801ecf85d3fd",
url = "https://github.com/bazelbuild/rules_platform/releases/download/0.1.0/rules_platform-0.1.0.tar.gz",
)
# Use recent platoforms version to support uefi platform.
http_archive(
name = "platforms",
sha256 = "3384eb1c30762704fbe38e440204e114154086c8fc8a8c2e3e28441028c019a8",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/1.0.0/platforms-1.0.0.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/1.0.0/platforms-1.0.0.tar.gz",
],
)
# Use 3.22.0 (from 3.5.1 of tensorflow) to fix binary signing issue on MacOS Tahoe.
http_archive(
name = "build_bazel_rules_apple",
sha256 = "a78f26c22ac8d6e3f3fcaad50eace4d9c767688bd7254b75bdf4a6735b299f6a",
url = "https://github.com/bazelbuild/rules_apple/releases/download/3.22.0/rules_apple.3.22.0.tar.gz",
)
load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)
apple_rules_dependencies()
http_archive(
name = "build_bazel_rules_swift",
sha256 = "f7a67197cd8a79debfe70b8cef4dc19d03039af02cc561e31e0718e98cad83ac",
url = "https://github.com/bazelbuild/rules_swift/releases/download/2.9.0/rules_swift.2.9.0.tar.gz",
)
# Lower the version from 1.24.5 that tensorflow uses to 1.23.1, the highest version which don't have
# issues with missing LC_UUID, DEVELOPER_DIR or SDKROOT on MacOS Tahoe.
http_archive(
name = "build_bazel_apple_support",
sha256 = "ee20cc5c0bab47065473c8033d462374dd38d172406ecc8de5c8f08487943f2f",
url = "https://github.com/bazelbuild/apple_support/releases/download/1.23.1/apple_support.1.23.1.tar.gz",
)
http_archive(
name = "bazel_features",
sha256 = "c26b4e69cf02fea24511a108d158188b9d8174426311aac59ce803a78d107648",
strip_prefix = "bazel_features-1.43.0",
url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.43.0/bazel_features-v1.43.0.tar.gz",
)
# TensorFlow
http_archive(
name = "org_tensorflow",
patches = ["@//:PATCH.tensorflow"],
sha256 = TENSORFLOW_SHA256,
strip_prefix = "tensorflow-" + TENSORFLOW_REF,
url = "https://github.com/tensorflow/tensorflow/archive/" + TENSORFLOW_REF + ".tar.gz",
)
# Initialize the TensorFlow repository and all dependencies.
#
# The cascade of load() statements and tf_workspace?() calls works around the
# restriction that load() statements need to be at the top of .bzl files.
# E.g. we can not retrieve a new repository with http_archive and then load()
# a macro from that repository in the same file.
load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3")
tf_workspace3()
# Toolchains for ML projects
# Details: https://github.com/google-ml-infra/rules_ml_toolchain
http_archive(
name = "rules_ml_toolchain",
sha256 = "9dbee8f24cc1b430bf9c2a6661ab70cbca89979322ddc7742305a05ff637ab6b",
strip_prefix = "rules_ml_toolchain-545c80f1026d526ea9c7aaa410bf0b52c9a82e74",
url = "https://github.com/google-ml-infra/rules_ml_toolchain/archive/545c80f1026d526ea9c7aaa410bf0b52c9a82e74.tar.gz",
)
load(
"@rules_ml_toolchain//cc/deps:cc_toolchain_deps.bzl",
"cc_toolchain_deps",
)
cc_toolchain_deps()
# Initialize hermetic Python
load("@xla//third_party/py:python_init_rules.bzl", "python_init_rules")
python_init_rules()
load("@xla//third_party/py:python_init_repositories.bzl", "python_init_repositories")
python_init_repositories(
default_python_version = "system",
local_wheel_dist_folder = "dist",
local_wheel_inclusion_list = [
"tensorflow*",
"tf_nightly*",
],
local_wheel_workspaces = ["@org_tensorflow//:WORKSPACE"],
requirements = {
"3.10": "@org_tensorflow//:requirements_lock_3_10.txt",
"3.11": "@org_tensorflow//:requirements_lock_3_11.txt",
"3.12": "@org_tensorflow//:requirements_lock_3_12.txt",
"3.13": "@org_tensorflow//:requirements_lock_3_13.txt",
"3.14": "@org_tensorflow//:requirements_lock_3_14.txt",
},
)
load("@xla//third_party/py:python_init_toolchains.bzl", "python_init_toolchains")
python_init_toolchains()
load("@xla//third_party/py:python_init_pip.bzl", "python_init_pip")
python_init_pip()
load("@pypi//:requirements.bzl", "install_deps")
install_deps()
# End hermetic Python initialization
RULES_JVM_EXTERNAL_TAG = "6.8"
RULES_JVM_EXTERNAL_SHA = "704a0197e4e966f96993260418f2542568198490456c21814f647ae7091f56f2"
http_archive(
name = "rules_jvm_external",
sha256 = RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (RULES_JVM_EXTERNAL_TAG, RULES_JVM_EXTERNAL_TAG),
)
load("@rules_jvm_external//:defs.bzl", "maven_install")
maven_install(
name = "maven",
artifacts = [
"com.google.code.gson:gson:2.13.2",
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0",
"org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2")
tf_workspace2()
load("@org_tensorflow//tensorflow:workspace1.bzl", "tf_workspace1")
tf_workspace1()
load("@org_tensorflow//tensorflow:workspace0.bzl", "tf_workspace0")
tf_workspace0()
load(
"@xla//third_party/py:python_wheel.bzl",
"python_wheel_version_suffix_repository",
)
python_wheel_version_suffix_repository(name = "tf_wheel_version_suffix")
load(
"@rules_ml_toolchain//gpu/cuda:cuda_json_init_repository.bzl",
"cuda_json_init_repository",
)
cuda_json_init_repository()
load(
"@cuda_redist_json//:distributions.bzl",
"CUDA_REDISTRIBUTIONS",
"CUDNN_REDISTRIBUTIONS",
)
load(
"@rules_ml_toolchain//gpu/cuda: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(
"@rules_ml_toolchain//gpu/cuda:cuda_configure.bzl",
"cuda_configure",
)
cuda_configure(name = "local_config_cuda")
load(
"@rules_ml_toolchain//gpu/nccl:nccl_redist_init_repository.bzl",
"nccl_redist_init_repository",
)
nccl_redist_init_repository()
load(
"@rules_ml_toolchain//gpu/nccl:nccl_configure.bzl",
"nccl_configure",
)
nccl_configure(name = "local_config_nccl")
# Kotlin rules
http_archive(
name = "rules_kotlin",
sha256 = "e1448a56b2462407b2688dea86df5c375b36a0991bd478c2ddd94c97168125e2",
url = "https://github.com/bazelbuild/rules_kotlin/releases/download/v2.1.3/rules_kotlin-v2.1.3.tar.gz",
)
load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
kotlin_repositories() # if you want the default. Otherwise see custom kotlinc distribution below
load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
kt_register_toolchains() # to use the default toolchain, otherwise see toolchains below
# Rust (for HuggingFace Tokenizers)
http_archive(
name = "rules_rust",
patches = ["@//:PATCH.rules_rust"],
sha256 = "53c1bac7ec48f7ce48c4c1c6aa006f27515add2aeb05725937224e6e00ec7cea",
url = "https://github.com/bazelbuild/rules_rust/releases/download/0.61.0/rules_rust-0.61.0.tar.gz",
)
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
rules_rust_dependencies()
rust_register_toolchains(
edition = "2021",
extra_target_triples = [
# Explicitly add toolchains for mobile. Desktop platforms are supported by default.
"aarch64-linux-android",
"aarch64-apple-ios",
"aarch64-apple-ios-sim",
"x86_64-linux-android",
],
)
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
crate_universe_dependencies()
load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository")
load("@rules_rust//rust/platform:triple_mappings.bzl", "SUPPORTED_PLATFORM_TRIPLES")
crates_repository(
name = "crate_index",
annotations = {
"llguidance": [
crate.annotation(
additive_build_file = "@//:BUILD.llguidance",
gen_build_script = False,
patches = [
"@//:PATCH.llguidance_regexvec",
"@//:PATCH.llguidance_numeric",
"@//:PATCH.llguidance_grammar",
"@//:PATCH.llguidance_parser",
"@//:PATCH.llguidance_perf",
],
),
],
"toktrie": [
crate.annotation(
patches = ["@//:PATCH.toktrie"],
),
],
},
cargo_lockfile = "//:Cargo.lock",
lockfile = "//:cargo-bazel-lock.json",
manifests = [
"//:Cargo.toml",
],
supported_platform_triples = SUPPORTED_PLATFORM_TRIPLES + [
"x86_64-linux-android",
],
)
load("@crate_index//:defs.bzl", "crate_repositories")
crate_repositories()
# cxxbridge-cmd is a binary-only package so we follow the steps in
# https://bazelbuild.github.io/rules_rust/crate_universe_workspace.html#binary-dependencies.
http_archive(
name = "cxxbridge_cmd",
build_file = "//cxxbridge_cmd:BUILD.cxxbridge_cmd.bazel",
integrity = "sha256-pf/3kWu94FwtuZRp8J3PryA78lsJbMv052GgR5JBLhA=",
strip_prefix = "cxxbridge-cmd-1.0.149",
type = "tar.gz",
url = "https://static.crates.io/crates/cxxbridge-cmd/cxxbridge-cmd-1.0.149.crate",
)
crates_repository(
name = "cxxbridge_cmd_deps",
cargo_lockfile = "//cxxbridge_cmd:Cargo.lock",
manifests = ["@cxxbridge_cmd//:Cargo.toml"],
)
load("@cxxbridge_cmd_deps//:defs.bzl", cxxbridge_cmd_deps = "crate_repositories")
cxxbridge_cmd_deps()
# Same one downloaded by tensorflow, but refer contrib/minizip.
http_archive(
name = "minizip",
add_prefix = "minizip",
build_file = "@//:BUILD.minizip",
sha256 = "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23",
strip_prefix = "zlib-1.3.1/contrib/minizip",
url = "https://zlib.net/fossils/zlib-1.3.1.tar.gz",
)
http_archive(
name = "sentencepiece",
build_file = "@//:BUILD.sentencepiece",
patch_cmds = [
# Empty config.h seems enough.
"touch config.h",
# Replace third_party/absl/ with absl/ in *.h and *.cc files.
"sed -i -e 's|#include \"third_party/absl/|#include \"absl/|g' *.h *.cc",
# Replace third_party/darts_clone/ with include/ in *.h and *.cc files.
"sed -i -e 's|#include \"third_party/darts_clone/|#include \"include/|g' *.h *.cc",
],
patches = ["@//:PATCH.sentencepiece"],
sha256 = "9970f0a0afee1648890293321665e5b2efa04eaec9f1671fcf8048f456f5bb86",
strip_prefix = "sentencepiece-0.2.0/src",
url = "https://github.com/google/sentencepiece/archive/refs/tags/v0.2.0.tar.gz",
)
http_archive(
name = "litert",
patch_cmds = [
# Replace @//third_party with @litert//third_party in files under third_party/.
"sed -i -e 's|\"@//third_party/|\"@litert//third_party/|g' third_party/*/*",
],
sha256 = LITERT_SHA256,
strip_prefix = "LiteRT-" + LITERT_REF,
url = "https://github.com/google-ai-edge/LiteRT/archive/" + LITERT_REF + ".tar.gz",
)
http_archive(
name = "tokenizers_cpp",
build_file = "@//:BUILD.tokenizers_cpp",
sha256 = "3e0b9ec325a326b0a2cef5cf164ee94a74ac372c5881ae5af634036db0441823",
strip_prefix = "tokenizers-cpp-0.1.1",
url = "https://github.com/mlc-ai/tokenizers-cpp/archive/refs/tags/v0.1.1.tar.gz",
)
http_archive(
name = "absl_py",
sha256 = "8a3d0830e4eb4f66c4fa907c06edf6ce1c719ced811a12e26d9d3162f8471758",
strip_prefix = "abseil-py-2.1.0",
url = "https://github.com/abseil/abseil-py/archive/refs/tags/v2.1.0.tar.gz",
)
http_archive(
name = "nlohmann_json",
sha256 = "34660b5e9a407195d55e8da705ed26cc6d175ce5a6b1fb957e701fb4d5b04022",
strip_prefix = "json-3.12.0",
url = "https://github.com/nlohmann/json/archive/refs/tags/v3.12.0.zip",
)
http_archive(
name = "minja",
build_file = "@//:BUILD.minja",
patches = ["@//:PATCH.minja"],
sha256 = "752f47dd2a2f4920a66f497c952785073c1983f12f084b99e5c12bf89f96acfe",
strip_prefix = "minja-58568621432715b0ed38efd16238b0e7ff36c3ba",
url = "https://github.com/google/minja/archive/58568621432715b0ed38efd16238b0e7ff36c3ba.zip",
)
http_archive(
name = "miniaudio",
build_file = "@//:BUILD.miniaudio",
sha256 = "bcb07bfb27e6fa94d34da73ba2d5642d4940b208ec2a660dbf4e52e6b7cd492f",
strip_prefix = "miniaudio-0.11.22",
url = "https://github.com/mackron/miniaudio/archive/refs/tags/0.11.22.tar.gz",
)
http_archive(
name = "stb",
build_file = "@//:BUILD.stb",
sha256 = "119b9f3cca3e50225dc946ed1acd1b7a160943bc8bf549760109cea4e4e7c836",
strip_prefix = "stb-f58f558c120e9b32c217290b80bad1a0729fbb2c",
url = "https://github.com/nothings/stb/archive/f58f558c120e9b32c217290b80bad1a0729fbb2c.zip",
)
http_jar(
name = "javax_json",
sha256 = "0e1dec40a1ede965941251eda968aeee052cc4f50378bc316cc48e8159bdbeb4",
url = "https://jcenter.bintray.com/org/glassfish/javax.json/1.0.4/javax.json-1.0.4.jar",
)
# Android rules. Need latest rules_android_ndk to use NDK 26+.
load("@rules_android_ndk//:rules.bzl", "android_ndk_repository")
android_ndk_repository(name = "androidndk")
android_sdk_repository(name = "androidsdk")
# Configure Android NDK only when ANDROID_NDK_HOME is set.
# Creates current_android_ndk_env.bzl as a workaround since shell environment is available only
# through repository rule's context.
load("//:android_ndk_env.bzl", "check_android_ndk_env")
check_android_ndk_env(name = "android_ndk_env")
load("@android_ndk_env//:current_android_ndk_env.bzl", "ANDROID_NDK_HOME_IS_SET")
# Use "@android_ndk_env//:all" as a dummy toolchain target as register_toolchains() does not take
# an empty string.
register_toolchains("@androidndk//:all" if ANDROID_NDK_HOME_IS_SET else "@android_ndk_env//:all")
# VENDOR SDKS ######################################################################################
# QUALCOMM ---------------------------------------------------------------------------------------
# The actual macro call will be set during configure for now.
load("@litert//third_party/qairt:workspace.bzl", "qairt")
qairt()
# MEDIATEK ---------------------------------------------------------------------------------------
# Currently only works with local sdk
load("@litert//third_party/neuro_pilot:workspace.bzl", "neuro_pilot")
neuro_pilot()
# GOOGLE TENSOR ----------------------------------------------------------------------------------
load("@litert//third_party/google_tensor:workspace.bzl", "google_tensor")
google_tensor()
http_archive(
name = "nanobind_json",
build_file = "@//:BUILD.nanobind_json",
patches = ["@//:PATCH.nanobind_json"],
sha256 = "72cb4cdbf8108c7dd2dc669347669f2cc1acf4f943588f96661701f27f778912",
strip_prefix = "nanobind_json-e1953530697f61cbca9dc9b4f51561ea785cb09d",
urls = ["https://github.com/ianhbell/nanobind_json/archive/e1953530697f61cbca9dc9b4f51561ea785cb09d.zip"],
)
load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse(
name = "custom_pip_deps",
requirements_lock = "//:requirements.txt",
)
load("@custom_pip_deps//:requirements.bzl", install_custom_deps = "install_deps")
install_custom_deps()