Skip to content

Commit

Permalink
[python] check whether last token is generated for json_output_format…
Browse files Browse the repository at this point in the history
  • Loading branch information
sindhuvahinis authored and siddvenk committed Sep 12, 2024
1 parent 7118eb2 commit 639ab7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions engines/python/setup/djl_python/output_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def _json_output_formatter(request_output: TextGenerationOutput):
request_output.best_sequence_index]
# TODO: Fix this so it is not required. Right now, this call is needed to
# advance the token iterator, which is needed for rolling batch to work properly
next_token, _, _ = best_sequence.get_next_token()
if not request_output.finished:
next_token, _, is_last_token = best_sequence.get_next_token()
if not is_last_token:
return ""
details = get_details_dict(request_output, include_tokens=True)
if details.get("finish_reason") == "error":
Expand Down

0 comments on commit 639ab7f

Please sign in to comment.