Skip to content

feat: add sliding window attention to Continuous Batching#39225

Closed
McPatate wants to merge 8 commits into
mainfrom
feat/add_sliding_window_attn
Closed

feat: add sliding window attention to Continuous Batching#39225
McPatate wants to merge 8 commits into
mainfrom
feat/add_sliding_window_attn

Conversation

@McPatate

@McPatate McPatate commented Jul 4, 2025

Copy link
Copy Markdown
Member

What does this PR do?

Adds Sliding Window Attention to Continuous Batching

@McPatate McPatate requested a review from ArthurZucker July 4, 2025 15:10
@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.

Starting to look good!

@classmethod
def setUpClass(cls):
cls.model_name = "mistralai/Mistral-7B-v0.1"
cls.model = MistralForCausalLM.from_pretrained(

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.

AutoModel would be better here with a list of models that have idfferent attention patterns!

@McPatate McPatate force-pushed the feat/add_sliding_window_attn branch 3 times, most recently from 415df66 to e50c56c Compare August 1, 2025 14:43
@github-actions

github-actions Bot commented Aug 1, 2025

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: gemma2

@McPatate McPatate force-pushed the feat/add_sliding_window_attn branch from e50c56c to b6de5bc Compare August 1, 2025 14:54
for state in self.active_requests.values():
if state.status == RequestStatus.SPLIT_PENDING_REMAINDER:
# XXX: when cache is full (len(self.cache._free_blocks) == 0), state can stay on `PREFILLING_SPLIT` we need to take those into account
if state.status in [RequestStatus.PREFILLING_SPLIT, RequestStatus.SPLIT_PENDING_REMAINDER]:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@remi-or don't forget to port this line in your new SWA PR

@ArthurZucker

Copy link
Copy Markdown
Collaborator

Superseeded by #40688

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