diff options
author | Ivan Stepanov <ivanstepanovftw@gmail.com> | 2023-04-05 19:20:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-05 19:20:05 +0300 |
commit | 5a8c4f624077373a198cd562146ffa67b02ebc75 (patch) | |
tree | f96b01473e11a8c2e2549d20da0cf5f48ef248f2 /llama.cpp | |
parent | ff05d05c960076b42f027e4d318cbd6ea59b3030 (diff) |
llama : define non-positive top_k; top_k range check (#779)
* Define non-positive top_k; top_k range check
* minor : brackets
---------
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Diffstat (limited to 'llama.cpp')
-rw-r--r-- | llama.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1229,7 +1229,9 @@ static llama_vocab::id llama_sample_top_p_top_k( } } - sample_top_k(logits_id, top_k); + if (top_k > 0 && top_k < n_logits) { + sample_top_k(logits_id, top_k); + } float maxl = -std::numeric_limits<float>::infinity(); for (const auto & kv : logits_id) { |