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
7e71c143
Commit
7e71c143
authored
Aug 05, 2025
by
王敏
Browse files
[feat]优化mtp相关函数返回类型
parent
8e0ae19d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
vllm/v1/spec_decode/eagle.py
vllm/v1/spec_decode/eagle.py
+2
-2
vllm/v1/worker/gpu_model_runner.py
vllm/v1/worker/gpu_model_runner.py
+2
-1
No files found.
vllm/v1/spec_decode/eagle.py
View file @
7e71c143
...
@@ -107,7 +107,7 @@ class EagleProposer:
...
@@ -107,7 +107,7 @@ class EagleProposer:
num_rejected_tokens
:
list
[
int
],
num_rejected_tokens
:
list
[
int
],
# [batch_size]
# [batch_size]
sampling_metadata
:
SamplingMetadata
sampling_metadata
:
SamplingMetadata
)
->
torch
.
Tensor
:
)
->
tuple
[
torch
.
Tensor
,
torch
.
Tensor
]
:
num_tokens
=
target_token_ids
.
shape
[
0
]
num_tokens
=
target_token_ids
.
shape
[
0
]
batch_size
=
next_token_ids
.
shape
[
0
]
batch_size
=
next_token_ids
.
shape
[
0
]
last_token_indices
=
cu_num_tokens
[
1
:]
-
1
last_token_indices
=
cu_num_tokens
[
1
:]
-
1
...
@@ -240,7 +240,7 @@ class EagleProposer:
...
@@ -240,7 +240,7 @@ class EagleProposer:
# Early exit if there is only one draft token to be generated.
# Early exit if there is only one draft token to be generated.
if
self
.
num_speculative_tokens
==
1
:
if
self
.
num_speculative_tokens
==
1
:
# [batch_size, 1]
# [batch_size, 1]
return
draft_token_ids
.
view
(
-
1
,
1
),
draft_prob
s_list
return
draft_token_ids
.
view
(
-
1
,
1
),
draft_prob
.
view
(
-
1
,
1
,
draft_prob
.
shape
[
-
1
])
# TODO: Currently, MTP module released by deepseek only has
# TODO: Currently, MTP module released by deepseek only has
# one layer. Adapt this code to support multiple layers once
# one layer. Adapt this code to support multiple layers once
...
...
vllm/v1/worker/gpu_model_runner.py
View file @
7e71c143
...
@@ -1600,7 +1600,8 @@ class GPUModelRunner(LoRAModelRunnerMixin):
...
@@ -1600,7 +1600,8 @@ class GPUModelRunner(LoRAModelRunnerMixin):
aux_hidden_states
:
Optional
[
torch
.
Tensor
],
aux_hidden_states
:
Optional
[
torch
.
Tensor
],
spec_decode_metadata
:
Optional
[
SpecDecodeMetadata
],
spec_decode_metadata
:
Optional
[
SpecDecodeMetadata
],
attn_metadata
:
dict
[
str
,
Any
],
attn_metadata
:
dict
[
str
,
Any
],
)
->
list
[
list
[
int
]]:
)
->
tuple
[
list
[
list
[
int
]],
torch
.
Tensor
]:
draft_probs
=
None
num_scheduled_tokens
=
scheduler_output
.
total_num_scheduled_tokens
num_scheduled_tokens
=
scheduler_output
.
total_num_scheduled_tokens
if
self
.
speculative_config
.
method
==
"ngram"
:
if
self
.
speculative_config
.
method
==
"ngram"
:
assert
isinstance
(
self
.
drafter
,
NgramProposer
)
assert
isinstance
(
self
.
drafter
,
NgramProposer
)
...
...
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