Skip to content

Commit 4e04ece

Browse files
authored
[Bugfix] Use random hidden states in dummy sampler run (#18543)
Signed-off-by: Bowen Wang <abmfy@icloud.com>
1 parent 7107502 commit 4e04ece

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vllm/v1/worker/gpu_model_runner.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,6 +1721,10 @@ def _dummy_sampler_run(
17211721
self,
17221722
hidden_states: torch.Tensor,
17231723
) -> torch.Tensor:
1724+
# The dummy hidden states may contain special values,
1725+
# like `inf` or `nan`.
1726+
# To avoid breaking the sampler, we use a random tensor here instead.
1727+
hidden_states = torch.rand_like(hidden_states)
17241728

17251729
logits = self.model.compute_logits(hidden_states, None)
17261730
num_reqs = logits.size(0)

0 commit comments

Comments
 (0)