server : do not block system prompt update

This commit is contained in:
Georgi Gerganov 2023-10-24 21:45:11 +03:00
parent abd21fc99f
commit 01be4169bf
No known key found for this signature in database
GPG key ID: 449E073F9DC10735

View file

@ -867,7 +867,7 @@ struct llama_server_context
kv_cache_clear(); kv_cache_clear();
for (int32_t i = 0; i < batch.n_tokens; ++i) for (int i = 0; i < (int) system_tokens.size(); ++i)
{ {
llama_batch_add(batch, system_tokens[i], i, { 0 }, false); llama_batch_add(batch, system_tokens[i], i, { 0 }, false);
} }
@ -897,13 +897,7 @@ struct llama_server_context
wait_all_are_idle(); wait_all_are_idle();
all_slots_are_idle = true; all_slots_are_idle = true;
// wait until system prompt load
system_need_update = true; system_need_update = true;
while (system_need_update)
{
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
// system prompt loaded, continue
} }
void process_system_prompt_data(const json &sys_props) { void process_system_prompt_data(const json &sys_props) {
@ -915,10 +909,6 @@ struct llama_server_context
{ {
notify_system_prompt_changed(); notify_system_prompt_changed();
} }
else
{
system_need_update = true;
}
} }
void wait_all_are_idle() { void wait_all_are_idle() {
@ -965,7 +955,6 @@ struct llama_server_context
slot.has_next_token = false; slot.has_next_token = false;
} }
stop_pos = pos; stop_pos = pos;
} }
} }