File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
examples/models/llama2/runner Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 10
10
// The module takes in a string as input and emits a string as output.
11
11
12
12
#include < executorch/examples/models/llama2/runner/runner.h>
13
- #include < executorch/examples/models/llama2/tokenizer/bpe_tokenizer.h>
14
13
#if defined(ET_USE_TIKTOKEN)
15
14
#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*/
17
18
#include < executorch/extension/evalue_util/print_evalue.h>
18
19
#include < executorch/extension/runner_util/managed_tensor.h>
19
20
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ def _get_operator_lib(aten = False):
8
8
else :
9
9
return ["//executorch/configurations:optimized_native_cpu_ops" , "//executorch/examples/models/llama2/custom_ops:custom_ops" ]
10
10
11
+ def use_tiktoken ():
12
+ return native .read_config ("llama" , "use_tiktoken" , "0" ) == "1"
13
+
11
14
def define_common_targets ():
12
15
for aten in (True , False ):
13
16
aten_suffix = "_aten" if aten else ""
@@ -24,6 +27,7 @@ def define_common_targets():
24
27
preprocessor_flags = [
25
28
"-DUSE_ATEN_LIB" ,
26
29
] if aten else [],
30
+ exported_preprocessor_flags = ["-DET_USE_TIKTOKEN" ] if use_tiktoken () else [],
27
31
visibility = [
28
32
"@EXECUTORCH_CLIENTS" ,
29
33
],
@@ -38,7 +42,7 @@ def define_common_targets():
38
42
"//executorch/runtime/core/exec_aten/util:tensor_util" + aten_suffix ,
39
43
] + ([
40
44
"//executorch/examples/models/llama2/tokenizer:tiktoken" ,
41
- ] if native . read_config ( "llama" , " use_tiktoken" , "0" ) == "1" else [
45
+ ] if use_tiktoken () else [
42
46
"//executorch/examples/models/llama2/tokenizer:bpe_tokenizer" ,
43
47
]) + (_get_operator_lib (aten )) + ([
44
48
# Vulkan API currently cannot build on some platforms (e.g. Apple, FBCODE)
You can’t perform that action at this time.
0 commit comments