Unverified Commit 5c2acb27 authored by Lukas Geiger's avatar Lukas Geiger Committed by GitHub
Browse files

[Models][QwenVL] Remove unnecessary `.contiguous()` calls (#27106)


Signed-off-by: default avatarLukas Geiger <lukas.geiger94@gmail.com>
parent b26b70be
...@@ -396,7 +396,7 @@ class Qwen2_5_VisionAttention(nn.Module): ...@@ -396,7 +396,7 @@ class Qwen2_5_VisionAttention(nn.Module):
q, k, v = self.split_qkv(x) q, k, v = self.split_qkv(x)
batch_size = q.shape[1] batch_size = q.shape[1]
q, k, v = (rearrange(x, "s b ... -> b s ...").contiguous() for x in (q, k, v)) q, k, v = (rearrange(x, "s b ... -> b s ...") for x in (q, k, v))
if rotary_pos_emb is not None: if rotary_pos_emb is not None:
# [2 * b, s, heads, head_dim] # [2 * b, s, heads, head_dim]
qk_concat = torch.cat([q, k], dim=0) qk_concat = torch.cat([q, k], dim=0)
......
...@@ -423,7 +423,7 @@ class Qwen2VisionAttention(nn.Module): ...@@ -423,7 +423,7 @@ class Qwen2VisionAttention(nn.Module):
q, k, v = self.split_qkv(x) q, k, v = self.split_qkv(x)
batch_size = q.shape[1] batch_size = q.shape[1]
q, k, v = (rearrange(x, "s b ... -> b s ...").contiguous() for x in (q, k, v)) q, k, v = (rearrange(x, "s b ... -> b s ...") for x in (q, k, v))
if rotary_pos_emb is not None: if rotary_pos_emb is not None:
# [2 * b, s, heads, head_dim] # [2 * b, s, heads, head_dim]
qk_concat = torch.cat([q, k], dim=0) qk_concat = torch.cat([q, k], dim=0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment