Skip to content

Commit 9f2cbe3

Browse files
committed
Convert llama2.c submodule into fetch_content
1 parent 749d758 commit 9f2cbe3

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "third_party/google/rpc"]
22
path = third_party/google/rpc
33
url = https://github.com/googleapis/googleapis.git
4-
[submodule "cpp/third-party/llama2.c"]
5-
path = cpp/third-party/llama2.c
6-
url = https://github.com/karpathy/llama2.c

cpp/third-party/llama2.c

-1
This file was deleted.

examples/cpp/aot_inductor/bert/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ add_custom_command(
1414
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/aot_compile_export.py
1515
)
1616

17-
# set(TOKENZIER_CPP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cpp/third-party/tokenizers-cpp)
18-
# add_subdirectory(${TOKENZIER_CPP_PATH} tokenizers EXCLUDE_FROM_ALL)
1917
add_library(bert_handler SHARED src/bert_handler.cc bert-seq.so)
2018
target_include_directories(bert_handler PRIVATE)
2119
target_link_libraries(bert_handler PRIVATE ts_backends_core ts_utils ${TORCH_LIBRARIES} tokenizers_cpp)

examples/cpp/aot_inductor/llama2/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ FetchContent_MakeAvailable(stories15M_pt)
2222

2323
add_custom_command(
2424
OUTPUT stories15M.so
25-
COMMAND PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/../../../../cpp/third-party/llama2.so/ python ${CMAKE_CURRENT_SOURCE_DIR}/compile.py --checkpoint ${CMAKE_CURRENT_BINARY_DIR}/\'stories15M.pt?download=true\' ${CMAKE_CURRENT_BINARY_DIR}/stories15M.so
25+
COMMAND PYTHONPATH=${llama2_so_SOURCE_DIR} python ${CMAKE_CURRENT_SOURCE_DIR}/compile.py --checkpoint ${CMAKE_CURRENT_BINARY_DIR}/\'stories15M.pt?download=true\' ${CMAKE_CURRENT_BINARY_DIR}/stories15M.so
2626
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/compile.py
2727
)
2828

examples/cpp/babyllama/CMakeLists.txt

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
include(FetchContent)
1+
2+
FetchContent_Declare(
3+
llama2_c
4+
GIT_REPOSITORY https://github.com/karpathy/llama2.c
5+
GIT_TAG d986206
6+
)
27

38
FetchContent_Declare(
49
stories15M_bin
@@ -14,9 +19,9 @@ FetchContent_Declare(
1419
DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/
1520
)
1621

17-
FetchContent_MakeAvailable(tokenizer_bin stories15M_bin)
22+
FetchContent_MakeAvailable(tokenizer_bin stories15M_bin llama2_c)
1823

19-
add_library(llama2_c STATIC ${CMAKE_CURRENT_SOURCE_DIR}/../../../cpp/third-party/llama2.c/run.c)
24+
add_library(llama2_c STATIC ${llama2_c_SOURCE_DIR}/run.c)
2025
target_compile_options(llama2_c PRIVATE -Wall -Wextra -Ofast -fPIC)
2126

2227
add_library(babyllama_handler SHARED src/baby_llama_handler.cc)

0 commit comments

Comments
 (0)