Skip to content

Commit 4314792

Browse files
committed
Fix multi-token character decoding for Qwen2
1 parent be3de0f commit 4314792

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

exllamav2/generator/dynamic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,12 +2001,12 @@ def emit(
20012001

20022002
# Hold text if it contains an incomplete character
20032003

2004-
if self.held_text.endswith("�") and not self.held_text.endswith("�����"):
2004+
if 1 <= self.held_text.count("�") < 5:
20052005
test_decode = self.generator.tokenizer.decode(
20062006
self.held_tokens.torch(),
20072007
decode_special_tokens = self.decode_special_tokens
20082008
)[0]
2009-
if not test_decode.endswith("�"):
2009+
if not "�" in test_decode:
20102010
self.held_text = test_decode
20112011
else:
20122012
return emit(results)

0 commit comments

Comments
 (0)