8000 common : add load_progress_callback (#13617) · ggml-org/llama.cpp@1dfbf2c · GitHub
[go: up one dir, main page]

Skip to content

Commit 1dfbf2c

Browse files
authored
common : add load_progress_callback (#13617)
1 parent 8960efd commit 1dfbf2c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

common/common.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,9 @@ struct llama_model_params common_model_params_to_llama(common_params & params) {
11021102
mparams.tensor_buft_overrides = params.tensor_buft_overrides.data();
11031103
}
11041104

1105+
mparams.progress_callback = params.load_progress_callback;
1106+
mparams.progress_callback_user_data = params.load_progress_callback_user_data;
1107+
11051108
return mparams;
11061109
}
11071110

common/common.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,11 @@ struct common_params {
428428

429429
// common params
430430
std::string out_file; // output filename for all example programs
431+
// optional callback for model loading progress and cancellation:
432+
// called with a progress value between 0.0 and 1.0.
433+
// return false from callback to abort model loading or true to continue
434+
llama_progress_callback load_progress_callback = NULL;
435+
void * load_progress_callback_user_data = NULL;
431436
};
432437

433438
// call once at the start of a program if it uses libcommon

0 commit comments

Comments
 (0)
0