mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-07-21 10:15:35 +00:00
sweep-bench: add -minilog argument to reduce verbose logging (#1468)
Purpose:
Add --minilog flag to llama-sweep-bench that filters log output to show only essential GPU/layer distribution information while suppressing verbose model metadata and per-layer device assignment messages.
Changes:
- Add llama_selective_log_callback with blacklist approach (sweep-bench.cpp)
Blacklisted patterns (hidden):
- Per-layer device assignments ('Setting default device in layer')
- KV metadata dump header and entries
- Tensor type counts
- Model validation messages
- EOG/special token cache info
- Metadata printout (llm_load_print_meta, print_info)
- Layer sizes table
- Tensor loading info (llm_load_tensors)
- Separator lines
- Most common cases of incomplete/continuation lines are also hidden
All other log output is shown, including:
- GPU VRAM info
- Split/buffer distribution per device
- Graph split estimates
- Final benchmark table and timings
This commit is contained in:
@@ -2169,6 +2169,10 @@ bool gpt_params_find_arg(int argc, char ** argv, const std::string & arg, gpt_pa
|
||||
else { invalid_param = true; }
|
||||
return true;
|
||||
}
|
||||
if (arg == "--minilog") {
|
||||
params.minilog = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef LOG_DISABLE_LOGS
|
||||
// Parse args for logging parameters
|
||||
|
||||
@@ -471,6 +471,7 @@ struct gpt_params {
|
||||
std::string lora_outfile = "ggml-lora-merged-f16.gguf";
|
||||
|
||||
bool sweep_bench_output_jsonl = false;
|
||||
bool minilog = false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -14,9 +14,46 @@
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
static void llama_selective_log_callback(ggml_log_level level, const char * text, void * user_data) {
|
||||
(void) level;
|
||||
(void) user_data;
|
||||
const char * skip_patterns[] = {
|
||||
"Setting default device in layer",
|
||||
"llama_model_loader: Dumping metadata",
|
||||
"llama_model_loader: - kv ",
|
||||
"llama_model_loader: - type ",
|
||||
"validate_override:",
|
||||
"load: printing all EOG",
|
||||
"load: - ",
|
||||
"load: special tokens cache",
|
||||
"load: token to piece cache",
|
||||
"llm_load_print_meta:",
|
||||
"print_info:",
|
||||
"------------------- Layer sizes",
|
||||
"Layer ",
|
||||
"llm_load_tensors:",
|
||||
"==========================",
|
||||
};
|
||||
for (const char * pat : skip_patterns) {
|
||||
if (strstr(text, pat) != nullptr) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Skip incomplete/continuation lines
|
||||
int i = 0;
|
||||
while (text[i] == ' ' || text[i] == '\t') {
|
||||
i++;
|
||||
}
|
||||
if (text[i] == ',' || text[i] == '(' || text[i] == ')'|| (text[i] >= '0' && text[i] <= '9')) {
|
||||
return;
|
||||
}
|
||||
LOG_TEE("%s", text);
|
||||
}
|
||||
|
||||
static void print_usage(int, char ** argv) {
|
||||
LOG_TEE("\nexample usage:\n");
|
||||
LOG_TEE("\n %s -m model.gguf -c 8192 -b 2048 -ub 512\n", argv[0]);
|
||||
@@ -33,6 +70,10 @@ int main(int argc, char ** argv) {
|
||||
}
|
||||
if (params.nrep < 1) params.nrep = 1;
|
||||
|
||||
if (params.minilog) {
|
||||
llama_log_set(llama_selective_log_callback, nullptr);
|
||||
}
|
||||
|
||||
// init LLM
|
||||
|
||||
llama_backend_init();
|
||||
|
||||
Reference in New Issue
Block a user