0001-load-progress.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From 2cfaa0a04faa9c87ba8f1ac8527eb953e69c6cde Mon Sep 17 00:00:00 2001
  2. From: Michael Yang <mxyng@pm.me>
  3. Date: Mon, 16 Sep 2024 15:53:10 -0700
  4. Subject: [PATCH] 01-load-progress.diff
  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 9fa18472..48ff41e9 100644
  11. --- a/common/common.cpp
  12. +++ b/common/common.cpp
  13. @@ -2573,6 +2573,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 cb5e7f6d..d8f043f7 100644
  24. --- a/common/common.h
  25. +++ b/common/common.h
  26. @@ -204,6 +204,13 @@ struct gpt_params {
  27. std::string mmproj = ""; // path to multimodal projector
  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.46.0