fix(eval): 单条样本失败不再拖垮整轮评估
ci / server (push) Failing after 14s
ci / design-tokens (push) Failing after 12s

- cli:逐样本 transcribe 包 try/except,失败记为该样本 error 并继续;
  失败样本 counts 置空,不计入准确率,仅在 errors 列计数
- custom 数据集:manifest 引用的音频不存在时 warn 跳过,不再让 soundfile
  抛错崩掉整轮(修复默认 config 的 custom 示例集指向不存在音频导致的崩溃)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-13 11:33:24 +08:00
parent 25acf9db6e
commit 50b49f3cbe
2 changed files with 12 additions and 4 deletions
+8 -4
View File
@@ -17,8 +17,8 @@ from rich.console import Console
from rich.progress import BarColumn, Progress, TextColumn, TimeElapsedColumn
from .datasets import build_dataset
from .engines import build_engine
from .metrics.err import score_sample
from .engines import Transcript, build_engine
from .metrics.err import empty_counts, score_sample
from .metrics.resource import ResourceProbe
from .report import aggregate, render_markdown, write_reports
@@ -117,8 +117,12 @@ def cmd_run(args: argparse.Namespace) -> int:
) as prog:
task = prog.add_task(f"{name}", total=len(samples))
for s in samples:
tr = _transcribe_one(engine, s.audio_path)
sc = score_sample(s.ref_text, tr.text)
try:
tr = _transcribe_one(engine, s.audio_path)
except Exception as ex: # 单条样本失败不拖垮整轮评估
tr = Transcript(text="", audio_sec=0.0, proc_sec=0.0, error=str(ex))
# 失败样本不计入准确率(counts 置空),仅在 errors 列计数
sc = empty_counts() if tr.error else score_sample(s.ref_text, tr.text)
rows.append({
"engine": name,
"dataset": s.dataset,