]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server : fix divide-by-zero in metrics reporting (#11915)
authorAntoine Viallon <redacted>
Mon, 17 Feb 2025 10:25:12 +0000 (11:25 +0100)
committerGitHub <redacted>
Mon, 17 Feb 2025 10:25:12 +0000 (11:25 +0100)
examples/server/server.cpp

index 9ffec0a64ad94e362b7f4445a684d82279d0ab31..74de3a7622beee4ceaa0dfc81cd1bbe144aa9b55 100644 (file)
@@ -3656,7 +3656,7 @@ int main(int argc, char ** argv) {
             }, {
                     {"name",  "n_busy_slots_per_decode"},
                     {"help",  "Average number of busy slots per llama_decode() call"},
-                    {"value",  (float) res_metrics->n_busy_slots_total / (float) res_metrics->n_decode_total}
+                    {"value",  (float) res_metrics->n_busy_slots_total / std::max((float) res_metrics->n_decode_total, 1.f)}
             }}},
             {"gauge", {{
                     {"name",  "prompt_tokens_seconds"},