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