0001-load-progress.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From c97ed60c3369294d5551ba099a88ddc509687df1 Mon Sep 17 00:00:00 2001
  2. From: Gabe Goodhart <ghart@us.ibm.com>
  3. Date: Thu, 19 Sep 2024 16:55:15 -0600
  4. Subject: [PATCH] patch load progress
  5. ---
  6. common/common.cpp | 2 ++
  7. common/common.h | 7 +++++++
  8. 2 files changed, 9 insertions(+)
  9. diff --git a/common/common.cpp b/common/common.cpp
  10. index 8d0ed4f9..a09e8a53 100644
  11. --- a/common/common.cpp
  12. +++ b/common/common.cpp
  13. @@ -955,6 +955,8 @@ struct llama_model_params llama_model_params_from_gpt_params(const gpt_params &
  14. mparams.use_mmap = params.use_mmap;
  15. mparams.use_mlock = params.use_mlock;
  16. mparams.check_tensors = params.check_tensors;
  17. + mparams.progress_callback = params.progress_callback;
  18. + mparams.progress_callback_user_data = params.progress_callback_user_data;
  19. if (params.kv_overrides.empty()) {
  20. mparams.kv_overrides = NULL;
  21. } else {
  22. diff --git a/common/common.h b/common/common.h
  23. index cb87c447..818a4a4a 100644
  24. --- a/common/common.h
  25. +++ b/common/common.h
  26. @@ -266,6 +266,13 @@ struct gpt_params {
  27. std::string mmproj = ""; // path to multimodal projector // NOLINT
  28. std::vector<std::string> image; // path to image file(s)
  29. + // Called with a progress value between 0.0 and 1.0. Pass NULL to disable.
  30. + // If the provided progress_callback returns true, model loading continues.
  31. + // If it returns false, model loading is immediately aborted.
  32. + llama_progress_callback progress_callback = NULL;
  33. + // context pointer passed to the progress callback
  34. + void * progress_callback_user_data;
  35. +
  36. // embedding
  37. bool embedding = false; // get only sentence embedding
  38. int32_t embd_normalize = 2; // normalisation for embendings (-1=none, 0=max absolute int16, 1=taxicab, 2=euclidean, >2=p-norm)
  39. --
  40. 2.39.3 (Apple Git-146)