@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / c9b506dad4
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 17, 03:00 UTC

[BugFix] Use different mechanism to get vllm version in `is_cpu()` (#3804)

Nick Hill committed Apr 2, 2024 at 23:06 UTC c9b506dad43c1439fd9aa5c1dd358d03967a7790
1 file changed +5 -3
vllm/utils.py
+5 -3
@@ -119,9 +119,11 @@ def is_hip() -> bool:
119
120 @lru_cache(maxsize=None)
121 def is_cpu() -> bool:
122 - from importlib.metadata import version
123 - is_cpu_flag = "cpu" in version("vllm")
124 - return is_cpu_flag
122 + from importlib.metadata import PackageNotFoundError, version
123 + try:
124 + return "cpu" in version("vllm")
125 + except PackageNotFoundError:
126 + return False
127
128
129 @lru_cache(maxsize=None)