From 63da54e0164a530414f948a3115e0535ca20f5bb Mon Sep 17 00:00:00 2001 From: Slaren <2141330+slaren@users.noreply.github.com> Date: Sun, 16 Apr 2023 18:30:27 +0200 Subject: [PATCH] Only attempt to use mmap for the lora base model if it is supported --- llama.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llama.cpp b/llama.cpp index 87c89b016..4f222ce57 100644 --- a/llama.cpp +++ b/llama.cpp @@ -1840,7 +1840,9 @@ int llama_apply_lora_from_file_internal(struct llama_context * ctx, const char * model_loader->ggml_ctx = base_ctx; // maybe this should in llama_model_loader - model_loader->mapping.reset(new llama_mmap(&model_loader->file_loaders.at(0)->file, false)); + if (model_loader->use_mmap) { + model_loader->mapping.reset(new llama_mmap(&model_loader->file_loaders.at(0)->file, /* prefetch */ false)); + } } // read tensors and apply