Skip to content

Commit

Permalink
fix: decode if has_images (#28)
Browse files Browse the repository at this point in the history
Co-authored-by: vansangpfiev <[email protected]>
  • Loading branch information
vansangpfiev and sangjanai authored May 17, 2024
1 parent 58506d4 commit 8bf3c3e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/llama_server_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1524,14 +1524,16 @@ bool LlamaServerContext::UpdateSlots() {
}

// entire prompt has been processed - start decoding new tokens
if (slot.n_past == slot.num_prompt_tokens) {
if (has_images || slot.n_past == slot.num_prompt_tokens) {
slot.state = SlotState::kProcessing;
slot.command = SlotCommand::kNone;

GGML_ASSERT(batch.n_tokens > 0);

// extract the logits only for the last token
batch.logits[batch.n_tokens - 1] = true;
if (batch.n_tokens > 0) {
batch.logits[batch.n_tokens - 1] = true;
}

slot.n_decoded = 0;
slot.i_batch = batch.n_tokens - 1;
Expand Down

0 comments on commit 8bf3c3e

Please sign in to comment.