-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Major Change][Undecided yet] Move to FlashDecoding instead of PagedAttention kernel. #1940
Merged
+222
−74
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4293a12
Using flash decoding
Narsil 66081e6
Making it work on non flash decoding.
Narsil b98b94d
Fix Cohere.
Narsil 988aa34
Fix non decoding paths.
Narsil 4f1b1a2
Rebased.
Narsil fcbc687
No need for cache_manager anymore.
Narsil 212a595
Update?
Narsil 5f38d79
"ipex" -> "cpu"
Narsil 65980ed
These do not belong.
Narsil 4b1364d
Factoring cu_seqlen_qk for better abstracting over every model.
Narsil a26e57f
Fixing non flash tests/imports.
Narsil 8fa8cda
Changing return everywhere.
Narsil 1bd5215
Update mistral past.
Narsil b686f66
Fixing Mi{s,x}tral (non functional in Flash Decoding mode though).
Narsil ef8bce0
Fixup mistral clamping (had issues with cuda graphs).
Narsil 1c7c21d
No need to recreate anything actually.
Narsil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Factoring cu_seqlen_qk for better abstracting over every model.
- Loading branch information
commit 4b1364da9204f948fdfb4ad68fbb40a17c68e345
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from dataclasses import dataclass | ||
from text_generation_server.models.globals import FLASH_DECODING | ||
import torch | ||
from typing import Optional | ||
|
||
|
||
@dataclass | ||
class Seqlen: | ||
input_lengths: torch.Tensor | ||
cu_seqlen_q: Optional[torch.Tensor] | ||
cu_seqlen_k: Optional[torch.Tensor] | ||
|
||
def __init__(self, input_lengths): | ||
self.input_lengths = input_lengths | ||
if FLASH_DECODING: | ||
device = self.input_lengths.device | ||
shape = self.input_lengths.shape | ||
cu_seqlen_q = torch.arange( | ||
shape[0] + 1, | ||
device=device, | ||
dtype=torch.int32, | ||
) | ||
cu_seqlen_k = torch.empty(shape[-1] + 1, device=device, dtype=torch.int32) | ||
cu_seqlen_k[0] = 0 | ||
torch.cumsum(self.input_lengths, -1, out=cu_seqlen_k[1:]) | ||
|
||
self.cu_seqlen_q = cu_seqlen_q | ||
self.cu_seqlen_k = cu_seqlen_k | ||
else: | ||
self.cu_seqlen_q = None | ||
self.cu_seqlen_k = None |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: this comment should move down to the paged attention version condition.