From ae3d0ff68f9a8177118a0b600d4076bee2f4693d Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Fri, 24 Mar 2023 17:26:19 -0400 Subject: [PATCH] Call progress callback more frequently --- llama.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/llama.cpp b/llama.cpp index a8ece3d80..07482eaf2 100644 --- a/llama.cpp +++ b/llama.cpp @@ -776,11 +776,12 @@ static bool llama_model_load( model.n_loaded++; // progress + if (progress_callback) { + double current_file_progress = double(size_t(fin.tellg()) - file_offset) / double(file_size - file_offset); + double current_progress = (double(i) + current_file_progress) / double(n_parts); + progress_callback(current_progress, progress_callback_user_data); + } if (model.n_loaded % 8 == 0) { - if (progress_callback) { - double current_progress = (double(i) + (double(size_t(fin.tellg()) - file_offset) / double(file_size - file_offset))) / double(n_parts); - progress_callback(current_progress, progress_callback_user_data); - } fprintf(stderr, "."); fflush(stderr); }