From: Georgi Gerganov Date: Thu, 14 Aug 2025 19:10:51 +0000 (+0300) Subject: eval-callback : stop on first NaN (#15320) X-Git-Tag: upstream/0.0.6199~30 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=df36bce667bf14f8e538645547754386f9516326;p=pkg%2Fggml%2Fsources%2Fllama.cpp eval-callback : stop on first NaN (#15320) * eval-callback : stop on first NaN * cont : log error --- diff --git a/examples/eval-callback/eval-callback.cpp b/examples/eval-callback/eval-callback.cpp index 4afd80eb..61eefc72 100644 --- a/examples/eval-callback/eval-callback.cpp +++ b/examples/eval-callback/eval-callback.cpp @@ -7,6 +7,7 @@ #include #include #include +#include /** * This the arbitrary data which will be passed to each callback. @@ -77,6 +78,12 @@ static void ggml_print_tensor(uint8_t * data, ggml_type type, const int64_t * ne LOG(" ]\n"); LOG(" sum = %f\n", sum); } + + // TODO: make this abort configurable/optional? + if (std::isnan(sum)) { + LOG_ERR("encountered NaN - aborting\n"); + exit(0); + } } /**