Skip to content

Commit 4a7a17a

Browse files
committed
refactor: try a different fix
Signed-off-by: Travis Johnson <tsjohnso@us.ibm.com>
1 parent 6e610a7 commit 4a7a17a

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
@@ -1529,17 +1529,17 @@ def add_request(request_id: str, engine, params, **kwargs):
15291529
def maybe_assemble_group(
15301530
self, seq_group: SequenceGroup) -> Optional[SequenceGroup]:
15311531

1532-
# in the streaming mode, we will return the assembled sequence for the
1533-
# last remaining sequence, and return None for the rest of sequences
1534-
if self.streaming:
1535-
last_remaining_id = list(self.to_be_finished)[-1]
1536-
if seq_group.request_id == last_remaining_id:
1532+
# in the streaming mode, we will return the assembled sequence while
1533+
# sequences are still processing, but must choose only one of the
1534+
# remaining sequences
1535+
if self.streaming and not seq_group.is_finished():
1536+
first_remaining_id = next(iter(self.to_be_finished))
1537+
if seq_group.request_id == first_remaining_id:
15371538
return self.assembled_seq_group
15381539
return None
15391540

1540-
# in the non-streaming mode, we will return the assembled sequence
1541-
# when the last sequences finishes, and then return None for the
1542-
# rest of the time
1541+
# for non-streaming and when finishing streaming, we will return the
1542+
# assembled sequence when the last sequence finishes
15431543
if (len(self.to_be_finished) == 1
15441544
and seq_group.request_id in self.to_be_finished
15451545
and seq_group.is_finished()):

0 commit comments

Comments
 (0)