From 047f171eacae73f6008e88a9ca2eaf399f492ac0 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Tue, 22 Oct 2024 11:34:44 +0700 Subject: [PATCH] fix: use engine get env --- engine/cli/commands/server_start_cmd.cc | 6 +++--- engine/services/inference_service.cc | 1 + engine/utils/file_manager_utils.h | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/engine/cli/commands/server_start_cmd.cc b/engine/cli/commands/server_start_cmd.cc index b455f93c3..cd06a3ba3 100644 --- a/engine/cli/commands/server_start_cmd.cc +++ b/engine/cli/commands/server_start_cmd.cc @@ -97,9 +97,9 @@ bool ServerStartCmd::Exec(const std::string& host, int port) { v += g; } CTL_INF("LD_LIBRARY_PATH: " << v); - auto data_path = file_manager_utils::GetCortexDataPath(); - auto llamacpp_path = data_path / "engines" / "cortex.llamacpp/"; - auto trt_path = data_path / "engines" / "cortex.tensorrt-llm/"; + auto data_path = file_manager_utils::GetEnginesContainerPath(); + auto llamacpp_path = data_path / "cortex.llamacpp/"; + auto trt_path = data_path / "cortex.tensorrt-llm/"; auto new_v = trt_path.string() + ":" + llamacpp_path.string() + ":" + v; setenv(name, new_v.c_str(), true); CTL_INF("LD_LIBRARY_PATH: " << getenv(name)); diff --git a/engine/services/inference_service.cc b/engine/services/inference_service.cc index a8d9a3166..aff72f802 100644 --- a/engine/services/inference_service.cc +++ b/engine/services/inference_service.cc @@ -116,6 +116,7 @@ InferResult InferenceService::LoadModel( ? getenv("ENGINE_PATH") : file_manager_utils::GetCortexDataPath().string()) + get_engine_path(ne); + LOG_INFO << "engine path: " << abs_path; #if defined(_WIN32) // TODO(?) If we only allow to load an engine at a time, the logic is simpler. // We would like to support running multiple engines at the same time. Therefore, diff --git a/engine/utils/file_manager_utils.h b/engine/utils/file_manager_utils.h index 04cb2e8f9..d4b635312 100644 --- a/engine/utils/file_manager_utils.h +++ b/engine/utils/file_manager_utils.h @@ -252,7 +252,9 @@ inline std::filesystem::path GetModelsContainerPath() { } inline std::filesystem::path GetEnginesContainerPath() { - auto cortex_path = GetCortexDataPath(); + auto cortex_path = getenv("ENGINE_PATH") + ? std::filesystem::path(getenv("ENGINE_PATH")) + : GetCortexDataPath(); auto engines_container_path = cortex_path / "engines"; if (!std::filesystem::exists(engines_container_path)) {