Skip to content

Commit

Permalink
BUG: empty results for non-stream inference (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
UranusSeven authored Sep 1, 2023
1 parent d2f336b commit 811b182
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions xinference/model/llm/pytorch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,15 @@ def generate_stream(
else:
finish_reason = None

completion_choice = CompletionChoice(
text="", index=0, logprobs=None, finish_reason=finish_reason
)
if stream:
completion_choice = CompletionChoice(
text="", index=0, logprobs=None, finish_reason=finish_reason
)
else:
completion_choice = CompletionChoice(
text=output, index=0, logprobs=None, finish_reason=finish_reason
)

completion_chunk = CompletionChunk(
id=str(uuid.uuid1()),
object="text_completion",
Expand Down

0 comments on commit 811b182

Please sign in to comment.