Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/server/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions examples/server/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ std::string SDSvrParams::to_string() const {
void refresh_lora_cache(ServerRuntime& rt) {
std::vector<LoraEntry> new_cache;

if (rt.ctx_params->lora_model_dir.empty()) {
std::lock_guard<std::mutex> 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) {
Expand Down
Loading