Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cpu threads #160

Merged
merged 1 commit into from
Nov 21, 2023
Merged
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
8 changes: 5 additions & 3 deletions controllers/llamaCPP.cc
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ void llamaCPP::loadModel(

gpt_params params;

params.cont_batching = false;
// By default will setting based on number of handlers
int drogon_thread = drogon::app().getThreadNum();
LOG_INFO << "Drogon thread is:" << drogon_thread;
Expand All @@ -351,8 +350,11 @@ void llamaCPP::loadModel(
// Check if n_parallel exists in jsonBody, if not, set to drogon_thread

params.n_parallel = (*jsonBody).get("n_parallel", drogon_thread).asInt();

params.cont_batching = (*jsonBody)["cont_batching"].asBool();
params.n_threads =
(*jsonBody)
.get("cpu_threads", std::thread::hardware_concurrency())
.asInt();
params.cont_batching = (*jsonBody).get("cont_batching", false).asBool();

this->user_prompt = (*jsonBody).get("user_prompt", "USER: ").asString();
this->ai_prompt = (*jsonBody).get("ai_prompt", "ASSISTANT: ").asString();
Expand Down
Loading