diff options
author | Kawrakow <iwankawrakow@gmail.com> | 2025-07-03 15:26:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-03 15:26:52 +0200 |
commit | db8dee50516d1437f94017de196f87dcf54be12d (patch) | |
tree | 03fec5bae46d8c76920d2a3e2cd16fb8599a40d9 /common | |
parent | ab22474d77ecc846eaf102011f866b1d767f3ad5 (diff) |
Do not crash when there is no DRY sampler (#578)
Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/sampling.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/common/sampling.cpp b/common/sampling.cpp index 4b983e5f..08a19b45 100644 --- a/common/sampling.cpp +++ b/common/sampling.cpp @@ -55,7 +55,7 @@ struct llama_sampling_context * llama_sampling_init(const struct llama_vocab* vo c_breakers.push_back(str.c_str()); } result->smpl=llama_sampler_init_dry(vocab, params.dry_multiplier, params.dry_base, params.dry_allowed_length, params.dry_penalty_last_n, c_breakers.data(), c_breakers.size()); - + break; } default: @@ -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); } - llama_sampler_dry_accept(ctx_sampling->smpl, id); + if (ctx_sampling->smpl) { + llama_sampler_dry_accept(ctx_sampling->smpl, id); + } } |