Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

Revert "# 增强说话人分离功能的时间戳支持"

Shi Xian700cb827f5c2
diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.py
index f5cbe01ff..96c642e52 100644
--- a/funasr/auto/auto_model.py
+++ b/funasr/auto/auto_model.py
@@ -549,41 +549,8 @@ class AutoModel:
# 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(