Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions common/sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
}
}
3 changes: 3 additions & 0 deletions src/llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down