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
a3432f18
Unverified
Commit
a3432f18
authored
Aug 28, 2025
by
Woosuk Kwon
Committed by
GitHub
Aug 28, 2025
Browse files
[BugFix][Spec Decode] Use float64 for uniform_probs (#23803)
Signed-off-by:
Woosuk Kwon
<
woosuk.kwon@berkeley.edu
>
parent
67cee40d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
examples/offline_inference/spec_decode.py
examples/offline_inference/spec_decode.py
+1
-1
vllm/v1/sample/rejection_sampler.py
vllm/v1/sample/rejection_sampler.py
+6
-1
No files found.
examples/offline_inference/spec_decode.py
View file @
a3432f18
...
...
@@ -138,7 +138,7 @@ def main():
sampling_params
=
SamplingParams
(
temperature
=
args
.
temp
,
max_tokens
=
args
.
output_len
)
if
not
args
.
custom_mm_prompts
:
outputs
=
llm
.
generate
(
TokensPrompt
(
prompt_token_ids
=
prompt_ids
)
,
[
TokensPrompt
(
prompt_token_ids
=
x
)
for
x
in
prompt_ids
]
,
sampling_params
=
sampling_params
,
)
else
:
...
...
vllm/v1/sample/rejection_sampler.py
View file @
a3432f18
...
...
@@ -365,9 +365,14 @@ def generate_uniform_probs(
A tensor of shape `(num_tokens, )` containing uniform
random values in the range [0, 1).
"""
# NOTE(woosuk): We deliberately use float64 instead of float32 here
# because when using float32, there's a non-negligible chance that
# uniform_prob is sampled to be exact 0.0 as reported in
# https://github.com/pytorch/pytorch/issues/16706. Using float64
# mitigates the issue.
uniform_probs
=
torch
.
rand
(
(
num_tokens
,
),
dtype
=
torch
.
float
32
,
dtype
=
torch
.
float
64
,
device
=
device
,
)
start_idx
=
0
...
...
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