Skip to content

Commit a5f1f44

Browse files
ngxsonarthw
authored andcommitted
add llama_lora_adapter_clear (ggml-org#8653)
1 parent a17bcdf commit a5f1f44

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

include/llama.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,12 +529,16 @@ extern "C" {
529529
struct llama_lora_adapter * adapter,
530530
float scale);
531531

532-
// Remove a LoRA adapter from given context
532+
// Remove a specific LoRA adapter from given context
533533
// Return -1 if the adapter is not present in the context
534534
LLAMA_API int32_t llama_lora_adapter_remove(
535535
struct llama_context * ctx,
536536
struct llama_lora_adapter * adapter);
537537

538+
// Remove all LoRA adapters from given context
539+
LLAMA_API void llama_lora_adapter_clear(
540+
struct llama_context * ctx);
541+
538542
// Manually free a LoRA adapter
539543
// Note: loaded adapters will be free when the associated model is deleted
540544
LLAMA_API void llama_lora_adapter_free(struct llama_lora_adapter * adapter);

src/llama.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16202,6 +16202,10 @@ int32_t llama_lora_adapter_remove(
1620216202
return -1;
1620316203
}
1620416204

16205+
void llama_lora_adapter_clear(struct llama_context * ctx) {
16206+
ctx->lora_adapters.clear();
16207+
}
16208+
1620516209
void llama_lora_adapter_free(struct llama_lora_adapter * adapter) {
1620616210
delete adapter;
1620716211
}

0 commit comments

Comments
 (0)