Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Piggyback final flag as a part of final response #28

Merged
merged 3 commits into from
Jan 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,21 @@ async def generate(self, request):
self.logger.log_info("[vllm] Successfully cancelled the request")
break
if stream:
response_sender.send(self.create_response(output))
if output.finished:
response_sender.send(
self.create_response(output),
flags=pb_utils.TRITONSERVER_RESPONSE_COMPLETE_FINAL,
)
else:
response_sender.send(self.create_response(output))
else:
last_output = output

if not stream:
response_sender.send(self.create_response(last_output))
response_sender.send(
self.create_response(last_output),
flags=pb_utils.TRITONSERVER_RESPONSE_COMPLETE_FINAL,
)

except Exception as e:
self.logger.log_info(f"[vllm] Error generating stream: {e}")
Expand All @@ -280,10 +289,11 @@ async def generate(self, request):
response = pb_utils.InferenceResponse(
output_tensors=[triton_output_tensor], error=error
)
response_sender.send(response)
response_sender.send(
response, flags=pb_utils.TRITONSERVER_RESPONSE_COMPLETE_FINAL
)
raise e
finally:
response_sender.send(flags=pb_utils.TRITONSERVER_RESPONSE_COMPLETE_FINAL)
self.ongoing_request_count -= 1
nv-hwoo marked this conversation as resolved.
Show resolved Hide resolved

def execute(self, requests):
Expand Down
Loading