From ccb2bb9988a419fe8429021d17941a5199abee06 Mon Sep 17 00:00:00 2001 From: Francis Couture-Harpin Date: Wed, 18 Jun 2025 15:11:23 -0400 Subject: [PATCH] test-model-random : show max error --- tests/test-model-random.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test-model-random.cpp b/tests/test-model-random.cpp index 3b636039b4..d3739f1a8f 100644 --- a/tests/test-model-random.cpp +++ b/tests/test-model-random.cpp @@ -1089,6 +1089,8 @@ int main(int argc, char ** argv) { std::set seq_ids_in_batch; std::vector seq_id_n_past(n_seq_max, 0); + float max_err = 0.0f; + // start filling the batch with prompts while (std::any_of(seq_id_n_past.begin(), seq_id_n_past.end(), [](llama_pos p) { return p < n_seq_len; })) { @@ -1119,6 +1121,7 @@ int main(int argc, char ** argv) { fprintf(stderr, "Error for seq_id %i is %f at n_past=%i\n", seq_id, err, seq_id_n_past[seq_id]); valid[seq_id] = false; } + max_err = std::max(err, max_err); } common_batch_clear(batch); @@ -1140,10 +1143,11 @@ int main(int argc, char ** argv) { "Comparing output for '%s', with shuffle=%i, n_seq_max=%i, n_ctx=%i, n_ubatch=%i: ", variant.name.c_str(), shuffle, n_seq_max, n_ctx, n_ubatch); if (std::all_of(valid.begin(), valid.end(), [](bool v) { return v; })) { - fprintf(stdout, "\033[1;32mOK\033[0m\n"); + fprintf(stdout, "\033[1;32mOK\033[0m (max err: %.2g)\n", max_err); } else { - fprintf(stdout, "(%zu%%) \033[1;31mFAILED\033[0m\n", - std::count_if(valid.begin(), valid.end(), [](bool v) { return v == false; }) * 100 / valid.size()); + fprintf(stdout, "(%zu%%) \033[1;31mFAILED\033[0m (max err: %.4g)\n", + std::count_if(valid.begin(), valid.end(), [](bool v) { return v == false; }) * 100 / valid.size(), + max_err); // cleanup and exit on first failure llama_free(ctx); llama_model_free(model);