fix streaming unicode

This commit is contained in:
Xiong Wang
2026-01-30 11:24:18 +08:00
parent b248b4aa94
commit c17a131fe0
2 changed files with 3 additions and 4 deletions

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "qwen-asr"
version = "0.0.5"
version = "0.0.6"
description = "Qwen-ASR python package"
readme = "README.md"
requires-python = ">=3.9"

View File

@ -737,10 +737,9 @@ class Qwen3ASRModel:
while True:
end_idx = max(0, len(cur_ids) - k)
prefix = self.processor.tokenizer.decode(cur_ids[:end_idx]) if end_idx > 0 else ""
try:
prefix.encode("utf-8").decode("utf-8")
if '\ufffd' not in prefix:
break
except UnicodeError:
else:
if end_idx == 0:
prefix = ""
break