Skip to content

Commit

Permalink
server : fix initialization thread issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Feb 21, 2024
1 parent 2a37bd6 commit f1d4138
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2719,19 +2719,6 @@ int main(int argc, char **argv)
log_data["api_key"] = "api_key: " + std::to_string(sparams.api_keys.size()) + " keys loaded";
}

LOG_INFO("HTTP server listening", log_data);
// run the HTTP server in a thread - see comment below
std::thread t([&]()
{
if (!svr.listen_after_bind())
{
state.store(SERVER_STATE_ERROR);
return 1;
}

return 0;
});

// load the model
if (!llama.load_model(params))
{
Expand Down Expand Up @@ -3194,6 +3181,19 @@ int main(int argc, char **argv)
}*/
//);

LOG_INFO("HTTP server listening", log_data);
// run the HTTP server in a thread - see comment below
std::thread t([&]()
{
if (!svr.listen_after_bind())
{
state.store(SERVER_STATE_ERROR);
return 1;
}

return 0;
});

llama.queue_tasks.on_new_task(std::bind(
&llama_server_context::process_single_task, &llama, std::placeholders::_1));
llama.queue_tasks.on_finish_multitask(std::bind(
Expand Down
2 changes: 1 addition & 1 deletion examples/server/tests/features/server.feature
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Feature: llama.cpp server
Then all prompts are predicted

# FIXME: #3969 infinite loop on the CI, not locally, if n_prompt * n_predict > kv_size
@bug
@llama.cpp
Scenario: Multi users with total number of tokens to predict exceeds the KV Cache size
Given a prompt:
"""
Expand Down

0 comments on commit f1d4138

Please sign in to comment.