Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 005e268

Browse files
authored
fix: handle more parameters (#2199)
* fix: handle more parameters * fix: generate version.txt if not exist * fix: only add path if exists
1 parent b901e01 commit 005e268

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

engine/extensions/local-engine/local_engine.cc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const std::unordered_set<std::string> kIgnoredParams = {
2020
"user_prompt", "min_keep", "mirostat", "mirostat_eta",
2121
"mirostat_tau", "text_model", "version", "n_probs",
2222
"object", "penalize_nl", "precision", "size",
23-
"stop", "tfs_z", "typ_p"};
23+
"stop", "tfs_z", "typ_p", "caching_enabled"};
2424

2525
const std::unordered_map<std::string, std::string> kParamsMap = {
2626
{"cpu_threads", "--threads"},
@@ -67,6 +67,19 @@ std::vector<std::string> ConvertJsonToParamsVector(const Json::Value& root) {
6767
res.push_back("--embedding");
6868
}
6969
continue;
70+
} else if (member == "cache_type") {
71+
if (!root[member].isNull()) {
72+
res.push_back("-ctk");
73+
res.push_back(root[member].asString());
74+
res.push_back("-ctv");
75+
res.push_back(root[member].asString());
76+
}
77+
continue;
78+
} else if (member == "use_mmap") {
79+
if (!root[member].asBool()) {
80+
res.push_back("--no-mmap");
81+
}
82+
continue;
7083
}
7184

7285
res.push_back("--" + member);

engine/services/engine_service.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,13 @@ EngineService::GetInstalledEngineVariants(const std::string& engine) const {
772772
// try to find version.txt
773773
auto version_txt_path = version_entry.path() / "version.txt";
774774
if (!std::filesystem::exists(version_txt_path)) {
775-
continue;
775+
// create new one
776+
std::ofstream meta(version_txt_path, std::ios::out);
777+
meta << "name: " << entry.path().filename() << std::endl;
778+
meta << "version: " << version_entry.path().filename() << std::endl;
779+
meta.close();
780+
CTL_INF("name: " << entry.path().filename().string() << ", version: "
781+
<< version_entry.path().filename().string());
776782
}
777783

778784
try {
@@ -865,7 +871,9 @@ void EngineService::RegisterEngineLibPath() {
865871

866872
// register deps
867873
std::vector<std::filesystem::path> paths{};
868-
paths.push_back(cuda_path);
874+
if (std::filesystem::exists(cuda_path)) {
875+
paths.push_back(cuda_path);
876+
}
869877
paths.push_back(engine_dir_path);
870878

871879
CTL_DBG("Registering dylib for "

0 commit comments

Comments
 (0)