From 3300247e97fe5726821ba47299e289bcb3351b23 Mon Sep 17 00:00:00 2001 From: Fabio Rossini Sluzala Date: Sat, 1 Apr 2023 17:01:12 -0300 Subject: [PATCH] Fix for temp == 0 --- llama.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/llama.cpp b/llama.cpp index bed24207d..853427a96 100644 --- a/llama.cpp +++ b/llama.cpp @@ -3,6 +3,7 @@ #include "ggml.h" #include +#include #include #include #include @@ -1757,6 +1758,12 @@ llama_token llama_sample_top_p_top_k( // TODO: avoid this ... const auto last_n_tokens = std::vector(last_n_tokens_data, last_n_tokens_data + last_n_tokens_size); + if (std::abs(temp) < FLT_EPSILON) { + temp = 0.8f; + top_k = 1.0f; + top_p = 0.0f; + } + result = llama_sample_top_p_top_k( *ctx, last_n_tokens,