[ROCm] Bugfix wan22 (#3463)

Signed-off-by: tjtanaa <tunjian.tan@embeddedllm.com>
This commit is contained in:
TJian authored and GitHub committed 2026-05-13 20:50:57 +08:00
1 parent 2e8e3057bc
commit b9cb57b631
4 files changed
+83 -3

No files matched your search

+32 -1
View File
@@ -204,7 +204,38 @@ class RotaryEmbeddingWan(RotaryEmbedding):
cos: torch.Tensor,
sin: torch.Tensor,
) -> torch.Tensor:
return self.forward_native(x, cos, sin)
from vllm.vllm_flash_attn.layers.rotary import apply_rotary_emb
if cos.dim() > 2:
cos = cos.reshape(-1, cos.shape[-1])
sin = sin.reshape(-1, sin.shape[-1])
return apply_rotary_emb(
x,
cos,
sin,
interleaved=self.interleaved,
)
def forward_hip(
self,
x: torch.Tensor,
cos: torch.Tensor,
sin: torch.Tensor,
) -> torch.Tensor:
if self.apply_rotary_emb_flash_attn is None:
return self.forward_native(x, cos, sin)
if cos.dim() > 2:
cos = cos.reshape(-1, cos.shape[-1])
sin = sin.reshape(-1, sin.shape[-1])
return self.apply_rotary_emb_flash_attn(
x,
cos,
sin,
interleaved=self.interleaved,
)
def forward_npu(
self,