Skip to content

Commit 136e1eb

Browse files
njhilldbogunowicz
authored and
dbogunowicz
committed
[Fix] Fix best_of behavior when n=1 (vllm-project#3298)
1 parent 6f1e74c commit 136e1eb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vllm/outputs.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ def __init__(
8787

8888
@classmethod
8989
def from_seq_group(cls, seq_group: SequenceGroup) -> "RequestOutput":
90-
# Get the top-n sequences.
91-
n = seq_group.sampling_params.n
9290
seqs = seq_group.get_seqs()
93-
if n == 1:
91+
if len(seqs) == 1:
9492
top_n_seqs = seqs
9593
else:
94+
# Get the top-n sequences.
95+
n = seq_group.sampling_params.n
9696
if seq_group.sampling_params.use_beam_search:
9797
sorting_key = lambda seq: seq.get_beam_search_score(
9898
seq_group.sampling_params.length_penalty)

0 commit comments

Comments
 (0)