-
Notifications
You must be signed in to change notification settings - Fork 871
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move file prep from build.sh to cmake (#3014)
* Move file prep from build.sh to cmake * Remove make format call from build.sh
- Loading branch information
Showing
7 changed files
with
58 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
|
||
add_custom_command( | ||
OUTPUT bert-seq.so | ||
COMMAND TOKENIZERS_PARALLELISM=false python ${CMAKE_CURRENT_SOURCE_DIR}/aot_compile_export.py | ||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/Transformer_model/tokenizer.json ${CMAKE_CURRENT_BINARY_DIR}/ | ||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/aot_compile_export.py | ||
) | ||
|
||
set(TOKENZIER_CPP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cpp/third-party/tokenizers-cpp) | ||
add_subdirectory(${TOKENZIER_CPP_PATH} tokenizers EXCLUDE_FROM_ALL) | ||
add_library(bert_handler SHARED src/bert_handler.cc) | ||
add_library(bert_handler SHARED src/bert_handler.cc bert-seq.so) | ||
target_include_directories(bert_handler PRIVATE ${TOKENZIER_CPP_PATH}/include) | ||
target_link_libraries(bert_handler PRIVATE ts_backends_core ts_utils ${TORCH_LIBRARIES} tokenizers_cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
|
||
FetchContent_Declare( | ||
stories15M_pt | ||
URL https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.pt?download=true | ||
DOWNLOAD_NO_EXTRACT TRUE | ||
DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/ | ||
) | ||
|
||
FetchContent_MakeAvailable(stories15M_pt) | ||
|
||
|
||
add_custom_command( | ||
OUTPUT stories15M.so | ||
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 | ||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/compile.py | ||
) | ||
|
||
|
||
add_library(llama2_so STATIC ../../../../cpp/third-party/llama2.so/run.cpp) | ||
target_compile_options(llama2_so PRIVATE -Wall -Wextra -Ofast -fpermissive) | ||
|
||
add_library(llama_so_handler SHARED src/llama_handler.cc) | ||
add_library(llama_so_handler SHARED src/llama_handler.cc stories15M.so) | ||
target_link_libraries(llama_so_handler PRIVATE llama2_so ts_backends_core ts_utils ${TORCH_LIBRARIES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
add_library(resnet_handler SHARED src/resnet_handler.cc) | ||
|
||
add_custom_command( | ||
OUTPUT resnet50_pt2.so | ||
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/resnet50_torch_export.py | ||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/resnet50_torch_export.py | ||
) | ||
|
||
add_library(resnet_handler SHARED src/resnet_handler.cc resnet50_pt2.so) | ||
target_link_libraries(resnet_handler PRIVATE ts_backends_core ts_utils ${TORCH_LIBRARIES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters