Skip to content

Commit 8d25288

Browse files
digantdesaifacebook-github-bot
authored andcommitted
Buck build - fix use_tiktoken config
Summary: Make it work bypass-github-export-checks Reviewed By: larryliu0820 Differential Revision: D56287998 fbshipit-source-id: 02b92c8110f7ea72055edd4c194858cc71b49093
1 parent ab02a9c commit 8d25288

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

examples/models/llama2/runner/runner.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
// The module takes in a string as input and emits a string as output.
1111

1212
#include <executorch/examples/models/llama2/runner/runner.h>
13-
#include <executorch/examples/models/llama2/tokenizer/bpe_tokenizer.h>
1413
#if defined(ET_USE_TIKTOKEN)
1514
#include <executorch/examples/models/llama2/tokenizer/tiktoken.h>
16-
#endif
15+
#else /* BPE */
16+
#include <executorch/examples/models/llama2/tokenizer/bpe_tokenizer.h>
17+
#endif /* ET_USE_TIKTOKEN*/
1718
#include <executorch/extension/evalue_util/print_evalue.h>
1819
#include <executorch/extension/runner_util/managed_tensor.h>
1920

examples/models/llama2/runner/targets.bzl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ def _get_operator_lib(aten = False):
88
else:
99
return ["//executorch/configurations:optimized_native_cpu_ops", "//executorch/examples/models/llama2/custom_ops:custom_ops"]
1010

11+
def use_tiktoken():
12+
return native.read_config("llama", "use_tiktoken", "0") == "1"
13+
1114
def define_common_targets():
1215
for aten in (True, False):
1316
aten_suffix = "_aten" if aten else ""
@@ -24,6 +27,7 @@ def define_common_targets():
2427
preprocessor_flags = [
2528
"-DUSE_ATEN_LIB",
2629
] if aten else [],
30+
exported_preprocessor_flags = ["-DET_USE_TIKTOKEN"] if use_tiktoken() else [],
2731
visibility = [
2832
"@EXECUTORCH_CLIENTS",
2933
],
@@ -38,7 +42,7 @@ def define_common_targets():
3842
"//executorch/runtime/core/exec_aten/util:tensor_util" + aten_suffix,
3943
] + ([
4044
"//executorch/examples/models/llama2/tokenizer:tiktoken",
41-
] if native.read_config("llama", "use_tiktoken", "0") == "1" else [
45+
] if use_tiktoken() else [
4246
"//executorch/examples/models/llama2/tokenizer:bpe_tokenizer",
4347
]) + (_get_operator_lib(aten)) + ([
4448
# Vulkan API currently cannot build on some platforms (e.g. Apple, FBCODE)

0 commit comments

Comments
 (0)