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
11 changes: 5 additions & 6 deletions examples/server/server-context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1631,12 +1631,11 @@ void server_context::send_final_response(server_slot& slot) {
res->timings = slot.get_timings();
res->post_sampling_probs = slot.params.post_sampling_probs;
res->oaicompat = slot.params.oaicompat;
res->oaicompat_model = slot.params.oaicompat_model;
res->oaicompat_cmpl_id = slot.params.oaicompat_cmpl_id;
res->oaicompat_msg = slot.update_chat_msg(res->oaicompat_msg_diffs);
res->n_decoded = slot.n_decoded;
res->n_prompt_tokens = slot.n_prompt_tokens;
res->oaicompat_model = slot.oaicompat_model;
res->oaicompat_model = slot.task->params.oaicompat_model;
res->data = json{
{"content", !slot.params.stream ? slot.generated_text : ""},
{"generated_text", slot.generated_text}, // Always include full text for finish_reason logic
Expand Down Expand Up @@ -2590,9 +2589,9 @@ void server_context::batch_pending_prompt(const int32_t n_ubatch, const int32_t

slot.state = SLOT_STATE_PROCESSING;
slot.command = SLOT_COMMAND_NONE;
send_final_response(slot);
slot.release();
slot.print_timings();
send_final_response(slot);
continue;
}

Expand Down Expand Up @@ -2933,9 +2932,9 @@ void server_context::speculative_decoding_accept() {

if (!process_token(result, slot)) {
// release slot because of stop condition
send_final_response(slot);
slot.release();
slot.print_timings();
send_final_response(slot);
metrics.on_prediction(slot);
break;
}
Expand All @@ -2953,7 +2952,7 @@ void server_context::speculative_decoding_accept() {

bool server_context::accept_special_token(const server_slot& slot, const llama_token token) {
return params_base.special || slot.sparams.preserved_tokens.find(token) != slot.sparams.preserved_tokens.end();
};
}


void server_context::send_token_results(completion_token_outputs& results, server_slot& slot, int32_t n) {
Expand All @@ -2962,9 +2961,9 @@ void server_context::send_token_results(completion_token_outputs& results, serve
bool has_next = process_token(it, slot);
count++;
if (!has_next) {
send_final_response(slot);
slot.release();
slot.print_timings();
send_final_response(slot);
metrics.on_prediction(slot);
break;
}
Expand Down
1 change: 1 addition & 0 deletions examples/server/server-context.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,5 @@ struct server_context {

// Re-aggregates all active vectors and updates the model state
bool apply_control_vectors_internal();

};