Skip to content

Commit b6fbb9a

Browse files
authored
Sort the outputs before return (#402)
1 parent 2179e4f commit b6fbb9a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vllm/entrypoints/llm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,8 @@ def _run_engine(self, use_tqdm: bool) -> List[RequestOutput]:
155155
pbar.update(1)
156156
if use_tqdm:
157157
pbar.close()
158+
# Sort the outputs by request ID.
159+
# This is necessary because some requests may be finished earlier than
160+
# its previous requests.
161+
outputs = sorted(outputs, key=lambda x: int(x.request_id))
158162
return outputs

0 commit comments

Comments
 (0)