@@ -373,7 +373,7 @@ option(BUILD_BENCHMARKS "Enable building of the benchmark suite." FALSE)
373373option (BUILD_TPCE "Enable building of the TPC-E tool." FALSE )
374374option (DISABLE_BUILTIN_EXTENSIONS "Disable linking extensions." FALSE )
375375option (ENABLE_PREDICT "Build the ML Operator with DuckDB" FALSE )
376- option (USE_TORCH "Build the ML Operator with DuckDB using the libtorch predictor" FALSE )
376+ option (PREDICTOR_IMPL "Build the ML Operator with DuckDB using specified predictor (torchscript, onnx, llm_api)" "" )
377377option (BUILD_PYTHON "Build the DuckDB Python extension" FALSE )
378378option (USER_SPACE "Build the DuckDB Python in the user space" FALSE )
379379option (FORCE_QUERY_LOG "If enabled, all queries will be logged to the specified path" OFF )
@@ -1214,19 +1214,24 @@ endif()
12141214
12151215if (ENABLE_PREDICT)
12161216 add_definitions (-DENABLE_PREDICT)
1217- if (USE_TORCH )
1217+ if (PREDICTOR_IMPL STREQUAL "torchscript" )
12181218 if (NOT DEFINED ENV{TORCH_INSTALL_PREFIX})
12191219 message ( FATAL_ERROR "TORCH_INSTALL_PREFIX environment variable is not defined with USE_TORCH=1 option, CMake will exit." )
12201220 endif ()
12211221 set (LIBTORCH_PATH "$ENV{TORCH_INSTALL_PREFIX} " )
12221222 set (LIBTORCH_INCLUDE_DIRS "${LIBTORCH_PATH} /include" )
12231223 message (STATUS "Torch Include Libs: ${LIBTORCH_INCLUDE_DIRS} " )
1224- add_definitions (-DUSE_TORCH)
1225- else ()
1224+ add_definitions (-DPREDICTOR_IMPL=1)
1225+ endif ()
1226+ if (PREDICTOR_IMPL STREQUAL "onnx" )
12261227 if (NOT DEFINED ENV{ONNX_INSTALL_PREFIX})
12271228 message ( FATAL_ERROR "ONNX_INSTALL_PREFIX environment variable is not defined with USE_TORCH=0 option, CMake will exit." )
12281229 endif ()
12291230 find_path (ONNX_RUNTIME_SESSION_INCLUDE_DIRS onnxruntime_cxx_api.h HINTS "$ENV{ONNX_INSTALL_PREFIX} /include" )
1231+ add_definitions (-DPREDICTOR_IMPL=2)
1232+ endif ()
1233+ if (PREDICTOR_IMPL STREQUAL "llm_api" )
1234+ add_definitions (-DPREDICTOR_IMPL=3)
12301235 endif ()
12311236endif ()
12321237
0 commit comments