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

feat: support flash attention 2 in qwen2 vl vision blocks #2721

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

drbh
Copy link
Collaborator

@drbh drbh commented Nov 4, 2024

This PR adds support for flash attention within the vision blocks of qwen2vl. This improves latency and reduces spikes in memory usage from sdpa attention (helps avoid oom'ing on large images).

running

text-generation-launcher --model-id Qwen/Qwen2-VL-7B-Instruct

on a single L4's with a small model this has a ~5% perf improvement: prev: ~67ms per token current: ~63ms per token.

ps** it's likely the performance improvement scales with the size/number of layers however I have not benchmarked any larger models to measure the difference.

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.

1 participant