Skip to content

Commit

Permalink
[python] fix token lookup when token is null (#2421)
Browse files Browse the repository at this point in the history
  • Loading branch information
sindhuvahinis authored Oct 8, 2024
1 parent 6e54011 commit 21800b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion engines/python/setup/djl_python/output_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from djl_python.request_io import TextGenerationOutput
from djl_python.utils import wait_till_generation_finished

ERR_MSG = "Inference error occurred. Check CloudWatch metrics or model server logs for more details."


def output_formatter(function):
"""
Expand Down Expand Up @@ -120,7 +122,7 @@ def _json_output_formatter(request_output: TextGenerationOutput):
# partial generation response that may exist
result = {
"generated_text": None,
"error": final_token.error_msg,
"error": final_token.error_msg if final_token else ERR_MSG,
"code": 400,
"details": details,
}
Expand Down

0 comments on commit 21800b2

Please sign in to comment.