Replace pad with cat for better performance (#11388)

Co-authored-by: luoyuan.luo <luoyuan.luo@antgroup.com>
This commit is contained in:
Yuan Luo
2025-10-10 12:03:17 +08:00
committed by GitHub
co-authored by luoyuan.luo
parent 70fbb3adf6
commit b5044fbf12
5 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -458,7 +458,7 @@ class Qwen3_VisionTransformer(nn.Module):
(grid_thw[:, 0] * grid_thw[:, 1] * grid_thw[:, 2]).cumsum(dim=0),
]
)
cu_seqlens = F.pad(cu_seqlens, (1, 0), "constant", 0)
cu_seqlens = torch.cat([cu_seqlens.new_zeros(1), cu_seqlens])
# max_seqlen, seqlens = self.compute_attn_mask_seqlen(cu_seqlens)
x = x.unsqueeze(1)