diff options
Diffstat (limited to 'common/sampling.cpp')
-rw-r--r-- | common/sampling.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/sampling.cpp b/common/sampling.cpp index 5258d4e8..c4996c98 100644 --- a/common/sampling.cpp +++ b/common/sampling.cpp @@ -167,8 +167,12 @@ llama_token llama_sampling_sample( llama_sample_grammar(ctx_main, &cur_p, ctx_sampling->grammar); } - if (temp <= 0) { - // greedy sampling + if (temp < 0.0) { + // greedy sampling, with probs + llama_sample_softmax(ctx_main, &cur_p); + id = cur_p.data[0].id; + } else if (temp == 0.0) { + // greedy sampling, no probs id = llama_sample_token_greedy(ctx_main, &cur_p); } else { if (mirostat == 1) { |