Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
fa82dfcc
Unverified
Commit
fa82dfcc
authored
Feb 07, 2025
by
Yineng Zhang
Committed by
GitHub
Feb 07, 2025
Browse files
fix EagleVerifyInput (#3378)
parent
5da3d21c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
21 deletions
+13
-21
python/sglang/srt/speculative/eagle_utils.py
python/sglang/srt/speculative/eagle_utils.py
+13
-21
No files found.
python/sglang/srt/speculative/eagle_utils.py
View file @
fa82dfcc
...
@@ -177,29 +177,21 @@ class EagleVerifyInput:
...
@@ -177,29 +177,21 @@ class EagleVerifyInput:
spec_steps
:
int
,
spec_steps
:
int
,
num_verify_token
:
int
,
num_verify_token
:
int
,
):
):
score_list
=
torch
.
cat
(
score_list
,
dim
=
1
).
flatten
(
tree_mask
,
position
,
retrive_index
,
retrive_cum_len
,
draft_tokens
=
(
1
build_tree_kernel
(
)
# b, n, topk; n= 1 + (num_steps-1) * self.topk
verified_id
,
ss_token_list
=
torch
.
cat
(
score_list
,
token_list
,
dim
=
1
token_list
,
)
# b, (self.topk + (num_steps-1) * self.topk)
parents_list
,
top_scores
=
torch
.
topk
(
score_list
,
num_verify_token
-
1
,
dim
=-
1
)
seq_lens
,
top_scores_index
=
top_scores
.
indices
seq_lens_sum
,
top_scores_index
=
torch
.
sort
(
top_scores_index
).
values
topk
,
draft_tokens
=
torch
.
gather
(
ss_token_list
,
index
=
top_scores_index
,
dim
=
1
)
spec_steps
,
draft_tokens
=
torch
.
cat
((
verified_id
.
unsqueeze
(
1
),
draft_tokens
),
dim
=
1
)
num_verify_token
,
parent_list
=
torch
.
cat
(
parents_list
[:
-
1
],
dim
=
1
)
)
tree_mask
,
position
,
retrive_index
,
retrive_cum_len
=
build_tree_kernel
(
parent_list
,
top_scores_index
,
seq_lens
,
seq_lens_sum
,
topk
,
spec_steps
,
num_verify_token
,
)
)
return
cls
(
return
cls
(
draft_tokens
.
flatten
()
,
draft_tokens
,
tree_mask
,
tree_mask
,
position
,
position
,
retrive_index
,
retrive_index
,
...
...
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