-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Remove Vision FA warning #18522
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
Open
vrdn-23
wants to merge
6
commits into
vllm-project:main
Choose a base branch
from
vrdn-23:vrdn/remove-vllm-flash-attn-warning
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Remove Vision FA warning #18522
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fed1ab6
Remove warning and use vllm flash attn
vrdn-23 ccbbe75
Fix backend check
vrdn-23 8034253
Fix forward flash attn call
vrdn-23 396643d
Fix import for vllm_flash_attn
vrdn-23 37e7446
Fix how max seq len is calculate
vrdn-23 9465afa
Try with flash attn
vrdn-23 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
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -329,6 +329,24 @@ | |||||
|
||||||
q, k, v = (rearrange(x, "b s ... -> (b s) ...") for x in [q, k, v]) | ||||||
|
||||||
output = flash_attn_varlen_func(q, | ||||||
k, | ||||||
v, | ||||||
cu_seqlens_q=cu_seqlens, | ||||||
cu_seqlens_k=cu_seqlens, | ||||||
max_seqlen_q=max_seqlen, | ||||||
max_seqlen_k=max_seqlen, | ||||||
dropout_p=0, | ||||||
causal=False) | ||||||
|
||||||
context_layer = rearrange(output, | ||||||
"(b s) ... -> b s ...", | ||||||
b=batch_size) | ||||||
elif self.attn_backend == _Backend.FLASH_ATTN_VLLM_V1: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
from vllm.vllm_flash_attn.flash_attn_interface import flash_attn_varlen_func | ||||||
|
||||||
q, k, v = (rearrange(x, "b s ... -> (b s) ...") for x in [q, k, v]) | ||||||
|
||||||
output = flash_attn_varlen_func(q, | ||||||
k, | ||||||
v, | ||||||
|
@@ -618,7 +636,7 @@ | |||||
self, cu_seqlens: torch.Tensor | ||||||
) -> tuple[Optional[int], Optional[list[int]]]: | ||||||
max_seqlen, seqlens = None, None | ||||||
if self.attn_backend == _Backend.FLASH_ATTN: | ||||||
if self.attn_backend == [_Backend.FLASH_ATTN, _Backend.FLASH_ATTN_VLLM_V1]: | ||||||
max_seqlen = (cu_seqlens[1:] - cu_seqlens[:-1]).max().item() | ||||||
elif self.attn_backend == _Backend.XFORMERS: | ||||||
seqlens = (cu_seqlens[1:] - cu_seqlens[:-1]).tolist() | ||||||
|
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
Oops, something went wrong.
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.
If
flash_attn_varlen_func
fromvllm-flash-attn
can work well, we can remove original FA implementation as well.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.
Should we keep original FA implementation for other platform like ROCm which do not support FA through
vllm-flash-attn
?