diff options
author | tarcey <cey.tarik@gmail.com> | 2023-11-30 22:40:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-30 23:40:23 +0200 |
commit | 954e22858c5cea1dc03e9172d3879402af2b5990 (patch) | |
tree | c8c80ab70b8953e70770c06ac1af4301d7cf431e | |
parent | e2bd725f4b39bc5c6234858d158e01248f5ab5bd (diff) |
llama : fix typical sampling (#4261)
Typical sampling was broken because after copying new_candidates into canditates, the "sorted" bool is left at "true", but the new data is no longer sorted according to probability. Patch to set "sorted" to false.
Test: Generating with temp=0.0001 (approx. argmax) should generate the same sequence at typical>=1.0 and typical=0.9999 (approx. disabled, but enters the typical sampling codepath).
-rw-r--r-- | llama.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -7027,6 +7027,7 @@ void llama_sample_typical(struct llama_context * ctx, llama_token_data_array * c // Replace the data in candidates with the new_candidates data std::copy(new_candidates.begin(), new_candidates.end(), candidates->data); candidates->size = new_candidates.size(); + candidates->sorted = false; if (ctx) { ctx->t_sample_us += ggml_time_us() - t_start_sample_us; |