Skip to content
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

[FIX] Make flash_attn optional #3269

Merged
merged 5 commits into from
Mar 8, 2024
Merged

[FIX] Make flash_attn optional #3269

merged 5 commits into from
Mar 8, 2024

Conversation

WoosukKwon
Copy link
Collaborator

@WoosukKwon WoosukKwon commented Mar 8, 2024

The FlashAttention backend introduced in #3005 causes build errors in some environments and increase the package size significantly (44 MB -> 160 MB) as the vLLM package now includes the flash-attn (116 MB) package. This PR addresses this by removing flash_attn from vLLM's dependency and enables falling back to xFormers when flash_attn is not found.

@WoosukKwon WoosukKwon changed the title Revert "Separate attention backends (#3005)" Temporarily remove FlashAttention backend Mar 8, 2024
@chenxu2048
Copy link
Contributor

Hi @WoosukKwon, why you revert your refraction in #3005?

Copy link
Collaborator

@zhuohan123 zhuohan123 left a comment

Choose a reason for hiding this comment

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

Probably we can just use a flag to turn flash_attn off instead of deleting everything? What do you think?

@AlpinDale
Copy link

AlpinDale commented Mar 8, 2024

I think it would be safe to simply disable the flash attention backend if flash_attn is not installed - until a more elegant solution is found, at least. Uers can be prompted to manually install flash attention if needed.

@WoosukKwon
Copy link
Collaborator Author

@zhuohan123 @AlpinDale Thanks for the suggestion. Just updated the PR accordingly. Please take another look.

@WoosukKwon WoosukKwon changed the title Temporarily remove FlashAttention backend Fall back to xFormers when flash_attn is not found Mar 8, 2024
@WoosukKwon WoosukKwon changed the title Fall back to xFormers when flash_attn is not found [FIX] Make flash_attn optional Mar 8, 2024
@mgoin
Copy link
Collaborator

mgoin commented Mar 8, 2024

Thank you @WoosukKwon, I tested this on a few environments and this restored the original behavior for me.

Copy link
Collaborator

@zhuohan123 zhuohan123 left a comment

Choose a reason for hiding this comment

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

LGTM! Do you wanna keep the downloading logic as well?

@WoosukKwon
Copy link
Collaborator Author

@zhuohan123 Let's remove it for this fix and bring it back once we find a more stable way to do it.

@WoosukKwon WoosukKwon merged commit 1cb0cc2 into main Mar 8, 2024
23 checks passed
@WoosukKwon WoosukKwon deleted the revert-fa branch March 8, 2024 18:52
AdrianAbeyta pushed a commit to ROCm/vllm that referenced this pull request Mar 8, 2024
joerunde pushed a commit to IBM/vllm that referenced this pull request Mar 11, 2024
joerunde pushed a commit to IBM/vllm that referenced this pull request Mar 11, 2024
Cherry-picked from vllm-project/vllm#3269

Signed-off-by: Joe Runde <Joseph.Runde@ibm.com>
joerunde pushed a commit to IBM/vllm that referenced this pull request Mar 11, 2024
joerunde pushed a commit to IBM/vllm that referenced this pull request Mar 11, 2024
Signed-off-by: Joe Runde <Joseph.Runde@ibm.com>
joerunde pushed a commit to IBM/vllm that referenced this pull request Mar 12, 2024
Signed-off-by: Joe Runde <Joseph.Runde@ibm.com>
dtransposed pushed a commit to afeldman-nm/vllm that referenced this pull request Mar 26, 2024
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.

None yet

5 participants