MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / llama_load_model_from_file_with_context

Function llama_load_model_from_file_with_context

llama.cpp:9789–9821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9787}
9788
9789struct llama_model * llama_load_model_from_file_with_context(
9790 const char * path_model,
9791 struct llama_model_params params,
9792 struct llama_context_params * cparams
9793) {
9794 ggml_time_init();
9795
9796 llama_model * model = new llama_model;
9797
9798 unsigned cur_percentage = 0;
9799 if (params.progress_callback == NULL) {
9800 params.progress_callback_user_data = &cur_percentage;
9801 params.progress_callback = [](float progress, void * ctx) {
9802 unsigned * cur_percentage_p = (unsigned *) ctx;
9803 unsigned percentage = (unsigned) (100 * progress);
9804 while (percentage > *cur_percentage_p) {
9805 *cur_percentage_p = percentage;
9806 LLAMA_LOG_INFO(".");
9807 if (percentage >= 100) {
9808 LLAMA_LOG_INFO("\n");
9809 }
9810 }
9811 };
9812 }
9813
9814 if (!llama_model_load(path_model, *model, params, cparams)) {
9815 LLAMA_LOG_ERROR("%s: failed to load model\n", __func__);
9816 delete model;
9817 return nullptr;
9818 }
9819
9820 return model;
9821}
9822
9823struct llama_model * llama_load_model_from_file(
9824 const char * path_model,

Callers 2

Calls 2

ggml_time_initFunction · 0.70
llama_model_loadFunction · 0.70

Tested by

no test coverage detected