From c8a6e272e0d3994f299ae522975514fcd98b7c76 Mon Sep 17 00:00:00 2001 From: Jonathan Mamou Date: Tue, 12 May 2026 18:05:35 +0300 Subject: [PATCH] [CPU] Fix rotary embedding for CPU without flash-attn ops (#42225) Signed-off-by: jmamou Signed-off-by: Jonathan Mamou Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com> --- vllm/model_executor/layers/rotary_embedding/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vllm/model_executor/layers/rotary_embedding/common.py b/vllm/model_executor/layers/rotary_embedding/common.py index e0576ee8e4..2e407ae715 100644 --- a/vllm/model_executor/layers/rotary_embedding/common.py +++ b/vllm/model_executor/layers/rotary_embedding/common.py @@ -8,6 +8,7 @@ import torch from vllm.logger import init_logger from vllm.model_executor.custom_op import CustomOp +from vllm.platforms import current_platform from vllm.utils.torch_utils import direct_register_custom_op logger = init_logger(__name__) @@ -134,7 +135,7 @@ class ApplyRotaryEmb(CustomOp): self.enable_fp32_compute = enable_fp32_compute self.apply_rotary_emb_flash_attn = None - if find_spec("flash_attn") is not None: + if not current_platform.is_cpu() and find_spec("flash_attn") is not None: from flash_attn.ops.triton.rotary import apply_rotary self.apply_rotary_emb_flash_attn = apply_rotary