Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
96216678
Unverified
Commit
96216678
authored
Feb 19, 2025
by
Alex Brooks
Committed by
GitHub
Feb 20, 2025
Browse files
[Misc] Warn if the vLLM version can't be retrieved (#13501)
Signed-off-by:
Alex-Brooks
<
Alex.brooks@ibm.com
>
parent
8c755c3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
vllm/platforms/__init__.py
vllm/platforms/__init__.py
+20
-10
No files found.
vllm/platforms/__init__.py
View file @
96216678
...
...
@@ -2,6 +2,7 @@
import
logging
import
traceback
from
contextlib
import
suppress
from
itertools
import
chain
from
typing
import
TYPE_CHECKING
,
Optional
...
...
@@ -14,6 +15,21 @@ from .interface import CpuArchEnum, Platform, PlatformEnum
logger
=
logging
.
getLogger
(
__name__
)
def
vllm_version_matches_substr
(
substr
:
str
)
->
bool
:
"""
Check to see if the vLLM version matches a substring.
"""
from
importlib.metadata
import
PackageNotFoundError
,
version
try
:
vllm_version
=
version
(
"vllm"
)
except
PackageNotFoundError
as
e
:
logger
.
warning
(
"The vLLM package was not found, so its version could not be "
"inspected. This may cause platform detection to fail."
)
raise
e
return
substr
in
vllm_version
def
tpu_platform_plugin
()
->
Optional
[
str
]:
is_tpu
=
False
try
:
...
...
@@ -33,8 +49,6 @@ def cuda_platform_plugin() -> Optional[str]:
is_cuda
=
False
try
:
from
importlib.metadata
import
version
from
vllm.utils
import
import_pynvml
pynvml
=
import_pynvml
()
pynvml
.
nvmlInit
()
...
...
@@ -45,7 +59,7 @@ def cuda_platform_plugin() -> Optional[str]:
# Otherwise, vllm will always activate cuda plugin
# on a GPU machine, even if in a cpu build.
is_cuda
=
(
pynvml
.
nvmlDeviceGetCount
()
>
0
and
"cpu"
not
in
version
(
"vllm
"
))
and
not
vllm_version_matches_substr
(
"cpu
"
))
finally
:
pynvml
.
nvmlShutdown
()
except
Exception
as
e
:
...
...
@@ -113,8 +127,7 @@ def xpu_platform_plugin() -> Optional[str]:
def
cpu_platform_plugin
()
->
Optional
[
str
]:
is_cpu
=
False
try
:
from
importlib.metadata
import
version
is_cpu
=
"cpu"
in
version
(
"vllm"
)
is_cpu
=
vllm_version_matches_substr
(
"cpu"
)
if
not
is_cpu
:
import
platform
is_cpu
=
platform
.
machine
().
lower
().
startswith
(
"arm"
)
...
...
@@ -138,11 +151,8 @@ def neuron_platform_plugin() -> Optional[str]:
def
openvino_platform_plugin
()
->
Optional
[
str
]:
is_openvino
=
False
try
:
from
importlib.metadata
import
version
is_openvino
=
"openvino"
in
version
(
"vllm"
)
except
Exception
:
pass
with
suppress
(
Exception
):
is_openvino
=
vllm_version_matches_substr
(
"openvino"
)
return
"vllm.platforms.openvino.OpenVinoPlatform"
if
is_openvino
else
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment