llama : add infill sampler (#9896)

ggml-ci
This commit is contained in:
Georgi Gerganov 2024-10-15 16:35:33 +03:00 committed by GitHub
parent 223c25a72f
commit 755a9b2bf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 300 additions and 29 deletions

View file

@ -21500,6 +21500,13 @@ int32_t llama_token_to_piece(
return llama_token_to_piece_impl(model->vocab, token, buf, length, lstrip, special);
}
bool llama_token_is_prefix(
const struct llama_model * model,
llama_token token0,
llama_token token1) {
return llama_token_is_prefix_impl(model->vocab, token0, token1);
}
int32_t llama_detokenize(
const struct llama_model * model,
const llama_token * tokens,
@ -21830,6 +21837,10 @@ struct llama_sampler * llama_sampler_init_grammar(const struct llama_model * mod
return llama_sampler_init_grammar_impl(model->vocab, grammar_str, grammar_root);
}
struct llama_sampler * llama_sampler_init_infill(const struct llama_model * model) {
return llama_sampler_init_infill_impl(model->vocab);
}
//
// model split
//