From 7d3b7c87f501a959e2e5b5f4c3170b35194789f9 Mon Sep 17 00:00:00 2001 From: Yineng Zhang Date: Sat, 12 Apr 2025 19:59:13 -0700 Subject: [PATCH] fix: determine if flashinfer is installed (#5336) --- python/sglang/srt/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/utils.py b/python/sglang/srt/utils.py index e9740992f..4a68dce74 100644 --- a/python/sglang/srt/utils.py +++ b/python/sglang/srt/utils.py @@ -16,6 +16,7 @@ import base64 import builtins import ctypes import dataclasses +import importlib import io import ipaddress import itertools @@ -127,7 +128,7 @@ def is_flashinfer_available(): """ if not get_bool_env_var("SGLANG_IS_FLASHINFER_AVAILABLE", default="true"): return False - return is_cuda() + return importlib.util.find_spec("flashinfer") is not None and is_cuda() def is_cuda_available():