Do not crash when there is no DRY sampler

This commit is contained in:
Iwan Kawrakow
2025-07-03 15:43:19 +03:00
parent de7a4403b0
commit fe9926708a
2 changed files with 7 additions and 2 deletions

View File

@@ -502,5 +502,7 @@ void llama_sampling_accept(
if (ctx_sampling->grammar != NULL && apply_grammar) {
llama_grammar_accept_token(ctx_sampling->grammar, ctx_main, id);
}
if (ctx_sampling->smpl) {
llama_sampler_dry_accept(ctx_sampling->smpl, id);
}
}

View File

@@ -23401,6 +23401,9 @@ struct llama_sampler_dry* llama_sampler_dry_clone(struct llama_sampler_dry* smpl
}
void llama_sampler_dry_accept(struct llama_sampler_dry* smpl, llama_token token) {
if (!smpl) {
return;
}
if (smpl->dry_multiplier == 0.0f || smpl->dry_base < 1.0f || smpl->dry_penalty_last_n == 0) {
return;
}