deprecate llama_sampler_init_grammar -> llama_sampler_grammar_init
This commit is contained in:
parent
2bb3fed337
commit
7d59bf44ed
3 changed files with 16 additions and 3 deletions
|
@ -158,7 +158,7 @@ struct common_sampler * common_sampler_init(const struct llama_model * model, co
|
||||||
}
|
}
|
||||||
auto * result = new common_sampler {
|
auto * result = new common_sampler {
|
||||||
/* .params = */ params,
|
/* .params = */ params,
|
||||||
/* .grmr = */ llama_sampler_init_grammar(vocab, params.grammar.c_str(), "root",
|
/* .grmr = */ llama_sampler_grammar_init(vocab, params.grammar.c_str(), "root",
|
||||||
params.grammar_lazy,
|
params.grammar_lazy,
|
||||||
trigger_words.data(), trigger_words.size(),
|
trigger_words.data(), trigger_words.size(),
|
||||||
params.grammar_trigger_tokens.data(), params.grammar_trigger_tokens.size()),
|
params.grammar_trigger_tokens.data(), params.grammar_trigger_tokens.size()),
|
||||||
|
|
|
@ -1194,7 +1194,13 @@ extern "C" {
|
||||||
float tau,
|
float tau,
|
||||||
float eta);
|
float eta);
|
||||||
|
|
||||||
LLAMA_API struct llama_sampler * llama_sampler_init_grammar(
|
DEPRECATED(LLAMA_API struct llama_sampler * llama_sampler_init_grammar(
|
||||||
|
const struct llama_vocab * vocab,
|
||||||
|
const char * grammar_str,
|
||||||
|
const char * grammar_root),
|
||||||
|
"use llama_sampler_grammar_init instead");
|
||||||
|
|
||||||
|
LLAMA_API struct llama_sampler * llama_sampler_grammar_init(
|
||||||
const struct llama_vocab * vocab,
|
const struct llama_vocab * vocab,
|
||||||
const char * grammar_str,
|
const char * grammar_str,
|
||||||
const char * grammar_root,
|
const char * grammar_root,
|
||||||
|
|
|
@ -1454,7 +1454,7 @@ static void llama_sampler_grammar_reset(struct llama_sampler * smpl) {
|
||||||
static struct llama_sampler * llama_sampler_grammar_clone(const struct llama_sampler * smpl) {
|
static struct llama_sampler * llama_sampler_grammar_clone(const struct llama_sampler * smpl) {
|
||||||
const auto * ctx = (const llama_sampler_grammar *) smpl->ctx;
|
const auto * ctx = (const llama_sampler_grammar *) smpl->ctx;
|
||||||
|
|
||||||
auto * result = llama_sampler_init_grammar(ctx->vocab, nullptr, nullptr, false, nullptr, 0, nullptr, 0);
|
auto * result = llama_sampler_grammar_init(ctx->vocab, nullptr, nullptr, false, nullptr, 0, nullptr, 0);
|
||||||
|
|
||||||
// copy the state
|
// copy the state
|
||||||
{
|
{
|
||||||
|
@ -1492,6 +1492,13 @@ static struct llama_sampler_i llama_sampler_grammar_i = {
|
||||||
|
|
||||||
|
|
||||||
struct llama_sampler * llama_sampler_init_grammar(
|
struct llama_sampler * llama_sampler_init_grammar(
|
||||||
|
const struct llama_vocab * vocab,
|
||||||
|
const char * grammar_str,
|
||||||
|
const char * grammar_root) {
|
||||||
|
return llama_sampler_grammar_init(vocab, grammar_str, grammar_root, false, nullptr, 0, nullptr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct llama_sampler * llama_sampler_grammar_init(
|
||||||
const struct llama_vocab * vocab,
|
const struct llama_vocab * vocab,
|
||||||
const char * grammar_str,
|
const char * grammar_str,
|
||||||
const char * grammar_root,
|
const char * grammar_root,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue