Skip to content
Open
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: 9 additions & 2 deletions tools/server/server-context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ struct server_slot {
}

std::vector<common_adapter_lora_info> lora;
std::vector<common_adapter_lora_info> previous_lora;
int32_t alora_invocation_start = -1;

// sampling
Expand Down Expand Up @@ -191,6 +192,9 @@ struct server_slot {

// clear alora start
alora_invocation_start = -1;

lora.clear();
previous_lora.clear();
}

void init_sampler() const {
Expand Down Expand Up @@ -2576,8 +2580,11 @@ struct server_context_impl {
SRV_DBG("decoding batch, n_tokens = %d\n", batch.n_tokens);

if (slot_batched) {
// apply lora, only need to do it once per batch
common_set_adapter_lora(ctx, slot_batched->lora);
if (!are_lora_equal(slot_batched->previous_lora, slot_batched->lora)) {
// apply lora, only need to do it once per batch
common_set_adapter_lora(ctx, slot_batched->lora);
slot_batched->previous_lora = slot_batched->lora;
}

// if the lora is temporarily disabled for an alora, re-enable it
// for next time
Expand Down