Skip to content

Commit a11bbb4

Browse files
committed
Fix examples + halde nccl not found
1 parent 717e17e commit a11bbb4

File tree

5 files changed

+16
-27
lines changed

5 files changed

+16
-27
lines changed

cpp/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ list(APPEND CMAKE_PREFIX_PATH ${TORCH_CMAKE_PREFIX_PATH})
4040

4141
find_package(Boost REQUIRED)
4242
find_package(Torch REQUIRED)
43+
4344
find_library(NCCL_LIBRARY nccl HINTS ${NCCL_PATH})
45+
if("${NCCL_LIBRARY}" STREQUAL "NOTFOUND")
46+
set(NCCL_LIBRARY "")
47+
endif()
4448

4549
include(FetchContent)
4650

cpp/src/utils/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ else()
4747
target_link_libraries(ts_utils ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} yaml-cpp nlohmann_json fmt)
4848
endif()
4949

50-
install(TARGETS ts_utils DESTINATION ${torchserve_cpp_SOURCE_DIR}/_build/libs)
50+
install(TARGETS ts_utils DESTINATION ${CMAKE_INSTALL_PREFIX}/libs)
5151

5252
list(APPEND FOO_SOURCE_FILES ${TS_UTILS_SRC_DIR}/ifoo.hh)
5353
list(APPEND FOO_SOURCE_FILES ${TS_UTILS_SRC_DIR}/foo.hh)

examples/cpp/aot_inductor/bert/README.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@ Then, this example loads model and runs prediction using libtorch. The handler C
77
### Setup
88
1. Follow the instructions in [README.md](../../../../cpp/README.md) to build the TorchServe C++ backend.
99

10-
```
11-
cd serve/cpp
12-
./builld.sh
13-
```
14-
15-
The build script will create the necessary artifact for this example.
16-
To recreate these by hand you can follow the prepare_test_files function of the [build.sh](../../../../cpp/build.sh) script.
10+
The build process will create the necessary artifact for this example.
11+
To recreate these by hand you can follow the the [CMakeLists.txt](./CMakeLists.txt) file.
1712
We will need the handler .so file as well as the bert-seq.so and tokenizer.json.
1813

1914
2. Create a [model-config.yaml](model-config.yaml)
@@ -37,7 +32,7 @@ handler:
3732
### Generate Model Artifact Folder
3833
3934
```bash
40-
torch-model-archiver --model-name bertcppaot --version 1.0 --handler ../../../../cpp/_build/test/resources/examples/aot_inductor/bert_handler/libbert_handler:BertCppHandler --runtime LSP --extra-files index_to_name.json,../../../../cpp/_build/test/resources/examples/aot_inductor/bert_handler/bert-seq.so,../../../../cpp/_build/test/resources/examples/aot_inductor/bert_handler/tokenizer.json --config-file model-config.yaml --archive-format no-archive
35+
torch-model-archiver --model-name bertcppaot --version 1.0 --handler ../../../../cpp/build/test/resources/examples/aot_inductor/bert_handler/libbert_handler:BertCppHandler --runtime LSP --extra-files index_to_name.json,../../../../cpp/build/test/resources/examples/aot_inductor/bert_handler/bert-seq.so,../../../../cpp/build/test/resources/examples/aot_inductor/bert_handler/tokenizer.json --config-file model-config.yaml --archive-format no-archive
4136
```
4237

4338
Create model store directory and move the folder `bertcppaot`

examples/cpp/aot_inductor/llama2/README.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,24 @@ The handler C++ source code for this examples can be found [here](src/).
55
### Setup
66
1. Follow the instructions in [README.md](../../../../cpp/README.md) to build the TorchServe C++ backend.
77

8-
```
9-
cd serve/cpp
10-
./builld.sh
11-
```
12-
13-
The build script will already create the necessary artifact for this example.
14-
To recreate these by hand you can follow the prepare_test_files function of the [build.sh](../../../../cpp/build.sh) script.
8+
The build process will create the necessary artifact for this example.
9+
To recreate these by hand you can follow the the [CMakeLists.txt](./CMakeLists.txt) file.
1510
We will need the handler .so file as well as the stories15M.so file containing the model and weights.
1611

1712
2. Copy the handler file
1813

1914
```bash
2015
cd ~/serve/examples/cpp/aot_inductor/llama2
21-
cp ../../../../cpp/_build/test/resources/examples/aot_inductor/llama_handler/libllama_so_handler.so ./
16+
cp ../../../../cpp/build/test/resources/examples/aot_inductor/llama_handler/libllama_so_handler.so ./
2217
```
2318
We will leave the model .so file in place and just use its absolute path in the next step.
2419

2520
4. Create a [config.json](config.json) with the path of the downloaded model and tokenizer:
2621

2722
```bash
2823
echo '{
29-
"checkpoint_path" : "/home/ubuntu/serve/cpp/_build/test/resources/examples/aot_inductor/llama_handler/stories15M.so",
30-
"tokenizer_path" : "/home/ubuntu/serve/cpp/_build/test/resources/examples/babyllama/babyllama_handler/tokenizer.bin"
24+
"checkpoint_path" : "/home/ubuntu/serve/cpp/build/test/resources/examples/aot_inductor/llama_handler/stories15M.so",
25+
"tokenizer_path" : "/home/ubuntu/serve/cpp/build/test/resources/examples/babyllama/babyllama_handler/tokenizer.bin"
3126
}' > config.json
3227
```
3328

examples/cpp/aot_inductor/resnet/README.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,8 @@ The handler C++ source code for this examples can be found [here](src).
66
### Setup
77
1. Follow the instructions in [README.md](../../../../cpp/README.md) to build the TorchServe C++ backend.
88

9-
```
10-
cd serve/cpp
11-
./builld.sh
12-
```
13-
14-
The build script will create the necessary artifact for this example.
15-
To recreate these by hand you can follow the prepare_test_files function of the [build.sh](../../../../cpp/build.sh) script.
9+
The build process will create the necessary artifact for this example.
10+
To recreate these by hand you can follow the the [CMakeLists.txt](./CMakeLists.txt) file.
1611
We will need the handler .so file as well as the resnet50_pt2.so file containing the model and weights.
1712

1813
2. Create a [model-config.yaml](model-config.yaml)
@@ -30,7 +25,7 @@ handler:
3025
### Generate Model Artifacts Folder
3126
3227
```bash
33-
torch-model-archiver --model-name resnetcppaot --version 1.0 --handler ../../../../cpp/_build/test/resources/examples/aot_inductor/resnet_handler/libresnet_handler:ResnetCppHandler --runtime LSP --extra-files index_to_name.json,../../../../cpp/_build/test/resources/examples/aot_inductor/resnet_handler/resnet50_pt2.so --config-file model-config.yaml --archive-format no-archive
28+
torch-model-archiver --model-name resnetcppaot --version 1.0 --handler ../../../../cpp/build/test/resources/examples/aot_inductor/resnet_handler/libresnet_handler:ResnetCppHandler --runtime LSP --extra-files index_to_name.json,../../../../cpp/build/test/resources/examples/aot_inductor/resnet_handler/resnet50_pt2.so --config-file model-config.yaml --archive-format no-archive
3429
```
3530

3631
Create model store directory and move the folder `resnetcppaot`

0 commit comments

Comments
 (0)