diff options
author | Johannes Gäßler <johannesg@5d6.de> | 2024-02-08 09:46:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-08 09:46:30 +0100 |
commit | 26d4efd11e48908e14e2ee9471a7fc4c57079a1d (patch) | |
tree | 04c16bf0611e416a0f5a792672f276a3cc55af7f /llama.cpp | |
parent | 8504d2d0da8cc7a1f2eee0e9e56949f960510b75 (diff) |
sampling: fix top_k <= 0 (#5388)
* sampling: fix top_k <= 0
* Update llama.cpp
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
---------
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Diffstat (limited to 'llama.cpp')
-rw-r--r-- | llama.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -8585,6 +8585,10 @@ void llama_sample_top_k(struct llama_context * ctx, llama_token_data_array * can // } const int64_t t_start_sample_us = ggml_time_us(); + + if (k <= 0) { + k = candidates->size; + } k = std::max(k, (int) min_keep); k = std::min(k, (int) candidates->size); |