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 15, 04:45 UTC
use .dev for version comparison with pytorch nightly release (#20031)
Signed-off-by: Boyuan Feng <boyuan@meta.com>
Boyuan Feng committed
Jun 24, 2025 at 14:52 UTC
c01d1c5aba3783f4356ce59e637794870e7ad2d4
4 files changed
+19
-5
tests/compile/test_config.py
+9
@@ -5,6 +5,15 @@ import pytest
5
import vllm
6
from vllm.compilation.counter import compilation_counter
7
from vllm.config import VllmConfig
8
+from vllm.utils import _is_torch_equal_or_newer
9
+
10
+
11
+def test_version():
12
+ assert _is_torch_equal_or_newer('2.8.0.dev20250624+cu128', '2.8.0.dev')
13
+ assert _is_torch_equal_or_newer('2.8.0a0+gitc82a174', '2.8.0.dev')
14
+ assert _is_torch_equal_or_newer('2.8.0', '2.8.0.dev')
15
+ assert _is_torch_equal_or_newer('2.8.1', '2.8.0.dev')
16
+ assert not _is_torch_equal_or_newer('2.7.1', '2.8.0.dev')
17
18
19
def test_use_cudagraphs_dynamic(monkeypatch):
vllm/compilation/backends.py
+1
-1
@@ -32,7 +32,7 @@ logger = init_logger(__name__)
32
def make_compiler(compilation_config: CompilationConfig) -> CompilerInterface:
33
if compilation_config.use_inductor:
34
if envs.VLLM_USE_STANDALONE_COMPILE and is_torch_equal_or_newer(
35
- "2.8.0a"):
35
+ "2.8.0.dev"):
36
logger.debug("Using InductorStandaloneAdaptor")
37
return InductorStandaloneAdaptor()
38
else:
vllm/model_executor/layers/quantization/torchao.py
+2
-2
@@ -44,14 +44,14 @@ class TorchAOConfig(QuantizationConfig):
44
"""
45
# TorchAO quantization relies on tensor subclasses. In order,
46
# to enable proper caching this needs standalone compile
47
- if is_torch_equal_or_newer("2.8.0a"):
47
+ if is_torch_equal_or_newer("2.8.0.dev"):
48
os.environ["VLLM_TEST_STANDALONE_COMPILE"] = "1"
49
logger.info(
50
"Using TorchAO: Setting VLLM_TEST_STANDALONE_COMPILE=1")
51
52
# TODO: remove after the torch dependency is updated to 2.8
53
if is_torch_equal_or_newer(
54
- "2.7.0") and not is_torch_equal_or_newer("2.8.0a"):
54
+ "2.7.0") and not is_torch_equal_or_newer("2.8.0.dev"):
55
os.environ["VLLM_DISABLE_COMPILE_CACHE"] = "1"
56
logger.info("Using TorchAO: Setting VLLM_DISABLE_COMPILE_CACHE=1")
57
"""
vllm/utils.py
+7
-2
@@ -2919,8 +2919,13 @@ def is_torch_equal_or_newer(target: str) -> bool:
2919
Whether the condition meets.
2920
"""
2921
try:
2922
- torch_version = version.parse(str(torch.__version__))
2923
- return torch_version >= version.parse(target)
2922
+ return _is_torch_equal_or_newer(str(torch.__version__), target)
2923
except Exception:
2924
# Fallback to PKG-INFO to load the package info, needed by the doc gen.
2925
return Version(importlib.metadata.version('torch')) >= Version(target)
2926
+
2927
+
2928
+# Helper function used in testing.
2929
+def _is_torch_equal_or_newer(torch_version: str, target: str) -> bool:
2930
+ torch_version = version.parse(torch_version)
2931
+ return torch_version >= version.parse(target)