Fix for temp == 0

This commit is contained in:
Fabio Rossini Sluzala 2023-04-01 17:01:12 -03:00
parent a717cba844
commit 3300247e97
No known key found for this signature in database
GPG key ID: F9D569BBF49F437B

View file

@ -3,6 +3,7 @@
#include "ggml.h"
#include <cinttypes>
#include <float.h>
#include <fstream>
#include <random>
#include <map>
@ -1757,6 +1758,12 @@ llama_token llama_sample_top_p_top_k(
// TODO: avoid this ...
const auto last_n_tokens = std::vector<llama_token>(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,