Skip to content

Commit ece5a8b

Browse files
authored
Make the _apply_rotary_emb compatible with dynamo (#17435)
1 parent 54072f3 commit ece5a8b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vllm/model_executor/layers/rotary_embedding.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
from vllm.model_executor.custom_op import CustomOp
3333
from vllm.platforms import current_platform
3434

35+
if current_platform.is_cuda_alike():
36+
from vllm.vllm_flash_attn.layers.rotary import apply_rotary_emb
37+
3538

3639
def _rotate_neox(x: torch.Tensor) -> torch.Tensor:
3740
x1 = x[..., :x.shape[-1] // 2]
@@ -78,7 +81,6 @@ def _apply_rotary_emb(x: torch.Tensor, cos: torch.Tensor, sin: torch.Tensor,
7881
positional embeddings.
7982
"""
8083
if current_platform.is_cuda_alike():
81-
from vllm.vllm_flash_attn.layers.rotary import apply_rotary_emb
8284
return apply_rotary_emb(x.unsqueeze(0), cos, sin,
8385
not is_neox_style).squeeze(0)
8486
else:

0 commit comments

Comments
 (0)