[Bug] Fix has_flashinfer_moe Import Error when it is not installed (#21634)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
Wentao Ye 2025-07-26 10:06:14 -04:00 committed by GitHub
parent 1cd6eaba54
commit c215f5c877
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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