Skip to content

Commit 0d7053b

Browse files
committed
Revert changes to the implementation of temp_ext
1 parent fecd48a commit 0d7053b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/llama-sampling.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,17 +1014,17 @@ static const char * llama_sampler_temp_ext_name(const struct llama_sampler * /*s
10141014
static void llama_sampler_temp_ext_apply(struct llama_sampler * smpl, llama_token_data_array * cur_p) {
10151015
const auto * ctx = (llama_sampler_temp_ext *) smpl->ctx;
10161016

1017-
// no need to do anything if there is only one (or zero) candidates
1018-
if (cur_p->size <= 1) {
1019-
return;
1020-
}
1021-
10221017
if (ctx->delta > 0) {
10231018
const float min_temp = std::max(0.0f, ctx->temp - ctx->delta);
10241019
const float max_temp = ctx->temp + ctx->delta;
10251020

10261021
float exponent_val = ctx->exponent;
10271022

1023+
// no need to do anything if there is only one (or zero) candidates
1024+
if (cur_p->size <= 1) {
1025+
return;
1026+
}
1027+
10281028
// Calculate maximum possible entropy
10291029
float max_entropy = -logf(1.0f / cur_p->size);
10301030

@@ -1107,7 +1107,7 @@ struct llama_sampler * llama_sampler_init_temp_ext(float temp, float delta, floa
11071107
/* .ctx = */ new llama_sampler_temp_ext {
11081108
/* .temp = */ temp,
11091109
/* .delta = */ delta,
1110-
/* .exponent = */ exponent
1110+
/* .exponent = */ exponent,
11111111
}
11121112
);
11131113
}

0 commit comments

Comments
 (0)