summaryrefslogtreecommitdiff
path: root/common/sampling.cpp
diff options
context:
space:
mode:
authorJohannes Gäßler <johannesg@5d6.de>2024-05-11 10:11:28 +0200
committerGitHub <noreply@github.com>2024-05-11 10:11:28 +0200
commit5ae3426b0b64672991563d4c28b2018b9f961467 (patch)
tree89931634ad54c11482e70635820f7623db6a1a7d /common/sampling.cpp
parentb83cc3f5b303ff30c52874b2d5864dc6385ebf9f (diff)
server: fix reported top tokens for temperature 0 (#7203)
Diffstat (limited to 'common/sampling.cpp')
-rw-r--r--common/sampling.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/sampling.cpp b/common/sampling.cpp
index 3715a798..f0f1b92d 100644
--- a/common/sampling.cpp
+++ b/common/sampling.cpp
@@ -35,7 +35,7 @@ struct llama_sampling_context * llama_sampling_init(const struct llama_sampling_
result->prev.resize(params.n_prev);
- result->n_considered = 0;
+ result->n_valid = 0;
llama_sampling_set_rng_seed(result, params.seed);
@@ -66,7 +66,7 @@ void llama_sampling_reset(llama_sampling_context * ctx) {
std::fill(ctx->prev.begin(), ctx->prev.end(), 0);
ctx->cur.clear();
- ctx->n_considered = 0;
+ ctx->n_valid = 0;
}
void llama_sampling_set_rng_seed(struct llama_sampling_context * ctx, uint32_t seed) {
@@ -256,7 +256,7 @@ static llama_token llama_sampling_sample_impl(
}
}
- ctx_sampling->n_considered = cur_p.size;
+ ctx_sampling->n_valid = temp == 0.0f ? 0 : cur_p.size;
return id;
}