feat: err when unsupported attn impl is set w/ --continuous_batching#40618
Merged
feat: err when unsupported attn impl is set w/ --continuous_batching#40618
--continuous_batching#40618Conversation
a1e18b1 to
11c5581
Compare
|
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. |
LysandreJik
reviewed
Sep 3, 2025
Member
LysandreJik
left a comment
There was a problem hiding this comment.
Nice! Please add a test :)
457baa5 to
a8a0fca
Compare
Member
Author
|
Will add more advanced tests in CB later to test that the returned list of attention implementations is indeed compatible. |
a8a0fca to
a2b348d
Compare
ArthurZucker
reviewed
Sep 8, 2025
Comment on lines
+486
to
+498
| if self.use_continuous_batching: | ||
| default_attn_impl = ContinuousBatchingManager.default_attention_implementation() | ||
| # checking if attn_implementation is supported by continuous batching | ||
| if self.args.attn_implementation is None: | ||
| self.args.attn_implementation = default_attn_impl # default to sdpa_paged | ||
| logger.info(f"No attn_implementation passed, defaulting to {default_attn_impl}") | ||
| supported_attn_impl = ContinuousBatchingManager.supported_attention_implementations() | ||
| if self.args.attn_implementation not in supported_attn_impl: | ||
| raise ValueError( | ||
| f"Continuous batching only supports {supported_attn_impl} as attn_implementation, got " | ||
| f"{self.args.attn_implementation}" | ||
| f"Try setting `--attn_implementation={default_attn_impl}`" | ||
| ) |
Collaborator
There was a problem hiding this comment.
wdy about putting this directly in CB's api? would be better in general + we can automatically add paged_{attn_implememntation} no?
ArthurZucker
approved these changes
Sep 8, 2025
Comment on lines
+492
to
+494
| supported_attn_impl = ContinuousBatchingManager.supported_attention_implementations() | ||
| if self.args.attn_implementation not in supported_attn_impl: | ||
| raise ValueError( |
Collaborator
There was a problem hiding this comment.
here if attn impelmeention not supported, you can try to map it to the correct ones?
Because for sdpa eager and flash, its easy to map: prefix with paged|
But up to you !
vijayabhaskar-ev
pushed a commit
to vijayabhaskar-ev/transformers
that referenced
this pull request
Oct 2, 2025
huggingface#40618) * feat: err when unsupported attn impl is set w/ `--continuous_batching` * refactor: move defaults and support list to CB code * feat: add action item in error msg * fix(serve): add default attn implementation * feat(serve): add log when `attn_implementation` is `None` * feat: raise Exception when attn_implementation is not supported by CB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #40479, we introduced a new
--continuous_batchingflag. Here we add a check to make sure the--attn_implementationis compatible with CB and error when not.