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

Enable Flash Attention #1065

Merged
merged 24 commits into from
Jan 14, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix dtype
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
jiqing-feng committed Jan 14, 2025
commit 9211803eeb8269e3a50bc3a228df444621b24eff
2 changes: 1 addition & 1 deletion optimum/exporters/ipex/modeling_utils.py
Original file line number Diff line number Diff line change
@@ -655,7 +655,7 @@ def attention_interface(
elif self.has_flash_attn(query):
attn_output = torch.empty_like(query)
seq_len_tensor = torch.cat((input_lens.new_tensor([0]), input_lens.cumsum(-1).int()))
query_len_tensor = seq_len_tensor if past_len == 0 else torch.arange(seq_len_tensor.shape[0])
query_len_tensor = seq_len_tensor if past_len == 0 else torch.arange(seq_len_tensor.shape[0]).int()
query_max_len = input_lens.max() if past_len == 0 else 1
PagedAttention.flash_attn_varlen_func(
attn_output,