From c215f5c877e0518f328613a98f31bb9cdb32a889 Mon Sep 17 00:00:00 2001 From: Wentao Ye <44945378+yewentao256@users.noreply.github.com> Date: Sat, 26 Jul 2025 10:06:14 -0400 Subject: [PATCH] [Bug] Fix `has_flashinfer_moe` Import Error when it is not installed (#21634) Signed-off-by: yewentao256 --- vllm/utils/flashinfer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vllm/utils/flashinfer.py b/vllm/utils/flashinfer.py index b25e3a49f1812..ebc54fd029da6 100644 --- a/vllm/utils/flashinfer.py +++ b/vllm/utils/flashinfer.py @@ -82,7 +82,8 @@ autotune = _lazy_import_wrapper( @functools.cache def has_flashinfer_moe() -> bool: """Return ``True`` if FlashInfer MoE module is available.""" - return importlib.util.find_spec("flashinfer.fused_moe") is not None + return has_flashinfer() and importlib.util.find_spec( + "flashinfer.fused_moe") is not None @functools.cache