From e7a056974510c3ccf5a2d9219e8de51707274e68 Mon Sep 17 00:00:00 2001 From: 51616 Date: Wed, 29 Jan 2025 15:25:07 +0000 Subject: [PATCH] fix attention mask flash attn perceiver --- src/ctx_to_lora/modeling_idefics2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ctx_to_lora/modeling_idefics2.py b/src/ctx_to_lora/modeling_idefics2.py index 72016a5..c3d30b8 100644 --- a/src/ctx_to_lora/modeling_idefics2.py +++ b/src/ctx_to_lora/modeling_idefics2.py @@ -663,6 +663,7 @@ class Idefics2PerceiverResampler(Idefics2PreTrainedModel): seq_lens_k = attention_mask.sum(dim=-1, dtype=torch.int32) cu_seq_lens_k = torch.cumsum(seq_lens_k, dim=0, dtype=torch.int32) max_length_k = seq_lens_k.max().item() + cu_seq_lens_k = nn.functional.pad(cu_seq_lens_k, (1, 0)) elif position_ids is not None: logger.warning_once("Using position ids for resampler")