-
Notifications
You must be signed in to change notification settings - Fork 14.2k
llama-server: friendlier error msg when ctx < input #18174
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1962,19 +1962,33 @@ struct server_context_impl { | |
|
|
||
| if (!slot.can_split()) { | ||
| if (slot.task->n_tokens() > n_ubatch) { | ||
| send_error(slot, "input is too large to process. increase the physical batch size", ERROR_TYPE_SERVER); | ||
| send_error(slot, | ||
| string_format( | ||
| "input (%d tokens) is too large to process. increase the physical batch " | ||
| "size (current batch size: %d)", | ||
| slot.task->n_tokens(), n_ubatch), | ||
| ERROR_TYPE_SERVER); | ||
| slot.release(); | ||
| continue; | ||
| } | ||
|
|
||
| if (slot.task->n_tokens() > slot.n_ctx) { | ||
| send_error(slot, "input is larger than the max context size. skipping", ERROR_TYPE_EXCEED_CONTEXT_SIZE); | ||
| send_error( | ||
| slot, | ||
| string_format( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Edit: hmm ok the CLI doesn't read these fields. I think we can merge this quick fix and I'll refactor this error handling later |
||
| "input (%d tokens) is larger than the max context size (%d tokens). skipping", | ||
| slot.task->n_tokens(), slot.n_ctx), | ||
| ERROR_TYPE_EXCEED_CONTEXT_SIZE); | ||
| slot.release(); | ||
| continue; | ||
| } | ||
| } else { | ||
| if (slot.task->n_tokens() >= slot.n_ctx) { | ||
| send_error(slot, "the request exceeds the available context size, try increasing it", ERROR_TYPE_EXCEED_CONTEXT_SIZE); | ||
| send_error(slot, | ||
| string_format("request (%d tokens) exceeds the available context size (%d " | ||
| "tokens), try increasing it", | ||
| slot.task->n_tokens(), slot.n_ctx), | ||
| ERROR_TYPE_EXCEED_CONTEXT_SIZE); | ||
| slot.release(); | ||
| continue; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.