Skip to content

Continuous batching refactor#40426

Merged
ArthurZucker merged 27 commits into
huggingface:mainfrom
remi-or:conbat
Aug 26, 2025
Merged

Continuous batching refactor#40426
ArthurZucker merged 27 commits into
huggingface:mainfrom
remi-or:conbat

Conversation

@remi-or

@remi-or remi-or commented Aug 25, 2025

Copy link
Copy Markdown
Collaborator

This PR refactors the files related to continuous batching and changes a few parts of the logic:

  • the way the max_batch_tokens and num_blocks is computed;
  • the static inputs of the CB are now sliced to avoid passing an arbitrary amount of padding in the forward
  • the example file for CB has been reworked to allow for more parametrization

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice 🚀

Comment thread examples/pytorch/continuous_batching.py
Comment thread examples/pytorch/continuous_batching.py
Comment thread src/transformers/generation/continuous_batching/cache.py Outdated
Comment thread src/transformers/generation/continuous_batching/cache.py
Comment thread src/transformers/generation/continuous_batching/continuous_api.py Outdated
Comment thread src/transformers/generation/continuous_batching/core.py

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's go 🚀

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.

3 participants