Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/mediatek/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,10 @@ if(${ANDROID})
_mtk_llama_executor_runner__srcs
${CMAKE_CURRENT_LIST_DIR}/executor_runner/mtk_llama_executor_runner.cpp
)

# Build ABSL and RE2
set(LLAMA2_EXAMPLE_MODEL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../examples/models/llama2)
set(THIRD_PARTY_ABSL_DIR ${LLAMA2_EXAMPLE_MODEL_DIR}/third-party/abseil-cpp)
set(THIRD_PARTY_RE2_DIR ${LLAMA2_EXAMPLE_MODEL_DIR}/third-party/re2)
set(EXTENSIONS_LLM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../extension/llm)
set(THIRD_PARTY_ABSL_DIR ${EXTENSIONS_LLM_DIR}/third-party/abseil-cpp)
set(THIRD_PARTY_RE2_DIR ${EXTENSIONS_LLM_DIR}/third-party/re2)
set(ABSL_ENABLE_INSTALL ON)
set(ABSL_PROPAGATE_CXX_STD ON)
set(_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE})
Expand All @@ -119,7 +118,7 @@ if(${ANDROID})
set(CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag})

# Build tokenizers
set(LLAMA2_TOKENIZER_DIR ${LLAMA2_EXAMPLE_MODEL_DIR}/tokenizer)
set(LLAMA2_TOKENIZER_DIR ${EXTENSIONS_LLM_DIR}/tokenizer)
add_library(tokenizer STATIC)
target_include_directories(tokenizer
PUBLIC
Expand All @@ -135,6 +134,7 @@ if(${ANDROID})
PRIVATE
${LLAMA2_TOKENIZER_DIR}/tiktoken.cpp
${LLAMA2_TOKENIZER_DIR}/bpe_tokenizer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../models/llama2/tokenizer/llama_tiktoken.cpp
)

# Include directory for neuron headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@
#include "llama_runner/Utils.h"
#include "llama_runner/llm_helper/include/llm_types.h"

#include <executorch/examples/models/llama2/tokenizer/bpe_tokenizer.h>
#include <executorch/examples/models/llama2/tokenizer/tiktoken.h>
#include <executorch/examples/models/llama2/tokenizer/llama_tiktoken.h>
#include <executorch/extension/llm/tokenizer/bpe_tokenizer.h>
#include <executorch/extension/llm/tokenizer/tiktoken.h>

// Llama model options
DEFINE_uint64(
Expand Down Expand Up @@ -316,7 +317,7 @@ std::unique_ptr<Tokenizer> load_tokenizer() {
if (FLAGS_tokenizer_type == "bpe") {
tokenizer = std::make_unique<torch::executor::BPETokenizer>();
} else if (FLAGS_tokenizer_type == "tiktoken") {
tokenizer = std::make_unique<torch::executor::Tiktoken>();
tokenizer = torch::executor::get_tiktoken_for_llama();
}
ET_CHECK_MSG(
tokenizer, "Invalid tokenizer type: %s", FLAGS_tokenizer_type.c_str());
Expand Down