Skip to content

Commit b115105

Browse files
authored
add llama_lora_adapter_clear (#8653)
1 parent de28008 commit b115105

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
@@ -16201,6 +16201,10 @@ int32_t llama_lora_adapter_remove(
1620116201
return -1;
1620216202
}
1620316203

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

0 commit comments

Comments
 (0)