fix autofit spamming

This commit is contained in:
Concedo
2026-02-07 18:01:01 +08:00
parent 78bba94f72
commit 812da8b75d
+13 -3
View File
@@ -189,6 +189,10 @@ inline bool LogitsDuplicated(std::vector<float> & arr1, std::vector<float> & arr
return true;
}
static inline void log_callback_off(ggml_log_level level, const char* text, void*) {
return;
}
static inline void string_trim_whitespace(std::string & s) {
auto nul = std::find(s.begin(), s.end(), '\0'); //remove everything after the first NUL
if (nul != s.end()) {
@@ -2559,11 +2563,17 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
model_params.tensor_split = tensor_split_temp;
model_params.n_gpu_layers = -1; //must be this value to be considered default
printf("Autofit Reserve Space: %d MB\n",taxmb);
//disable log spam
ggml_log_callback currlogger;
void * curruserdat;
llama_log_get(&currlogger, &curruserdat);
llama_log_set(log_callback_off, nullptr);
fit_params_target[0] = taxmb*1024*1024;
llama_params_fit(kcpp_data->model_filename.c_str(), &model_params, &llama_ctx_params,
bool success = (llama_params_fit(kcpp_data->model_filename.c_str(), &model_params, &llama_ctx_params,
tensor_split_temp, tenos.data(), fit_params_target.data(), kcpp_data->n_ctx,
GGML_LOG_LEVEL_DEBUG);
printf("Autofit Result: ");
GGML_LOG_LEVEL_NONE)==0);
llama_log_set(currlogger, curruserdat);
printf("Autofit Success: %d, Autofit Result: ",success);
print_fitted_params(model_params,llama_ctx_params);
}