From 58749898bd0540e76fc360b4a6572d8f86f1c770 Mon Sep 17 00:00:00 2001 From: mikemikimike <186855910+mikemikimike@users.noreply.github.com> Date: Thu, 1 Oct 2026 20:49:08 +0800 Subject: [PATCH 1/2] fix: avoid scanning cwd for default lora cache --- examples/common/common.h | 2 +- examples/server/runtime.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/common/common.h b/examples/common/common.h index d0d39b738..223d77487 100644 --- a/examples/common/common.h +++ b/examples/common/common.h @@ -144,7 +144,7 @@ struct SDContextParams { std::string pulid_weights_path; sd_type_t wtype = SD_TYPE_COUNT; std::string tensor_type_rules; - std::string lora_model_dir = "."; + std::string lora_model_dir; std::string hires_upscalers_dir; std::map embedding_map; diff --git a/examples/server/runtime.cpp b/examples/server/runtime.cpp index 3a209313a..1a71cf76f 100644 --- a/examples/server/runtime.cpp +++ b/examples/server/runtime.cpp @@ -254,6 +254,12 @@ std::string SDSvrParams::to_string() const { void refresh_lora_cache(ServerRuntime& rt) { std::vector new_cache; + if (rt.ctx_params->lora_model_dir.empty()) { + std::lock_guard lock(*rt.lora_mutex); + rt.lora_cache->clear(); + return; + } + fs::path lora_dir = rt.ctx_params->lora_model_dir; std::error_code ec; if (fs::exists(lora_dir, ec) && !ec && fs::is_directory(lora_dir, ec) && !ec) { From 92ddaafebcc77eb760dc0227de15e08f7b8c2192 Mon Sep 17 00:00:00 2001 From: mikemikimike <186855910+mikemikimike@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:40:21 +0800 Subject: [PATCH 2/2] fix: preserve CLI LoRA directory default --- examples/common/common.h | 2 +- examples/server/main.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/common/common.h b/examples/common/common.h index 223d77487..d0d39b738 100644 --- a/examples/common/common.h +++ b/examples/common/common.h @@ -144,7 +144,7 @@ struct SDContextParams { std::string pulid_weights_path; sd_type_t wtype = SD_TYPE_COUNT; std::string tensor_type_rules; - std::string lora_model_dir; + std::string lora_model_dir = "."; std::string hires_upscalers_dir; std::map embedding_map; diff --git a/examples/server/main.cpp b/examples/server/main.cpp index 42c84df6a..1768f0de7 100644 --- a/examples/server/main.cpp +++ b/examples/server/main.cpp @@ -75,6 +75,8 @@ int main(int argc, const char** argv) { } SDSvrParams svr_params; SDContextParams ctx_params; + // Preserve the CLI default while disabling cwd scans for sd-server. + ctx_params.lora_model_dir.clear(); SDGenerationParams default_gen_params; sd_set_log_callback(sd_log_cb, (void*)&svr_params);