llama : add llama_token_is_eog()

ggml-ci
This commit is contained in:
Georgi Gerganov 2024-04-20 16:46:46 +03:00
parent f3105b9eec
commit 3750706962
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
18 changed files with 76 additions and 46 deletions

View file

@ -45,7 +45,7 @@ static const char * sample(struct llama_sampling_context * ctx_sampling,
const llama_token id = llama_sampling_sample(ctx_sampling, ctx_llama, NULL);
llama_sampling_accept(ctx_sampling, ctx_llama, id, true);
static std::string ret;
if (id == llama_token_eos(llama_get_model(ctx_llama))) {
if (llama_token_is_eog(llama_get_model(ctx_llama), id)) {
ret = "</s>";
} else {
ret = llama_token_to_piece(ctx_llama, id);