ai-labeling: Prompt 1 v0.1 + ground-truth v0.4.0(20期) + MiMo首轮跑批

- Prompt 1 v0.1: 4分类字段(题材/装备域/场景/技术)判别prompt,含5示例+边界规则+换装测试
- ground-truth v0.4.0: 10→20期扩展,ep编号重映射(旧ep3-15→新ep001-020),4分类字段全填(制片人逐期审定)
- 文稿升级: 旧10期删除,新20期md文件(doco子项目清洗产出)替换
- 脚本升级: ep编号2位→3位,ALL_EPISODES扩至1-20,summarize classification比对逻辑实现
- MiMo首轮结果: 题材75%/装备域70%/场景95%/技术70%/全对40%,需迭代Prompt
- 质量标杆: 加入PPT+Excel样板文件(example/)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
simonkoson
2026-06-24 19:22:13 +08:00
parent 30931d4446
commit d8057b07e9
37 changed files with 3647 additions and 1508 deletions
+4 -4
View File
@@ -39,7 +39,7 @@ MODEL_CONFIG = {
},
}
ALL_EPISODES = [3, 4, 5, 7, 10, 11, 12, 13, 14, 15]
ALL_EPISODES = list(range(1, 21))
FIELD_PROMPT_MAP = {
"narrative": "prompt2_narrative.md",
@@ -54,7 +54,7 @@ def load_prompt(field):
def load_transcript(ep):
pattern = f"ep{ep:02d}_*.md"
pattern = f"ep{ep:03d}_*.md"
files = list(TRANSCRIPTS_DIR.glob(pattern))
if not files:
raise FileNotFoundError(f"No transcript found for ep{ep:02d} in {TRANSCRIPTS_DIR}")
@@ -131,12 +131,12 @@ def run_labeling(ep, model_key, field="narrative"):
result = call_model(model_key, system_prompt, user_prompt)
gt = load_ground_truth(ep)
ts = datetime.now().strftime("%Y%m%d_%H%M%S")
out = EXPERIMENTS_DIR / f"{ts}_{model_key}_{field}_ep{ep:02d}.json"
out = EXPERIMENTS_DIR / f"{ts}_{model_key}_{field}_ep{ep:03d}.json"
out.write_text(
json.dumps({"episode": ep, "filename": fname, "field": field, "result": result, "ground_truth": gt}, ensure_ascii=False, indent=2),
encoding="utf-8",
)
print(f"完成 ep{ep:02d} [{field}] -> {out.name}")
print(f"完成 ep{ep:03d} [{field}] -> {out.name}")
return result
+33 -5
View File
@@ -28,7 +28,7 @@ def latest_per_ep(files):
latest = {}
for f in files:
name = f.name
# 文件名格式: 20260611_154037_m3_ep04.json
# 文件名格式: 20260611_154037_model_field_ep003.json
parts = name.replace(".json", "").split("_")
if len(parts) >= 4:
ts = parts[0] + parts[1] # yyyymmddHHMMSS
@@ -79,8 +79,19 @@ def run(model, field="narrative"):
hit = pred_val == gt_val if pred_val is not None else False
rows.append({"ep": ep, "title": title, "gt": gt_val, "pred": pred_val or "解析失败", "hit": hit, "conf": conf})
elif field == "classification":
# 骨架预留:等 ground-truth 标注就绪后实现具体比对逻辑
rows.append({"ep": ep, "title": title, "gt": "?", "pred": "classification 待实现", "hit": False, "conf": "?"})
conf = result.get("confidence", "?") if result else "?"
sub = {}
for key in ("program_format", "equipment_domain", "scene_tags", "tech_tags"):
gt_val = gt.get(key)
pred_val = result.get(key) if result else None
if gt_val is None or pred_val is None:
sub[key] = None
elif isinstance(gt_val, list):
sub[key] = set(gt_val) == set(pred_val) if isinstance(pred_val, list) else False
else:
sub[key] = pred_val == gt_val
all_hit = all(v is True for v in sub.values() if v is not None)
rows.append({"ep": ep, "title": title, "sub": sub, "all_hit": all_hit, "conf": conf})
if field == "narrative":
# 打印每行
@@ -103,8 +114,25 @@ def run(model, field="narrative"):
print(f" 自评\"中/低\"置信的命中率: {ml_hit}/{len(mid_low)}")
print(f" 解析失败: {parse_fail}")
elif field == "classification":
print(f"\n ===== {model} classification =====")
print(f" classification 比对逻辑待实现(等 ground-truth 标注就绪)")
field_names = ["program_format", "equipment_domain", "scene_tags", "tech_tags"]
short = {"program_format": "题材", "equipment_domain": "装备域", "scene_tags": "场景", "tech_tags": "技术"}
for r in rows:
marks = ""
for fn in field_names:
v = r["sub"].get(fn)
marks += "" if v is True else ("" if v is False else "-")
all_mark = "" if r["all_hit"] else ""
print(f' ep{r["ep"]:03d} {r["title"]:<12} | {"/".join(short[f] for f in field_names)}={marks} | 全对:{all_mark} 置信度:{r["conf"]}')
total = len(rows)
for fn in field_names:
scored = [r for r in rows if r["sub"].get(fn) is not None]
hits = sum(1 for r in scored if r["sub"][fn])
pct = hits * 100 // len(scored) if scored else 0
print(f" {short[fn]}命中: {hits}/{len(scored)} = {pct}%")
all_scored = [r for r in rows if any(v is not None for v in r["sub"].values())]
all_hits = sum(1 for r in all_scored if r["all_hit"])
print(f" 4字段全对: {all_hits}/{len(all_scored)} = {all_hits*100//len(all_scored) if all_scored else 0}%")
print(f" 解析失败: {parse_fail}")