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
0a4806f0
"vscode:/vscode.git/clone" did not exist on "a257d9bccc818cf826311ff03fbf5b46666321f1"
Unverified
Commit
0a4806f0
authored
Sep 13, 2024
by
youkaichao
Committed by
GitHub
Sep 13, 2024
Browse files
[plugin][torch.compile] allow to add custom compile backend (#8445)
parent
ecd7a1d5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
vllm/plugins/__init__.py
vllm/plugins/__init__.py
+13
-0
vllm/worker/model_runner.py
vllm/worker/model_runner.py
+3
-1
No files found.
vllm/plugins/__init__.py
View file @
0a4806f0
import
logging
from
typing
import
Callable
,
Optional
,
Union
import
vllm.envs
as
envs
...
...
@@ -29,3 +30,15 @@ def load_general_plugins():
except
Exception
:
logger
.
exception
(
"Failed to load general plugin: %s"
,
plugin
.
name
)
_torch_compile_backend
:
Optional
[
Union
[
Callable
,
str
]]
=
None
def
set_torch_compile_backend
(
backend
:
Union
[
Callable
,
str
]):
global
_torch_compile_backend
_torch_compile_backend
=
backend
def
get_torch_compile_backend
()
->
Optional
[
Union
[
Callable
,
str
]]:
return
_torch_compile_backend
vllm/worker/model_runner.py
View file @
0a4806f0
...
...
@@ -1064,10 +1064,12 @@ class GPUModelRunnerBase(ModelRunnerBase[TModelInputForGPU]):
"This may lead to less accurate results!"
)
if
envs
.
VLLM_TEST_DYNAMO_GRAPH_CAPTURE
and
supports_dynamo
():
from
vllm.plugins
import
get_torch_compile_backend
backend
=
get_torch_compile_backend
()
or
"eager"
self
.
model
=
torch
.
compile
(
self
.
model
,
fullgraph
=
envs
.
VLLM_TEST_DYNAMO_FULLGRAPH_CAPTURE
,
backend
=
"eager"
)
backend
=
backend
)
def
save_sharded_state
(
self
,
...
...
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