Run this model with HF Jobs

Run XiangnanW/CGVM-R2.6-Qwen3VL-8B-step600 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/XiangnanW/CGVM-R2.6-Qwen3VL-8B-step600. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/XiangnanW/CGVM-R2.6-Qwen3VL-8B-step600 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
CGVM-R2.6-Qwen3VL-8B-step600 / src /scripts /notify_feishu_cgvm.py
XiangnanW's picture
Upload CGVM R2.6 step-000600 checkpoint, R2.6 source bundle (cgvm-r26-src-v1.tar.gz), and 4-round audit report
4ad9219 verified
Raw History Blame Contribute Delete
8.34 kB
#!/usr/bin/env python3
"""CGVM Stage 2 训练与 OVO-Bench / StreamingBench 评测的飞书进度与结果播报工具。"""
import argparse
import glob
import json
import os
import subprocess
import sys
from datetime import datetime
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
USER_OPEN_ID = os.environ.get("FEISHU_USER_OPEN_ID", "ou_c5d794b5a57db1d4c3e7d3e370295a9a")
OVO_BT_TASKS = ["EPM", "ASI", "HLD"]
OVO_RTP_TASKS = ["OCR", "ACR", "ATR", "STU", "FPD", "OJR"]
SB_TASKS = ["OP", "CR", "CS", "ATP", "EU", "TR", "PR", "SU", "ACP", "CT"]
def send_feishu_md(md_text: str) -> bool:
env = os.environ.copy()
home = os.path.expanduser("~")
env["PATH"] = f"{home}/.local/bin:" + env.get("PATH", "")
env["LARK_CHANNEL"] = "1"
env["LARKSUITE_CLI_CONFIG_DIR"] = f"{home}/.lark-channel/profiles/claude/lark-cli"
env["LARK_CHANNEL_HOME"] = f"{home}/.lark-channel"
env["LARK_CHANNEL_PROFILE"] = "claude"
env["LARK_CHANNEL_CONFIG"] = f"{home}/.lark-channel/profiles/claude/lark-cli-source/config.json"
env["http_proxy"] = env.get("http_proxy", "http://127.0.0.1:8118")
env["https_proxy"] = env.get("https_proxy", "http://127.0.0.1:8118")
cmd = [
f"{home}/.local/bin/lark-cli",
"im",
"+messages-send",
"--as",
"bot",
"--user-id",
USER_OPEN_ID,
"--markdown",
"-",
]
res = subprocess.run(
cmd,
input=md_text.encode("utf-8"),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=env,
)
now_s = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f"[{now_s}] send_feishu_md rc={res.returncode} out={res.stdout.decode('utf-8', 'ignore').strip()}", flush=True)
return res.returncode == 0
def summarize_benchmark(results_dir: Path, bench: str):
rows = {}
for p in sorted(results_dir.glob(f"{bench}/shard*/predictions.jsonl")):
for line in p.open():
d = json.loads(line)
if d.get("status") == "answered":
rows[d["id"]] = d
if not rows:
return None
by_task = {}
for d in rows.values():
t = d["task"]
by_task.setdefault(t, [0, 0])
by_task[t][0] += 1
if d.get("official_correct"):
by_task[t][1] += 1
task_acc = {t: (100.0 * c / n if n else 0.0) for t, (n, c) in by_task.items()}
total_n = sum(n for n, _ in by_task.values())
total_c = sum(c for _, c in by_task.values())
micro = 100.0 * total_c / max(1, total_n)
out = {"total_n": total_n, "total_c": total_c, "micro": micro, "tasks": task_acc, "counts": by_task}
if bench == "ovobench":
all_ovo = OVO_BT_TASKS + OVO_RTP_TASKS
out["macro"] = sum(task_acc.get(t, 0.0) for t in all_ovo) / len(all_ovo)
out["bt_macro"] = sum(task_acc.get(t, 0.0) for t in OVO_BT_TASKS) / len(OVO_BT_TASKS)
out["rtp_macro"] = sum(task_acc.get(t, 0.0) for t in OVO_RTP_TASKS) / len(OVO_RTP_TASKS)
elif bench == "streamingbench":
out["macro"] = sum(task_acc.get(t, 0.0) for t in SB_TASKS) / len(SB_TASKS)
ct_groups = {"0": [0, 0], "1": [0, 0], ">=2": [0, 0]}
for d in rows.values():
if d["task"] != "CT":
continue
opts = d.get("options", [])
ans_idx = ord(d["answer"].strip()[0].upper()) - ord("A")
import re as _re
gt_raw = opts[ans_idx].strip() if 0 <= ans_idx < len(opts) else ""
gt_txt = _re.sub(r"^[A-D][\.\:\s]+", "", gt_raw).strip().rstrip(".").lower()
if gt_txt in ("0", "zero", "none"):
g = "0"
elif gt_txt in ("1", "one", "once"):
g = "1"
else:
g = ">=2"
ct_groups[g][0] += 1
if d.get("official_correct"):
ct_groups[g][1] += 1
out["ct_groups"] = ct_groups
return out
def format_ovo_report(new_dir: Path, base_dir: Path = None, title_label: str = "CGVM R2.5", base_label: str = "R0") -> str:
cur = summarize_benchmark(new_dir, "ovobench")
base = summarize_benchmark(base_dir, "ovobench") if (base_dir and base_dir.exists()) else None
if not cur:
return f"⚠️ **{title_label} OVO-Bench 评测结果尚未生成**"
lines = [
f"### 📊 {title_label} — OVO-Bench 评测完成 (1,468 题)",
f"- **OVO 9-Task Macro**:`{cur['macro']:.2f}%`"
+ (f" (vs {base_label} `{base['macro']:.2f}%`, Δ `{cur['macro'] - base['macro']:+.2f} pp`)" if base else ""),
f"- **OVO Micro 总准确率**:`{cur['micro']:.2f}%` ({cur['total_c']}/{cur['total_n']})"
+ (f" (vs {base_label} `{base['micro']:.2f}%`, Δ `{cur['micro'] - base['micro']:+.2f} pp`)" if base else ""),
f"- **OVO-BT (Backward Tracing)**:`{cur['bt_macro']:.2f}%`"
+ (f" (vs {base_label} `{base['bt_macro']:.2f}%`, Δ `{cur['bt_macro'] - base['bt_macro']:+.2f} pp`)" if base else ""),
f"- **OVO-RT (Real-Time Perception, 6子项)**:`{cur['rtp_macro']:.2f}%`"
+ (f" (vs {base_label} `{base['rtp_macro']:.2f}%`, Δ `{cur['rtp_macro'] - base['rtp_macro']:+.2f} pp`)" if base else ""),
"",
"**分项明细**:",
]
for t in OVO_BT_TASKS + OVO_RTP_TASKS:
n, c = cur["counts"].get(t, [0, 0])
acc = cur["tasks"].get(t, 0.0)
delta_s = f" ({base_label} `{base['tasks'].get(t, 0.0):.2f}%`, Δ `{acc - base['tasks'].get(t, 0.0):+.2f}`)" if base else ""
lines.append(f"- `{t}`: `{acc:.2f}%` ({c}/{n}){delta_s}")
return "\n".join(lines)
def format_sb_report(new_dir: Path, base_dir: Path = None, title_label: str = "CGVM R2.6", base_label: str = "R2.5") -> str:
cur = summarize_benchmark(new_dir, "streamingbench")
base = summarize_benchmark(base_dir, "streamingbench") if (base_dir and base_dir.exists()) else None
if not cur:
return f"⚠️ **{title_label} StreamingBench 评测结果尚未生成**"
ct_g = cur.get("ct_groups", {})
lines = [
f"### 🎯 {title_label} — StreamingBench 评测完成 (2,500 题)",
f"- **Streaming Micro 总准确率**:`{cur['micro']:.2f}%` ({cur['total_c']}/{cur['total_n']})"
+ (f" (vs {base_label} `{base['micro']:.2f}%`, Δ `{cur['micro'] - base['micro']:+.2f} pp`)" if base else ""),
f"- **Streaming Macro (10子项宏平均)**:`{cur['macro']:.2f}%`"
+ (f" (vs {base_label} `{base['macro']:.2f}%`, Δ `{cur['macro'] - base['macro']:+.2f} pp`)" if base else ""),
f"- **CT (Counting) 子项**:`{cur['tasks'].get('CT', 0.0):.2f}%` "
f"[`GT=0`: {ct_g.get('0', [0,0])[1]}/{ct_g.get('0', [0,0])[0]}, "
f"`GT=1`: {ct_g.get('1', [0,0])[1]}/{ct_g.get('1', [0,0])[0]}, "
f"`GT>=2`: {ct_g.get('>=2', [0,0])[1]}/{ct_g.get('>=2', [0,0])[0]}]",
"",
"**10 子任务明细**:",
]
for t in SB_TASKS:
n, c = cur["counts"].get(t, [0, 0])
acc = cur["tasks"].get(t, 0.0)
delta_s = f" ({base_label} `{base['tasks'].get(t, 0.0):.2f}%`, Δ `{acc - base['tasks'].get(t, 0.0):+.2f}`)" if base else ""
lines.append(f"- `{t}`: `{acc:.2f}%` ({c}/{n}){delta_s}")
return "\n".join(lines)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--message", default=None, help="直接发送自定义 Markdown 文本")
parser.add_argument("--report-ovo", action="store_true")
parser.add_argument("--report-sb", action="store_true")
parser.add_argument("--results-dir", default=str(ROOT / "results/R2"))
parser.add_argument("--base-results-dir", default=None)
parser.add_argument("--title-label", default="CGVM R2.6")
parser.add_argument("--base-label", default="R2.5")
args = parser.parse_args()
res_dir = Path(args.results_dir)
base_dir = Path(args.base_results_dir) if args.base_results_dir else None
if args.message:
ok = send_feishu_md(args.message)
sys.exit(0 if ok else 1)
if args.report_ovo:
ok = send_feishu_md(format_ovo_report(res_dir, base_dir, args.title_label, args.base_label))
sys.exit(0 if ok else 1)
if args.report_sb:
ok = send_feishu_md(format_sb_report(res_dir, base_dir, args.title_label, args.base_label))
sys.exit(0 if ok else 1)
if __name__ == "__main__":
main()