-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
common: ensure token addition to batch does not exceed llama_batch size #9668
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more elegant solution is to use the fact that llama_batch.seq_id
is null-terminated:
Line 20778 in 877a04c
batch.seq_id[n_tokens_alloc] = nullptr; |
We can add an assert directly in llama_batch_add
:
GGML_ASSERT(batch.seq_id[batch.n_tokens] && "llama_batch size exceeded");
That's great @ggerganov. I'm uploading the new patch soon. |
A crash was observed when the number of tokens added to a batch exceeds llama_batch size. An assertion in llama_batch_add was added to protect against llama_batch size overflow.
d063cf1
to
c197f0f
Compare
Done. Now the issued mentioned in #9667 displays the following message if we attempt to add more tokens than batch size:
|
Tks @matiaslin and @ggerganov |
…9668) A crash was observed when the number of tokens added to a batch exceeds llama_batch size. An assertion in llama_batch_add was added to protect against llama_batch size overflow.
…9668) A crash was observed when the number of tokens added to a batch exceeds llama_batch size. An assertion in llama_batch_add was added to protect against llama_batch size overflow.
…9668) A crash was observed when the number of tokens added to a batch exceeds llama_batch size. An assertion in llama_batch_add was added to protect against llama_batch size overflow.
fix #9667
A crash was observed when the number of tokens added to a batch exceeds the context size. Assertions have been added to ensure the number of tokens added to batch is within bounds of context size.