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

Commit 8bff906

Browse files
authored
Merge pull request #370 from janhq/364-feat-add-mmlock-option-when-load-model
add mlock to load model
2 parents 0aa422d + 1bda704 commit 8bff906

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

controllers/llamaCPP.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ void llamaCPP::chatCompletion(
359359
while (state->instance->single_queue_is_busy) {
360360
LOG_INFO << "Waiting for task to be released status:"
361361
<< state->instance->single_queue_is_busy;
362-
std::this_thread::sleep_for(std::chrono::milliseconds(500)); // Waiting in 500 miliseconds step
362+
std::this_thread::sleep_for(std::chrono::milliseconds(
363+
500)); // Waiting in 500 miliseconds step
363364
}
364365
}
365366
std::string str = "\n\n";
@@ -476,6 +477,9 @@ bool llamaCPP::loadModelImpl(const Json::Value &jsonBody) {
476477

477478
params.grp_attn_w = jsonBody["grp_attn_w"].asInt();
478479
}
480+
if (!jsonBody["mlock"].isNull()) {
481+
params.use_mlock = jsonBody["mlock"].asBool();
482+
}
479483
params.model = jsonBody["llama_model_path"].asString();
480484
params.n_gpu_layers = jsonBody.get("ngl", 100).asInt();
481485
params.n_ctx = jsonBody.get("ctx_len", 2048).asInt();

0 commit comments

Comments
 (0)