fix streaming unicode
This commit is contained in:
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "qwen-asr"
|
name = "qwen-asr"
|
||||||
version = "0.0.5"
|
version = "0.0.6"
|
||||||
description = "Qwen-ASR python package"
|
description = "Qwen-ASR python package"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9"
|
||||||
|
|||||||
@ -737,10 +737,9 @@ class Qwen3ASRModel:
|
|||||||
while True:
|
while True:
|
||||||
end_idx = max(0, len(cur_ids) - k)
|
end_idx = max(0, len(cur_ids) - k)
|
||||||
prefix = self.processor.tokenizer.decode(cur_ids[:end_idx]) if end_idx > 0 else ""
|
prefix = self.processor.tokenizer.decode(cur_ids[:end_idx]) if end_idx > 0 else ""
|
||||||
try:
|
if '\ufffd' not in prefix:
|
||||||
prefix.encode("utf-8").decode("utf-8")
|
|
||||||
break
|
break
|
||||||
except UnicodeError:
|
else:
|
||||||
if end_idx == 0:
|
if end_idx == 0:
|
||||||
prefix = ""
|
prefix = ""
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user