File tree Expand file tree Collapse file tree 17 files changed +53
-77
lines changed
backends/qualcomm/scripts
shim_et/xplat/executorch/build Expand file tree Collapse file tree 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() {
4242
4343build_llama_runner () {
4444 echo " Building llama runner for Android..."
45+ pushd extension/llm/tokenizers
46+ echo " Updating tokenizers submodule"
47+ git submodule update --init
48+ popd
4549 ANDROID_ABI=arm64-v8a
4650 cmake -DBUCK2=" ${BUCK2} " \
4751 -DCMAKE_TOOLCHAIN_FILE=" $ANDROID_NDK " /build/cmake/android.toolchain.cmake \
Original file line number Diff line number Diff line change 1717
1818which " ${PYTHON_EXECUTABLE} "
1919
20+ # Update tokenizers submodule
21+ pushd $EXECUTORCH_ROOT /extension/llm/tokenizers
22+ echo " Update tokenizers submodule"
23+ git submodule update --init
24+ popd
25+
2026pushd $EXECUTORCH_ROOT /examples/apple/coreml/llama
2127
2228# Download stories llama110m artifacts
Original file line number Diff line number Diff line change @@ -173,6 +173,10 @@ cmake_install_executorch_libraries() {
173173
174174cmake_build_llama_runner () {
175175 echo " Building llama runner"
176+ pushd extension/llm/tokenizers
177+ echo " Updating tokenizers submodule"
178+ git submodule update --init
179+ popd
176180 dir=" examples/models/llama"
177181 retry cmake \
178182 -DCMAKE_INSTALL_PREFIX=cmake-out \
Original file line number Diff line number Diff line change 2828[submodule "backends/xnnpack/third-party/pthreadpool "]
2929 path = backends/xnnpack/third-party/pthreadpool
3030 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
4034[submodule "kernels/optimized/third-party/eigen "]
4135 path = kernels/optimized/third-party/eigen
4236 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
144144 EXAMPLE_ROOT=examples/qualcomm
145145 CMAKE_PREFIX_PATH=" ${BUILD_ROOT} /lib/cmake/ExecuTorch;${BUILD_ROOT} /third-party/gflags;"
146146
147+ echo " Update tokenizers submodule..."
148+ pushd $PRJ_ROOT /extension/llm/tokenizers
149+ git submodule update --init
150+ popd
147151 cmake $PRJ_ROOT /$EXAMPLE_ROOT \
148152 -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
149153 -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \
Original file line number Diff line number Diff line change @@ -70,6 +70,11 @@ build_android_native_library() {
7070 fi
7171 cmake --build " ${CMAKE_OUT} " -j " ${CMAKE_JOBS} " --target install --config " ${EXECUTORCH_CMAKE_BUILD_TYPE} "
7272
73+ # Update tokenizers submodule
74+ pushd extension/llm/tokenizers
75+ echo " Update tokenizers submodule"
76+ git submodule update --init
77+ popd
7378 cmake extension/android \
7479 -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK} /build/cmake/android.toolchain.cmake \
7580 -DANDROID_ABI=" ${ANDROID_ABI} " \
Original file line number Diff line number Diff line change @@ -122,17 +122,17 @@ if(${ANDROID})
122122 )
123123 # Build ABSL and RE2
124124 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)
127127 set (ABSL_ENABLE_INSTALL ON )
128128 set (ABSL_PROPAGATE_CXX_STD ON )
129129 set (_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE} )
130130 set (CMAKE_POSITION_INDEPENDENT_CODE ON )
131131 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
133133 )
134134 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
136136 )
137137 set (CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag} )
138138
Original file line number Diff line number Diff line change @@ -66,11 +66,11 @@ set(ABSL_PROPAGATE_CXX_STD ON)
6666set (_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE} )
6767set (CMAKE_POSITION_INDEPENDENT_CODE ON )
6868add_subdirectory (
69- ${EXECUTORCH_ROOT} /extension/llm/third-party/abseil-cpp
69+ ${EXECUTORCH_ROOT} /extension/llm/tokenizers/ third-party/abseil-cpp
7070 ${CMAKE_CURRENT_BINARY_DIR} /abseil-cpp
7171)
7272add_subdirectory (
73- ${EXECUTORCH_ROOT} /extension/llm/third-party/re2
73+ ${EXECUTORCH_ROOT} /extension/llm/tokenizers/ third-party/re2
7474 ${CMAKE_CURRENT_BINARY_DIR} /re2
7575)
7676set (CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag} )
@@ -82,6 +82,8 @@ set(llama_runner_deps executorch extension_data_loader extension_module
8282target_link_libraries (llama_runner PUBLIC ${llama_runner_deps} )
8383
8484target_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
8688)
8789target_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)
1919
2020set (_tokenizer_test_srcs
2121 test_tiktoken.cpp
22- ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/tokenizer /tiktoken.cpp
22+ ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/tokenizers/src /tiktoken.cpp
2323 ${CMAKE_CURRENT_SOURCE_DIR} /../llama_tiktoken.cpp
2424)
2525
@@ -29,11 +29,11 @@ set(ABSL_PROPAGATE_CXX_STD ON)
2929set (_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE} )
3030set (CMAKE_POSITION_INDEPENDENT_CODE ON )
3131add_subdirectory (
32- ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/third-party/abseil-cpp
32+ ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/tokenizers/ third-party/abseil-cpp
3333 ${CMAKE_CURRENT_BINARY_DIR} /abseil-cpp
3434)
3535add_subdirectory (
36- ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/third-party/re2
36+ ${CMAKE_CURRENT_SOURCE_DIR} /../../../../../extension/llm/tokenizers/ third-party/re2
3737 ${CMAKE_CURRENT_BINARY_DIR} /re2
3838)
3939set (CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag} )
@@ -43,5 +43,6 @@ target_include_directories(
4343 tokenizer_test
4444 PRIVATE
4545 ${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
4748)
Original file line number Diff line number Diff line change @@ -63,7 +63,10 @@ target_compile_options(
6363 full_portable_ops_lib INTERFACE -DET_EVENT_TRACER_ENABLED
6464)
6565target_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
6770)
6871
6972# find RE2 for tokenizer
@@ -72,11 +75,11 @@ set(ABSL_PROPAGATE_CXX_STD ON)
7275set (_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE} )
7376set (CMAKE_POSITION_INDEPENDENT_CODE ON )
7477add_subdirectory (
75- ${CMAKE_CURRENT_SOURCE_DIR} /../../extension/llm/third-party/abseil-cpp
78+ ${CMAKE_CURRENT_SOURCE_DIR} /../../extension/llm/tokenizers/ third-party/abseil-cpp
7679 ${CMAKE_CURRENT_BINARY_DIR} /abseil-cpp
7780)
7881add_subdirectory (
79- ${CMAKE_CURRENT_SOURCE_DIR} /../../extension/llm/third-party/re2
82+ ${CMAKE_CURRENT_SOURCE_DIR} /../../extension/llm/tokenizers/ third-party/re2
8083 ${CMAKE_CURRENT_BINARY_DIR} /re2
8184)
8285set (CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag} )
You can’t perform that action at this time.
0 commit comments