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 55import vllm
66from vllm .compilation .counter import compilation_counter
77from 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' )
817
918
1019def test_use_cudagraphs_dynamic (monkeypatch ):
Original file line number Diff line number Diff line change 3232def make_compiler (compilation_config : CompilationConfig ) -> CompilerInterface :
3333 if compilation_config .use_inductor :
3434 if envs .VLLM_USE_STANDALONE_COMPILE and is_torch_equal_or_newer (
35- "2.8.0a " ):
35+ "2.8.0.dev " ):
3636 logger .debug ("Using InductorStandaloneAdaptor" )
3737 return InductorStandaloneAdaptor ()
3838 else :
Original file line number Diff line number Diff line change @@ -44,14 +44,14 @@ def __init__(self,
4444 """
4545 # TorchAO quantization relies on tensor subclasses. In order,
4646 # 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 "):
4848 os.environ["VLLM_TEST_STANDALONE_COMPILE"] = "1"
4949 logger.info(
5050 "Using TorchAO: Setting VLLM_TEST_STANDALONE_COMPILE=1")
5151
5252 # TODO: remove after the torch dependency is updated to 2.8
5353 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 "):
5555 os.environ["VLLM_DISABLE_COMPILE_CACHE"] = "1"
5656 logger.info("Using TorchAO: Setting VLLM_DISABLE_COMPILE_CACHE=1")
5757 """
Original file line number Diff line number Diff line change @@ -2919,8 +2919,13 @@ def is_torch_equal_or_newer(target: str) -> bool:
29192919 Whether the condition meets.
29202920 """
29212921 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 )
29242923 except Exception :
29252924 # Fallback to PKG-INFO to load the package info, needed by the doc gen.
29262925 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