Sort the outputs before return (#402)

This commit is contained in:
Woosuk Kwon 2023-07-08 14:48:18 -07:00 committed by GitHub
parent 2179e4f4c5
commit b6fbb9a565
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,4 +155,8 @@ class LLM:
pbar.update(1)
if use_tqdm:
pbar.close()
# Sort the outputs by request ID.
# This is necessary because some requests may be finished earlier than
# its previous requests.
outputs = sorted(outputs, key=lambda x: int(x.request_id))
return outputs