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
3194039c
Unverified
Commit
3194039c
authored
Feb 01, 2025
by
Michael Goin
Committed by
GitHub
Feb 01, 2025
Browse files
Apply torch.compile to fused_moe/grouped_topk (#12637)
parent
4f4d427a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
vllm/model_executor/layers/fused_moe/fused_moe.py
vllm/model_executor/layers/fused_moe/fused_moe.py
+1
-0
vllm/model_executor/models/deepseek_v3.py
vllm/model_executor/models/deepseek_v3.py
+2
-2
No files found.
vllm/model_executor/layers/fused_moe/fused_moe.py
View file @
3194039c
...
@@ -759,6 +759,7 @@ def fused_topk(
...
@@ -759,6 +759,7 @@ def fused_topk(
# This is used by the Deepseek-V2 and Deepseek-V3 model
# This is used by the Deepseek-V2 and Deepseek-V3 model
@
torch
.
compile
(
dynamic
=
True
,
backend
=
current_platform
.
simple_compile_backend
)
def
grouped_topk
(
hidden_states
:
torch
.
Tensor
,
def
grouped_topk
(
hidden_states
:
torch
.
Tensor
,
gating_output
:
torch
.
Tensor
,
gating_output
:
torch
.
Tensor
,
topk
:
int
,
topk
:
int
,
...
...
vllm/model_executor/models/deepseek_v3.py
View file @
3194039c
...
@@ -27,6 +27,7 @@ from torch import nn
...
@@ -27,6 +27,7 @@ from torch import nn
from
transformers
import
PretrainedConfig
from
transformers
import
PretrainedConfig
from
vllm.attention
import
Attention
,
AttentionMetadata
from
vllm.attention
import
Attention
,
AttentionMetadata
from
vllm.compilation.decorators
import
support_torch_compile
from
vllm.config
import
CacheConfig
,
ModelConfig
,
VllmConfig
from
vllm.config
import
CacheConfig
,
ModelConfig
,
VllmConfig
from
vllm.distributed
import
(
get_pp_group
,
from
vllm.distributed
import
(
get_pp_group
,
get_tensor_model_parallel_world_size
,
get_tensor_model_parallel_world_size
,
...
@@ -566,8 +567,7 @@ class DeepseekV3DecoderLayer(nn.Module):
...
@@ -566,8 +567,7 @@ class DeepseekV3DecoderLayer(nn.Module):
return
hidden_states
,
residual
return
hidden_states
,
residual
# TODO(simon): check whether we support torch compile for Deepseek V3
@
support_torch_compile
# @support_torch_compile
class
DeepseekV3Model
(
nn
.
Module
):
class
DeepseekV3Model
(
nn
.
Module
):
fall_back_to_pt_during_load
=
False
fall_back_to_pt_during_load
=
False
...
...
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