File tree 17 files changed +53
-77
lines changed
backends/qualcomm/scripts
shim_et/xplat/executorch/build
17 files changed +53
-77
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,10 @@ install_executorch_and_backend_lib() {
42
42
43
43
build_llama_runner () {
44
44
echo " Building llama runner for Android..."
45
+ pushd extension/llm/tokenizers
46
+ echo " Updating tokenizers submodule"
47
+ git submodule update --init
48
+ popd
45
49
ANDROID_ABI=arm64-v8a
46
50
cmake -DBUCK2=" ${BUCK2} " \
47
51
-DCMAKE_TOOLCHAIN_FILE=" $ANDROID_NDK " /build/cmake/android.toolchain.cmake \
Original file line number Diff line number Diff line change 17
17
18
18
which " ${PYTHON_EXECUTABLE} "
19
19
20
+ # Update tokenizers submodule
21
+ pushd $EXECUTORCH_ROOT /extension/llm/tokenizers
22
+ echo " Update tokenizers submodule"
23
+ git submodule update --init
24
+ popd
25
+
20
26
pushd $EXECUTORCH_ROOT /examples/apple/coreml/llama
21
27
22
28
# Download stories llama110m artifacts
Original file line number Diff line number Diff line change @@ -173,6 +173,10 @@ cmake_install_executorch_libraries() {
173
173
174
174
cmake_build_llama_runner () {
175
175
echo " Building llama runner"
176
+ pushd extension/llm/tokenizers
177
+ echo " Updating tokenizers submodule"
178
+ git submodule update --init
179
+ popd
176
180
dir=" examples/models/llama"
177
181
retry cmake \
178
182
-DCMAKE_INSTALL_PREFIX=cmake-out \
Original file line number Diff line number Diff line change 28
28
[submodule "backends/xnnpack/third-party/pthreadpool "]
29
29
path = backends/xnnpack/third-party/pthreadpool
30
30
url = https://github.com/Maratyszcza/pthreadpool.git
31
- [submodule "extension/llm/third-party/abseil-cpp "]
32
- path = extension/llm/third-party/abseil-cpp
33
- url = https://github.com/abseil/abseil-cpp.git
34
- [submodule "extension/llm/third-party/re2 "]
35
- path = extension/llm/third-party/re2
36
- url = https://github.com/google/re2.git
37
- [submodule "extension/llm/third-party/sentencepiece "]
38
- path = extension/llm/third-party/sentencepiece
39
- url = https://github.com/google/sentencepiece.git
31
+ [submodule "extension/llm/tokenizers "]
32
+ path = extension/llm/tokenizers
33
+ url = https://github.com/pytorch-labs/tokenizers.git
40
34
[submodule "kernels/optimized/third-party/eigen "]
41
35
path = kernels/optimized/third-party/eigen
42
36
url = https://gitlab.com/libeigen/eigen.git
Original file line number Diff line number Diff line change @@ -144,6 +144,10 @@ if [ "$BUILD_X86_64" = true ]; then
144
144
EXAMPLE_ROOT=examples/qualcomm
145
145
CMAKE_PREFIX_PATH=" ${BUILD_ROOT} /lib/cmake/ExecuTorch;${BUILD_ROOT} /third-party/gflags;"
146
146
147
+ echo " Update tokenizers submodule..."
148
+ pushd $PRJ_ROOT /extension/llm/tokenizers
149
+ git submodule update --init
150
+ popd
147
151
cmake $PRJ_ROOT /$EXAMPLE_ROOT \
148
152
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
149
153
-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \
Original file line number Diff line number Diff line change @@ -70,6 +70,11 @@ build_android_native_library() {
70
70
fi
71
71
cmake --build " ${CMAKE_OUT} " -j " ${CMAKE_JOBS} " --target install --config " ${EXECUTORCH_CMAKE_BUILD_TYPE} "
72
72
73
+ # Update tokenizers submodule
74
+ pushd extension/llm/tokenizers
75
+ echo " Update tokenizers submodule"
76
+ git submodule update --init
77
+ popd
73
78
cmake extension/android \
74
79
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK} /build/cmake/android.toolchain.cmake \
75
80
-DANDROID_ABI=" ${ANDROID_ABI} " \
Original file line number Diff line number Diff line change @@ -122,17 +122,17 @@ if(${ANDROID})
122
122
)
123
123
# Build ABSL and RE2
124
124
set (EXTENSIONS_LLM_DIR ${CMAKE_CURRENT_SOURCE_DIR} /../../extension/llm)
125
- set (THIRD_PARTY_ABSL_DIR ${EXTENSIONS_LLM_DIR} /third-party/abseil-cpp)
126
- set (THIRD_PARTY_RE2_DIR ${EXTENSIONS_LLM_DIR} /third-party/re2)
125
+ set (THIRD_PARTY_ABSL_DIR ${EXTENSIONS_LLM_DIR} /tokenizers/ third-party/abseil-cpp)
126
+ set (THIRD_PARTY_RE2_DIR ${EXTENSIONS_LLM_DIR} /tokenizers/ third-party/re2)
127
127
set (ABSL_ENABLE_INSTALL ON )
128
128
set (ABSL_PROPAGATE_CXX_STD ON )
129
129
set (_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE} )
130
130
set (CMAKE_POSITION_INDEPENDENT_CODE ON )
131
131
add_subdirectory (
132
- ${THIRD_PARTY_ABSL_DIR} ${CMAKE_CURRENT_BINARY_DIR} /third-party/abseil
132
+ ${THIRD_PARTY_ABSL_DIR} ${CMAKE_CURRENT_BINARY_DIR} /tokenizers/ third-party/abseil
133
133
)
134
134
add_subdirectory (
135
- ${THIRD_PARTY_RE2_DIR} ${CMAKE_CURRENT_BINARY_DIR} /third-party/re2
135
+ ${THIRD_PARTY_RE2_DIR} ${CMAKE_CURRENT_BINARY_DIR} /tokenizers/ third-party/re2
136
136
)
137
137
set (CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag} )
138
138
Original file line number Diff line number Diff line change @@ -66,11 +66,11 @@ set(ABSL_PROPAGATE_CXX_STD ON)
66
66
set (_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE} )
67
67
set (CMAKE_POSITION_INDEPENDENT_CODE ON )
68
68
add_subdirectory (
69
- ${EXECUTORCH_ROOT} /extension/llm/third-party/abseil-cpp
69
+ ${EXECUTORCH_ROOT} /extension/llm/tokenizers/ third-party/abseil-cpp
70
70
${CMAKE_CURRENT_BINARY_DIR} /abseil-cpp
71
71
)
72
72
add_subdirectory (
73
- ${EXECUTORCH_ROOT} /extension/llm/third-party/re2
73
+ ${EXECUTORCH_ROOT} /extension/llm/tokenizers/ third-party/re2
74
74
${CMAKE_CURRENT_BINARY_DIR} /re2
75
75
)
76
76
set (CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag} )
@@ -82,6 +82,8 @@ set(llama_runner_deps executorch extension_data_loader extension_module
82
82
target_link_libraries (llama_runner PUBLIC ${llama_runner_deps} )
83
83
84
84
target_include_directories (
85
- llama_runner INTERFACE ${_common_include_directories} ${EXECUTORCH_ROOT}
85
+ llama_runner
86
+ INTERFACE ${_common_include_directories} ${EXECUTORCH_ROOT}
87
+ ${EXECUTORCH_ROOT} /extension/llm/tokenizers/include
86
88
)
87
89
target_compile_options (llama_runner PUBLIC ${_preprocessor_flag} )
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ include(${EXECUTORCH_ROOT}/build/Test.cmake)
19
19
20
20
set (_tokenizer_test_srcs
21
21
test_tiktoken.cpp
22
- ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/tokenizer /tiktoken.cpp
22
+ ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/tokenizers/src /tiktoken.cpp
23
23
${CMAKE_CURRENT_SOURCE_DIR} /../llama_tiktoken.cpp
24
24
)
25
25
@@ -29,11 +29,11 @@ set(ABSL_PROPAGATE_CXX_STD ON)
29
29
set (_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE} )
30
30
set (CMAKE_POSITION_INDEPENDENT_CODE ON )
31
31
add_subdirectory (
32
- ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/third-party/abseil-cpp
32
+ ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/tokenizers/ third-party/abseil-cpp
33
33
${CMAKE_CURRENT_BINARY_DIR} /abseil-cpp
34
34
)
35
35
add_subdirectory (
36
- ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/third-party/re2
36
+ ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/tokenizers/ third-party/re2
37
37
${CMAKE_CURRENT_BINARY_DIR} /re2
38
38
)
39
39
set (CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag} )
@@ -43,5 +43,6 @@ target_include_directories(
43
43
tokenizer_test
44
44
PRIVATE
45
45
${CMAKE_INSTALL_PREFIX} /include
46
- ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/third-party/abseil-cpp
46
+ ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/tokenizers/include
47
+ ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/tokenizers/third-party/abseil-cpp
47
48
)
Original file line number Diff line number Diff line change @@ -63,7 +63,10 @@ target_compile_options(
63
63
full_portable_ops_lib INTERFACE -DET_EVENT_TRACER_ENABLED
64
64
)
65
65
target_include_directories (
66
- full_portable_ops_lib PUBLIC ${_common_include_directories}
66
+ full_portable_ops_lib
67
+ PUBLIC
68
+ ${_common_include_directories}
69
+ ${CMAKE_CURRENT_SOURCE_DIR} /../../extension/llm/tokenizers/include
67
70
)
68
71
69
72
# find RE2 for tokenizer
@@ -72,11 +75,11 @@ set(ABSL_PROPAGATE_CXX_STD ON)
72
75
set (_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE} )
73
76
set (CMAKE_POSITION_INDEPENDENT_CODE ON )
74
77
add_subdirectory (
75
- ${CMAKE_CURRENT_SOURCE_DIR} /../../extension/llm/third-party/abseil-cpp
78
+ ${CMAKE_CURRENT_SOURCE_DIR} /../../extension/llm/tokenizers/ third-party/abseil-cpp
76
79
${CMAKE_CURRENT_BINARY_DIR} /abseil-cpp
77
80
)
78
81
add_subdirectory (
79
- ${CMAKE_CURRENT_SOURCE_DIR} /../../extension/llm/third-party/re2
82
+ ${CMAKE_CURRENT_SOURCE_DIR} /../../extension/llm/tokenizers/ third-party/re2
80
83
${CMAKE_CURRENT_BINARY_DIR} /re2
81
84
)
82
85
set (CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag} )
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ set(ABSL_PROPAGATE_CXX_STD ON)
21
21
set (_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE} )
22
22
set (CMAKE_POSITION_INDEPENDENT_CODE ON )
23
23
add_subdirectory (
24
- ${CMAKE_CURRENT_SOURCE_DIR} /../third-party/abseil-cpp
24
+ ${CMAKE_CURRENT_SOURCE_DIR} /../tokenizers/ third-party/abseil-cpp
25
25
${CMAKE_CURRENT_BINARY_DIR} /abseil-cpp
26
26
)
27
27
add_subdirectory (
28
- ${CMAKE_CURRENT_SOURCE_DIR} /../third-party/re2
28
+ ${CMAKE_CURRENT_SOURCE_DIR} /../tokenizers/ third-party/re2
29
29
${CMAKE_CURRENT_BINARY_DIR} /re2
30
30
)
31
31
set (CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag} )
@@ -35,6 +35,7 @@ add_library(extension_llm_tokenizer ${_extension_llm_tokenizer__srcs})
35
35
target_include_directories (
36
36
extension_llm_tokenizer PUBLIC ${EXECUTORCH_ROOT} /..
37
37
${_common_include_directories}
38
+ ${CMAKE_CURRENT_SOURCE_DIR} /../tokenizers/include
38
39
)
39
40
40
41
target_link_libraries (extension_llm_tokenizer re2::re2)
@@ -53,7 +54,7 @@ install(
53
54
target_include_directories (
54
55
extension_llm_tokenizer
55
56
PRIVATE ${CMAKE_INSTALL_PREFIX} /include
56
- ${CMAKE_CURRENT_SOURCE_DIR} /../third-party/abseil-cpp
57
+ ${CMAKE_CURRENT_SOURCE_DIR} /../tokenizers/ third-party/abseil-cpp
57
58
)
58
59
59
60
if (BUILD_TESTING)
Original file line number Diff line number Diff line change @@ -43,9 +43,10 @@ _EXTERNAL_DEPS = {
43
43
"nlohmann_json" : [], # Intentionally not supporting OSS buck build HF tokenizer.
44
44
"prettytable" : "//third-party:prettytable" ,
45
45
"pybind11" : "//third-party:pybind11" ,
46
- "re2" : "//extension/llm/third-party:re2" ,
46
+ "re2" : "//extension/llm/tokenizers/ third-party:re2" ,
47
47
"sentencepiece" : [], # Intentionally not supporting OSS buck build of sentencepiece.
48
48
"sentencepiece-py" : [],
49
+ "tiktoken" : "//extension/llm/tokenizers:tiktoken" ,
49
50
# Core C++ PyTorch functionality like Tensor and ScalarType.
50
51
"torch-core-cpp" : "//third-party:libtorch" ,
51
52
"torchgen" : "//third-party:torchgen" ,
You can’t perform that action at this time.
0 commit comments