Skip to content

Commit 1e2f7f5

Browse files
authored
fix for empty initial string (ml-explore#665)
1 parent c386dd5 commit 1e2f7f5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llms/mlx_lm/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ def generate(
249249

250250
if verbose:
251251
s = tokenizer.decode(tokens)
252-
if formatter:
252+
if not s:
253+
continue
254+
elif formatter:
253255
formatter(s[skip:], prob.item())
254256
skip = len(s)
255257
elif s[-1] != REPLACEMENT_CHAR:

0 commit comments

Comments
 (0)