]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
examples : disable cb_eval callback for --save-logits (#21553)
authorDaniel Bevenius <redacted>
Wed, 8 Apr 2026 12:10:33 +0000 (14:10 +0200)
committerGitHub <redacted>
Wed, 8 Apr 2026 12:10:33 +0000 (14:10 +0200)
This commit updates the debug example to not create the
base_callback_data.

The motivation for this is when using `--save-logits`, which is used by
examples/model-conversion scripts, we often don't care about the tensor
outputs and they just add noise to the output. This changes is quiet by
default we can always remove --save-logits to get the tensor outputs
when debugging.

examples/debug/debug.cpp

index ec80be19ba4f183b76e56da7c1af16cd25722330..7ba63b4ff60465230e9c00e7423e1ac121aae3f5 100644 (file)
@@ -9,6 +9,7 @@
 #include <vector>
 #include <filesystem>
 #include <fstream>
+#include <optional>
 #include <regex>
 
 static void print_usage(int /*argc*/, char ** argv) {
@@ -222,7 +223,10 @@ int main(int argc, char ** argv) {
     llama_backend_init();
     llama_numa_init(params.numa);
 
-    base_callback_data cb_data(params, params.tensor_filter);
+    std::optional<base_callback_data> cb_data;
+    if (!params.save_logits) {
+        cb_data.emplace(params, params.tensor_filter);
+    }
 
     auto llama_init = common_init_from_params(params);