File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed
model_executor/layers/quantization Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 5
5
import vllm
6
6
from vllm .compilation .counter import compilation_counter
7
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' )
8
17
9
18
10
19
def test_use_cudagraphs_dynamic (monkeypatch ):
Original file line number Diff line number Diff line change 32
32
def make_compiler (compilation_config : CompilationConfig ) -> CompilerInterface :
33
33
if compilation_config .use_inductor :
34
34
if envs .VLLM_USE_STANDALONE_COMPILE and is_torch_equal_or_newer (
35
- "2.8.0a " ):
35
+ "2.8.0.dev " ):
36
36
logger .debug ("Using InductorStandaloneAdaptor" )
37
37
return InductorStandaloneAdaptor ()
38
38
else :
Original file line number Diff line number Diff line change @@ -44,14 +44,14 @@ def __init__(self,
44
44
"""
45
45
# TorchAO quantization relies on tensor subclasses. In order,
46
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
48
os.environ["VLLM_TEST_STANDALONE_COMPILE"] = "1"
49
49
logger.info(
50
50
"Using TorchAO: Setting VLLM_TEST_STANDALONE_COMPILE=1")
51
51
52
52
# TODO: remove after the torch dependency is updated to 2.8
53
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
55
os.environ["VLLM_DISABLE_COMPILE_CACHE"] = "1"
56
56
logger.info("Using TorchAO: Setting VLLM_DISABLE_COMPILE_CACHE=1")
57
57
"""
Original file line number Diff line number Diff line change @@ -2919,8 +2919,13 @@ def is_torch_equal_or_newer(target: str) -> bool:
2919
2919
Whether the condition meets.
2920
2920
"""
2921
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 )
2924
2923
except Exception :
2925
2924
# Fallback to PKG-INFO to load the package info, needed by the doc gen.
2926
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 )
You can’t perform that action at this time.
0 commit comments