[Bugfix] Handle PackageNotFoundError when checking for xpu version (#7398)

This commit is contained in:
sasha0552 2024-08-12 23:07:20 +00:00 committed by GitHub
parent a046f86397
commit 91294d56e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -344,8 +344,11 @@ def is_tpu() -> bool:
@lru_cache(maxsize=None) @lru_cache(maxsize=None)
def is_xpu() -> bool: def is_xpu() -> bool:
from importlib.metadata import version from importlib.metadata import PackageNotFoundError, version
is_xpu_flag = "xpu" in version("vllm") try:
is_xpu_flag = "xpu" in version("vllm")
except PackageNotFoundError:
return False
# vllm is not build with xpu # vllm is not build with xpu
if not is_xpu_flag: if not is_xpu_flag:
return False return False