feat: 全系统统一 Whisper V2 权重并移除 demo 工作流

确认所有运行时引用均使用 V2(V3 已停用),并修复一处真实不一致:

- 工作流数据文件:learn-translate 用 faster-whisper-large-v2、
  zh-direct 用 whisper-large-v2-translate-zh-v0.2-st-ct2(原本即 V2);
- 本地库的 demo 最新版本仍指向 large-v3:workflows/demo.json 早已改为 V2,
  但 seed 对已存在工作流刻意跳过,导致旧库停留在历史上用 V3 保存的定义,
  即本机跑 demo 实际加载 V3 权重。按用户决定移除 demo 工作流及其关联的
  6 个 run、1 个批量任务与 431 条明细(媒体库中已放置的 6 个字幕成品保留);
- nodes/whisper.py 候选与远端兜底本就是 large-v2;
- V3 权重目录保留在盘上仅作对照实验,文档标注为废弃;
  scripts/compare_whisper_v2_vs_v3.py 保留用于对照。

顺带修复与清理:
- src/wov_app/scheduler.py:_file_size 补捕 ValueError(见上一条提交说明
  的真实缺陷,此处为同一批改动);
- .gitignore:data/ 改为 /data/,避免连带忽略 tests/**/data/;
- scripts/*:评测集路径改到 scripts/data/translate_eval/;
- 代码注释与文档同步移除 demo 引用(历史调研文档保留说明性引用)。

验证:全量 477 passed;新库 seed 只创建 3 个 V2 工作流。
This commit is contained in:
2026-09-13 15:41:58 +08:00
parent ee47556a61
commit 8f6083f8cf
15 changed files with 1893 additions and 98 deletions
+7
View File
@@ -37,6 +37,13 @@ def parse_srt(text: str) -> list[Cue]:
index += 2
body = []
while index < len(lines) and lines[index].strip():
# 正文行不允许是时间戳行:出现即说明条目之间缺少空行分隔。
# 若不报错,下一条的序号与时间轴会被当成上一条正文吞掉,
# 静默产出时间与文本错位的字幕(同“静默错位”类缺陷)。
if _TIMESTAMP.fullmatch(lines[index].strip()):
raise ValueError(
f"missing blank line before cue at line {index + 1}"
)
body.append(lines[index])
index += 1
entries.append(Cue(match[1], match[2], "\n".join(body)))
+1 -1
View File
@@ -149,7 +149,7 @@ def remove_short_moan_entries(
max_chars(默认 3)才删除(见 _is_pure_moan),真实短对话(そこ/やばい/
ねえ/やだ/えへへ/行く行く行く)天然不命中。max_chars=0 时关闭过滤(原
样返回)。仅在 whisper 节点 decode_full=true 时调用(用户 2026-09 决策,
不作用于 demo 等 VAD 链路)。纯函数,不修改输入。
不作用于 learn-translate 等 VAD 链路)。纯函数,不修改输入。
"""
if max_chars <= 0:
return srt_text
+16 -3
View File
@@ -61,10 +61,23 @@ def _is_fragment(text: str) -> bool:
def _read_srt_entries(srt_path: Path) -> list[dict]:
"""读 SRT,返回 [{index,start,end,text}]借用 realdata_contract 的解析)。"""
from tests.realdata_contract import parse_srt_entries
"""读 SRT,返回 [{start, end, text}]时间轴为秒,供上下文与评分使用)。
return parse_srt_entries(srt_path.read_text(encoding="utf-8"))
解析复用生产模块 `nodes/srt.py` 的严格解析器(支持 BOM/CRLF、多行与
空正文,非法条目明确报错),再按秒换算,不用测试包实现。
"""
from nodes.srt import parse_srt as parse_cues
def to_seconds(timestamp: str) -> float:
"""SRT 时间戳 HH:MM:SS,mmm → 秒。"""
hours, minutes, rest = timestamp.split(":")
seconds, millis = rest.split(",")
return int(hours) * 3600 + int(minutes) * 60 + int(seconds) + int(millis) / 1000
return [
{"start": to_seconds(cue.start), "end": to_seconds(cue.end), "text": cue.text}
for cue in parse_cues(srt_path.read_text(encoding="utf-8"))
]
def _build_context(entries: list[dict], target_index: int, window: float = CONTEXT_WINDOW) -> str:
+1 -1
View File
@@ -311,7 +311,7 @@ def invoke(request: InvokeRequest) -> InvokeResponse:
# 救回,其中混有大量**纯语气词碎片**(あ…/ん?/はぁ…/あ!あ!/んふふ 等),
# 这类噪声影响字幕观感;在此按'全部字符∈纯呻吟集合 且 有效假名≤max_chars'
# 判据**整条删除**remove_short_moan_entries),真实短对话(そこ/やばい/
# ねえ/やだ)天然不命中。仅 decode_full 生效,demo 等 VAD 链路不受影响;
# ねえ/やだ)天然不命中。仅 decode_full 生效,learn-translate 等 VAD 链路不受影响;
# 参数 short_moan_max_chars 可调(默认 3,设 0 关闭)。
if decode_full:
from nodes.subtitle_cleanup import (