diff --git a/cpp/common.cpp b/cpp/common.cpp index 1b4f9d4..667cd0f 100644 --- a/cpp/common.cpp +++ b/cpp/common.cpp @@ -1001,8 +1001,10 @@ struct llama_model_params common_model_params_to_llama(const common_params & par mparams.kv_overrides = params.kv_overrides.data(); } - mparams.progress_callback = params.progress_callback; - mparams.progress_callback_user_data = params.progress_callback_user_data; + if (params.progress_callback != nullptr) { + mparams.progress_callback = params.progress_callback; + mparams.progress_callback_user_data = params.progress_callback_user_data; + } return mparams; } diff --git a/cpp/common.h b/cpp/common.h index 4070df2..38649e7 100644 --- a/cpp/common.h +++ b/cpp/common.h @@ -282,8 +282,8 @@ struct common_params { bool warmup = true; // warmup run bool check_tensors = false; // validate tensor data - llama_progress_callback progress_callback; - void * progress_callback_user_data; + llama_progress_callback progress_callback = nullptr; + void * progress_callback_user_data = nullptr; std::string cache_type_k = "f16"; // KV cache data type for the K std::string cache_type_v = "f16"; // KV cache data type for the V diff --git a/scripts/common.cpp.patch b/scripts/common.cpp.patch index 543397e..44268d4 100644 --- a/scripts/common.cpp.patch +++ b/scripts/common.cpp.patch @@ -1,5 +1,5 @@ ---- common.cpp.orig 2024-11-21 11:03:19 -+++ common.cpp 2024-11-21 11:03:20 +--- common.cpp.orig 2024-12-20 13:06:22 ++++ common.cpp 2024-12-20 13:05:42 @@ -4,10 +4,6 @@ #include "common.h" @@ -42,20 +42,23 @@ mparams.rpc_servers = params.rpc_servers.c_str(); mparams.main_gpu = params.main_gpu; mparams.split_mode = params.split_mode; -@@ -999,6 +1001,9 @@ +@@ -999,6 +1001,11 @@ mparams.kv_overrides = params.kv_overrides.data(); } -+ mparams.progress_callback = params.progress_callback; -+ mparams.progress_callback_user_data = params.progress_callback_user_data; ++ if (params.progress_callback != nullptr) { ++ mparams.progress_callback = params.progress_callback; ++ mparams.progress_callback_user_data = params.progress_callback_user_data; ++ } + return mparams; } -@@ -1124,220 +1129,6 @@ +@@ -1123,221 +1130,7 @@ + return false; } - +- -static bool common_download_file(const std::string & url, const std::string & path, const std::string & hf_token) { - - // Initialize libcurl @@ -95,7 +98,7 @@ - nlohmann::json metadata; - std::string etag; - std::string last_modified; -- + - if (file_exists) { - // Try and read the JSON metadata file (note: stream autoclosed upon exiting this block). - std::ifstream metadata_in(metadata_path); diff --git a/scripts/common.h.patch b/scripts/common.h.patch index 26b4253..0f6b0a0 100644 --- a/scripts/common.h.patch +++ b/scripts/common.h.patch @@ -1,5 +1,5 @@ ---- common.h.orig 2024-11-21 10:21:53 -+++ common.h 2024-11-21 10:23:00 +--- common.h.orig 2024-12-20 13:06:22 ++++ common.h 2024-12-20 13:05:53 @@ -41,6 +41,17 @@ struct common_control_vector_load_info; @@ -30,8 +30,8 @@ bool warmup = true; // warmup run bool check_tensors = false; // validate tensor data -+ llama_progress_callback progress_callback; -+ void * progress_callback_user_data; ++ llama_progress_callback progress_callback = nullptr; ++ void * progress_callback_user_data = nullptr; + std::string cache_type_k = "f16"; // KV cache data type for the K std::string cache_type_v = "f16"; // KV cache data type for the V