Skip to content

Commit 9152659

Browse files
committed
Exit early in the sampler if nsigma < 0
1 parent 456ddb3 commit 9152659

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/llama-sampling.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,6 +1750,10 @@ static const char * llama_sampler_top_n_sigma_name(const struct llama_sampler *
17501750
static void llama_sampler_top_n_sigma_apply(struct llama_sampler * smpl, llama_token_data_array * cur_p) {
17511751
const auto * ctx = (llama_sampler_top_n_sigma *) smpl->ctx;
17521752

1753+
if (ctx->n < 0.0f) {
1754+
return;
1755+
}
1756+
17531757
// find max logit and calculate mean
17541758
float max = cur_p->data[0].logit;
17551759
float logits_sum = 0;

0 commit comments

Comments
 (0)