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
6efb195a
Unverified
Commit
6efb195a
authored
Apr 01, 2025
by
Brayden Zhong
Committed by
GitHub
Apr 01, 2025
Browse files
[V1] Fix: make sure `k_index` is int64 for `apply_top_k_only` (#15907)
Signed-off-by:
Brayden Zhong
<
b8zhong@uwaterloo.ca
>
parent
24b7fb45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
vllm/v1/sample/ops/topk_topp_sampler.py
vllm/v1/sample/ops/topk_topp_sampler.py
+1
-1
No files found.
vllm/v1/sample/ops/topk_topp_sampler.py
View file @
6efb195a
...
@@ -200,7 +200,7 @@ def apply_top_k_only(
...
@@ -200,7 +200,7 @@ def apply_top_k_only(
# topk.values tensor has shape [batch_size, max_top_k].
# topk.values tensor has shape [batch_size, max_top_k].
# Convert top k to 0-based index in range [0, max_top_k).
# Convert top k to 0-based index in range [0, max_top_k).
k_index
=
k
.
sub_
(
1
).
unsqueeze
(
1
)
k_index
=
k
.
sub_
(
1
).
unsqueeze
(
1
)
top_k_mask
=
logits
.
topk
(
max_top_k
,
dim
=
1
).
values
.
gather
(
1
,
k_index
)
top_k_mask
=
logits
.
topk
(
max_top_k
,
dim
=
1
).
values
.
gather
(
1
,
k_index
.
long
()
)
# Handle non-topk rows.
# Handle non-topk rows.
top_k_mask
.
masked_fill_
(
no_top_k_mask
.
unsqueeze
(
1
),
-
float
(
"inf"
))
top_k_mask
.
masked_fill_
(
no_top_k_mask
.
unsqueeze
(
1
),
-
float
(
"inf"
))
logits
.
masked_fill_
(
logits
<
top_k_mask
,
-
float
(
"inf"
))
logits
.
masked_fill_
(
logits
<
top_k_mask
,
-
float
(
"inf"
))
...
...
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