From e24dbdc496debec225414d4d2c760f5775e64f2a Mon Sep 17 00:00:00 2001
From: 天地 <tiandiweizun@gmail.com>
Date: 星期三, 26 三月 2025 13:44:41 +0800
Subject: [PATCH] 感觉应该从文件读取更合适,因为上面判断了文件存在,且可以读取,如果本身是文本的话,下面也会有逻辑进行处理 (#2452)
---
funasr/auto/auto_model.py | 37 ++-----------------------------------
1 files changed, 2 insertions(+), 35 deletions(-)
diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.py
index f5cbe01..96c642e 100644
--- a/funasr/auto/auto_model.py
+++ b/funasr/auto/auto_model.py
@@ -549,41 +549,8 @@
# speaker embedding cluster after resorted
if self.spk_model is not None and kwargs.get("return_spk_res", True):
- # 1. 鍏堟鏌ユ椂闂存埑
- has_timestamp = (
- hasattr(self.model, "internal_punc") or
- self.punc_model is not None or
- "timestamp" in result
- )
-
- if not has_timestamp:
- logging.error("Need timestamp support...")
- return results_ret_list
-
- # 2. 鍒濆鍖� punc_res
- punc_res = None
-
- # 3. 鏍规嵁涓嶅悓鎯呭喌璁剧疆 punc_res
- if hasattr(self.model, "internal_punc"):
- punc_res = [{
- "text": result["text"],
- "punc_array": result.get("punc_array", []),
- "timestamp": result.get("timestamp", [])
- }]
- elif self.punc_model is not None:
- punc_res = self.inference(
- result["text"],
- model=self.punc_model,
- kwargs=self.punc_kwargs,
- **cfg
- )
- else:
- # 濡傛灉鍙湁鏃堕棿鎴筹紝鍒涘缓涓�涓熀鏈殑 punc_res
- punc_res = [{
- "text": result["text"],
- "punc_array": [], # 绌虹殑鏍囩偣鏁扮粍
- "timestamp": result["timestamp"]
- }]
+ if raw_text is None:
+ logging.error("Missing punc_model, which is required by spk_model.")
all_segments = sorted(all_segments, key=lambda x: x[0])
spk_embedding = result["spk_embedding"]
labels = self.cb_model(
--
Gitblit v1.9.1