Skip to content

Commit

Permalink
Update utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jiyzhang authored Dec 18, 2024
1 parent fd37bc8 commit f3c0159
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fastmlx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,10 @@ def lm_stream_generator(
):
if stop_words and token in stop_words:
break

# the return type of lm_stream_generate is mlx_lm.GenerationResponse,
# which includes a mx.array field and will get pydantic model_dump failed.
token = token.text

# Update token length info
if INCLUDE_USAGE:
completion_tokens += 1
Expand Down

0 comments on commit f3c0159

Please # to comment.