From 49af7fbe126e3f2580e0809d2f02903342435aa0 Mon Sep 17 00:00:00 2001 From: xaedes Date: Tue, 29 Aug 2023 00:57:28 +0200 Subject: [PATCH] add comment explaining why finetune checkpoints are allocated in one block --- examples/finetune/finetune.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/finetune/finetune.cpp b/examples/finetune/finetune.cpp index 0e14c1ae3..1f38d4b98 100644 --- a/examples/finetune/finetune.cpp +++ b/examples/finetune/finetune.cpp @@ -932,6 +932,8 @@ struct ggml_tensor * llama_build_lora_finetune_graphs( ggml_build_forward_expand(gb, ggml_scale_inplace(ctx, layer.w3, one)); } + // allocating checkpoints in one block to reduce memory fragmentation + // note: they will be freed in reverse order for (int i = 0; i < checkpoints.size(); ++i) { if (checkpoints[i]->data == NULL && !ggml_is_view(checkpoints[i])) { ggml_allocr_alloc(alloc, checkpoints[i]);