Skip to content

feat(router): add max_batch_size #1542

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

Merged
merged 4 commits into from
Feb 9, 2024
Merged

feat(router): add max_batch_size #1542

merged 4 commits into from
Feb 9, 2024

Conversation

OlivierDehaene
Copy link
Contributor

Some hardware require a maximum batch size.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Collaborator

@dacorvo dacorvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks !

@@ -279,6 +279,11 @@ struct Args {
#[clap(default_value = "20", long, env)]
max_waiting_tokens: usize,

/// Enforce a maximum number of requests per batch
/// Specific flag for hardware targets that do not support unpadded inference
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'unpadded inference' is a bit unclear to me, but I suppose it corresponds to other configurations.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unpadded = Flash attention "varlen" (which means requests are stacked linearly without requiring padding tokens).

Padded:

input_ids = [
[3, 53, 63],
[0, 0, 234],
]

Unpadded:

input_ids = [3, 53, 63, 234] + [0, 3, 4] (seqlengths)

Copy link
Collaborator

@Narsil Narsil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look much better thana my PR

@Narsil Narsil merged commit 5321463 into main Feb 9, 2024
@Narsil Narsil deleted the feat/max_batch_size branch February 9, 2024 11:38
kdamaszk pushed a commit to kdamaszk/tgi-gaudi that referenced this pull request Apr 29, 2024
Some hardware require a maximum batch size.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants