fix llama_reset_model_time
This commit is contained in:
parent
24bea1549b
commit
216e7d9648
3 changed files with 7 additions and 7 deletions
|
@ -1558,7 +1558,8 @@ int main(int argc, char ** argv) {
|
||||||
}
|
}
|
||||||
prev_inst = &inst;
|
prev_inst = &inst;
|
||||||
} else {
|
} else {
|
||||||
llama_model_reset_time(lmodel);
|
// ensure load_time dost not accumulate in llama_bench when not loading the same model
|
||||||
|
llama_reset_model_time(lmodel);
|
||||||
}
|
}
|
||||||
|
|
||||||
llama_context * ctx = llama_new_context_with_model(lmodel, inst.to_llama_cparams());
|
llama_context * ctx = llama_new_context_with_model(lmodel, inst.to_llama_cparams());
|
||||||
|
|
|
@ -414,7 +414,7 @@ extern "C" {
|
||||||
const char * path_model,
|
const char * path_model,
|
||||||
struct llama_model_params params);
|
struct llama_model_params params);
|
||||||
|
|
||||||
LLAMA_API void llama_model_reset_time(struct llama_model * model);
|
LLAMA_API void llama_reset_model_time(struct llama_model * model);
|
||||||
|
|
||||||
LLAMA_API void llama_free_model(struct llama_model * model);
|
LLAMA_API void llama_free_model(struct llama_model * model);
|
||||||
|
|
||||||
|
|
|
@ -8809,11 +8809,6 @@ static bool llm_load_tensors(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void llama_model_reset_time(llama_model * model) {
|
|
||||||
model->t_start_us = ggml_time_us();
|
|
||||||
model->t_load_us = ggml_time_us() - model->t_start_us;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns 0 on success, -1 on error, and -2 on cancellation via llama_progress_callback
|
// Returns 0 on success, -1 on error, and -2 on cancellation via llama_progress_callback
|
||||||
static int llama_model_load(const std::string & fname, llama_model & model, llama_model_params & params) {
|
static int llama_model_load(const std::string & fname, llama_model & model, llama_model_params & params) {
|
||||||
model.t_start_us = ggml_time_us();
|
model.t_start_us = ggml_time_us();
|
||||||
|
@ -18695,6 +18690,10 @@ struct llama_model * llama_load_model_from_file(
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void llama_reset_model_time(llama_model * model) {
|
||||||
|
model->t_start_us = ggml_time_us() - model->t_load_us;
|
||||||
|
}
|
||||||
|
|
||||||
void llama_free_model(struct llama_model * model) {
|
void llama_free_model(struct llama_model * model) {
|
||||||
delete model;
|
delete model;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue