fix for empty initial string (#665)

This commit is contained in:
Awni Hannun
2024-04-08 10:40:05 -07:00
committed by GitHub
parent c386dd5f5a
commit 1e2f7f50b6

View File

@@ -249,7 +249,9 @@ def generate(
if verbose:
s = tokenizer.decode(tokens)
if formatter:
if not s:
continue
elif formatter:
formatter(s[skip:], prob.item())
skip = len(s)
elif s[-1] != REPLACEMENT_CHAR: