From b248b4aa94ecde2f6b944e8783eea2b5a7c2c11f Mon Sep 17 00:00:00 2001 From: Xiong Wang Date: Fri, 30 Jan 2026 10:58:02 +0800 Subject: [PATCH] update and fix --- README.md | 12 ++++++------ pyproject.toml | 2 +- qwen_asr/inference/qwen3_asr.py | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2211ce4..974607c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

-  🤗 Hugging Face   |   🤖 ModelScope   |   📑 Blog   |   📑 Paper   +  🤗 Hugging Face   |   🤖 ModelScope   |   📑 Blog   |   📑 Paper  
🖥️ Hugging Face Demo   |    🖥️ ModelScope Demo   |   💬 WeChat (微信)   |   🫨 Discord   |   📑 API @@ -41,7 +41,7 @@ We release **Qwen3-ASR**, a family that includes two powerful all-in-one speech - [Fine Tuning](#fine-tuning) - [Docker](#docker) - [Evaluation](#evaluation) - +- [Citation](#citation) ## Overview @@ -1420,18 +1420,18 @@ During evaluation, we ran inference for all models with `dtype=torch.bfloat16` a - +``` ## Star History diff --git a/pyproject.toml b/pyproject.toml index 93ea350..66d0f88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "qwen-asr" -version = "0.0.4" +version = "0.0.5" description = "Qwen-ASR python package" readme = "README.md" requires-python = ">=3.9" diff --git a/qwen_asr/inference/qwen3_asr.py b/qwen_asr/inference/qwen3_asr.py index 92608f0..d997ba3 100644 --- a/qwen_asr/inference/qwen3_asr.py +++ b/qwen_asr/inference/qwen3_asr.py @@ -733,8 +733,18 @@ class Qwen3ASRModel: prefix = "" else: cur_ids = self.processor.tokenizer.encode(state._raw_decoded) - end_idx = max(1, len(cur_ids) - int(state.unfixed_token_num)) - prefix = self.processor.tokenizer.decode(cur_ids[:end_idx]) + k = int(state.unfixed_token_num) + 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") + break + except UnicodeError: + if end_idx == 0: + prefix = "" + break + k += 1 prompt = state.prompt_raw + prefix