diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/sampling.cpp | 6 | ||||
-rw-r--r-- | common/sampling.h | 2 |
2 files changed, 4 insertions, 4 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; } diff --git a/common/sampling.h b/common/sampling.h index 5b73ecdc..655732ad 100644 --- a/common/sampling.h +++ b/common/sampling.h @@ -81,7 +81,7 @@ struct llama_sampling_context { // TODO: replace with ring-buffer std::vector<llama_token> prev; std::vector<llama_token_data> cur; - size_t n_considered; + size_t n_valid; // Number of correct top tokens with correct probabilities. std::mt19937 rng; }; |