Skip to content

Commit 1c8e5c8

Browse files
authored
Implement EOS token assertion for early stop
Add assertion for EOS token early stopping.
1 parent 876fa91 commit 1c8e5c8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/diffusion/diffusion-cli.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ static void diffusion_generate(llama_context * ctx,
239239
// Get EOS token for early termination
240240
const llama_vocab * vocab = llama_model_get_vocab(model);
241241
llama_token eos_token_id = llama_vocab_eos(vocab);
242+
243+
if (params.eos_early_stop) {
244+
GGML_ASSERT(eos_token_id != LLAMA_TOKEN_NULL);
245+
}
246+
242247
LOG_DBG("DEBUG: EOS token ID = %d\n", eos_token_id);
243248

244249
// Setup sampler chain

0 commit comments

Comments
 (0)