[CPU] Fix rotary embedding for CPU without flash-attn ops (#42225)

Signed-off-by: jmamou <jonathan.mamou@intel.com>
Signed-off-by: Jonathan Mamou <jonathan.mamou@intel.com>
Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
This commit is contained in:
Jonathan Mamou
2026-05-12 15:05:35 +00:00
committed by GitHub
co-authored by Wentao Ye
parent a1b2d87498
commit c8a6e272e0
@@ -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