diff options
author | Johannes Gäßler <johannesg@5d6.de> | 2024-05-07 23:07:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-07 23:07:58 +0200 |
commit | af0a5b616359809ce886ea433acedebb39b12969 (patch) | |
tree | c9da4c284790e7ddd053c1c5f5e3b636581ee07a /common/sampling.cpp | |
parent | b6aa6702030320a3d5fbc2508307af0d7c947e40 (diff) |
server: fix incorrectly reported token probabilities (#7125)
* server: normalize token probabilities
* fix temperature == 0.0f
Diffstat (limited to 'common/sampling.cpp')
-rw-r--r-- | common/sampling.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/sampling.cpp b/common/sampling.cpp index cc83600d..3715a798 100644 --- a/common/sampling.cpp +++ b/common/sampling.cpp @@ -35,6 +35,8 @@ struct llama_sampling_context * llama_sampling_init(const struct llama_sampling_ result->prev.resize(params.n_prev); + result->n_considered = 0; + llama_sampling_set_rng_seed(result, params.seed); return result; @@ -64,6 +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; } void llama_sampling_set_rng_seed(struct llama_sampling_context * ctx, uint32_t seed) { @@ -253,6 +256,8 @@ static llama_token llama_sampling_sample_impl( } } + ctx_sampling->n_considered = cur_p.size; + return id; } |