feat(eval): 行为探针与统一训练报告

核心教训:loss 判断不了可控性,必须看行为。

- colour_eval: 色相统计(粗指标,会被场景带偏)
- probe_ctrl: 反事实换词,只改颜色词看 64 个 VQ 码变多少
- probe_simple / probe_body: 单轴 / 双轴贪心生成
- probe_cross: 颜色x车身 4x5 交叉积,唯一能照出“只会背格子”的工具
- probe_cf_tv: 词级 TV,测一个词进入预测的程度
- pos_eval: 图像码按位置分桶,区分 prompt 依赖与上下文续写
- stream_probe: 实测 4 路流耦合度(层 7-9 余弦 0.995+)
- train_report: 四层体检合成一条命令

chk/curve/split/distcheck/modecheck/vqres/smoke 为早期诊断小工具,一并归档。
This commit is contained in:
liuhuajie committed 2026-12-03 10:37:55 +08:00
1 parent a16ac3dc45
commit 5d2d3a2fb5
16 files changed
+1254

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
import torch
from model import GPT, MMConfig
cfg = MMConfig()
m = GPT(cfg).cuda()
print("params total %.2fM non-emb %.2fM" % (m.num_params()/1e6, m.num_params(True)/1e6))
x = torch.randint(0, cfg.vocab_size, (2, 64), device="cuda")
y = torch.randint(0, cfg.vocab_size, (2, 64), device="cuda")
out = m(x, y, y)
print("logits", tuple(out["logits"].shape))
print("loss %.4f mtp %.4f total %.4f" % (out["loss"].item(), out["loss_mtp"].item(), out["loss_total"].item()))
out["loss_total"].backward()
gn = sum((p.grad.norm()**2).item() for p in m.parameters() if p.grad is not None)**0.5
print("grad norm %.4f" % gn)
print("mem %.2f GB" % (torch.cuda.max_memory_allocated()/1e9))