Skip to content

Commit 57578c9

Browse files
committed
refactor: try a different fix
Signed-off-by: Travis Johnson <tsjohnso@us.ibm.com>
1 parent ecbbc1f commit 57578c9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

vllm/sequence.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,17 +1534,17 @@ def add_request(request_id: str, engine, params, **kwargs):
15341534
def maybe_assemble_group(
15351535
self, seq_group: SequenceGroup) -> Optional[SequenceGroup]:
15361536

1537-
# in the streaming mode, we will return the assembled sequence for the
1538-
# last remaining sequence, and return None for the rest of sequences
1539-
if self.streaming:
1540-
last_remaining_id = list(self.to_be_finished)[-1]
1541-
if seq_group.request_id == last_remaining_id:
1537+
# in the streaming mode, we will return the assembled sequence while
1538+
# sequences are still processing, but must choose only one of the
1539+
# remaining sequences
1540+
if self.streaming and not seq_group.is_finished():
1541+
first_remaining_id = next(iter(self.to_be_finished))
1542+
if seq_group.request_id == first_remaining_id:
15421543
return self.assembled_seq_group
15431544
return None
15441545

1545-
# in the non-streaming mode, we will return the assembled sequence
1546-
# when the last sequences finishes, and then return None for the
1547-
# rest of the time
1546+
# for non-streaming and when finishing streaming, we will return the
1547+
# assembled sequence when the last sequence finishes
15481548
if (len(self.to_be_finished) == 1
15491549
and seq_group.request_id in self.to_be_finished
15501550
and seq_group.is_finished()):

0 commit comments

Comments
 (0)