File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 11import logging
2+ from typing import Callable , Optional , Union
23
34import vllm .envs as envs
45
@@ -29,3 +30,15 @@ def load_general_plugins():
2930 except Exception :
3031 logger .exception ("Failed to load general plugin: %s" ,
3132 plugin .name )
33+
34+
35+ _torch_compile_backend : Optional [Union [Callable , str ]] = None
36+
37+
38+ def set_torch_compile_backend (backend : Union [Callable , str ]):
39+ global _torch_compile_backend
40+ _torch_compile_backend = backend
41+
42+
43+ def get_torch_compile_backend () -> Optional [Union [Callable , str ]]:
44+ return _torch_compile_backend
Original file line number Diff line number Diff line change @@ -1064,10 +1064,12 @@ def load_model(self) -> None:
10641064 "This may lead to less accurate results!" )
10651065
10661066 if envs .VLLM_TEST_DYNAMO_GRAPH_CAPTURE and supports_dynamo ():
1067+ from vllm .plugins import get_torch_compile_backend
1068+ backend = get_torch_compile_backend () or "eager"
10671069 self .model = torch .compile (
10681070 self .model ,
10691071 fullgraph = envs .VLLM_TEST_DYNAMO_FULLGRAPH_CAPTURE ,
1070- backend = "eager" )
1072+ backend = backend )
10711073
10721074 def save_sharded_state (
10731075 self ,
You can’t perform that action at this time.
0 commit comments