]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
add llama_lora_adapter_clear (#8653)
authorXuan Son Nguyen <redacted>
Wed, 24 Jul 2024 09:25:19 +0000 (11:25 +0200)
committerGitHub <redacted>
Wed, 24 Jul 2024 09:25:19 +0000 (11:25 +0200)
include/llama.h
src/llama.cpp

index e68cd807e63bdee7c7b654ab26fe1a34e2a76c06..413070d95a5c4ef240b73131dafbc20d85d30341 100644 (file)
@@ -529,12 +529,16 @@ extern "C" {
             struct llama_lora_adapter * adapter,
             float scale);
 
-    // Remove a LoRA adapter from given context
+    // Remove a specific LoRA adapter from given context
     // Return -1 if the adapter is not present in the context
     LLAMA_API int32_t llama_lora_adapter_remove(
             struct llama_context * ctx,
             struct llama_lora_adapter * adapter);
 
+    // Remove all LoRA adapters from given context
+    LLAMA_API void llama_lora_adapter_clear(
+            struct llama_context * ctx);
+
     // Manually free a LoRA adapter
     // Note: loaded adapters will be free when the associated model is deleted
     LLAMA_API void llama_lora_adapter_free(struct llama_lora_adapter * adapter);
index 40c5e8e8d4b3be60594acaed186dedac1a66b9f1..04eaf6730bc24c462e505e354179ba82e0e8ba2a 100644 (file)
@@ -16201,6 +16201,10 @@ int32_t llama_lora_adapter_remove(
     return -1;
 }
 
+void llama_lora_adapter_clear(struct llama_context * ctx) {
+    ctx->lora_adapters.clear();
+}
+
 void llama_lora_adapter_free(struct llama_lora_adapter * adapter) {
     delete adapter;
 }