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:
1 parent
a16ac3dc45
commit
5d2d3a2fb5
16 files changed
+1254
No files matched your search
+20
@@ -0,0 +1,20 @@
|
||||
import numpy as np, torch, glob, os
|
||||
from model import GPT
|
||||
from train import get_batch_rows
|
||||
tr = np.memmap("../data_mm/train.bin", dtype=np.uint16, mode="r").reshape(-1,128)
|
||||
va = np.memmap("../data_mm/val.bin", dtype=np.uint16, mode="r").reshape(-1,128)
|
||||
print("train rows %d val rows %d" % (tr.shape[0], va.shape[0]))
|
||||
print("%-22s %8s %8s %8s" % ("ckpt","train","val","gap"))
|
||||
for p in sorted(glob.glob("out_v2a/ckpt_iter*.pt"), key=lambda s: int(s.split("iter")[1].split(".")[0])):
|
||||
ck = torch.load(p, map_location="cuda", weights_only=False)
|
||||
m = GPT(ck["cfg"]).cuda(); m.load_state_dict(ck["model"]); m.eval()
|
||||
r={}
|
||||
with torch.no_grad():
|
||||
for name,d in (("train",tr),("val",va)):
|
||||
s=0.0
|
||||
for _ in range(20):
|
||||
x,y,_=get_batch_rows(d,128,64,"cuda",False)
|
||||
with torch.amp.autocast("cuda",dtype=torch.bfloat16): s+=m(x,y,None)["loss"].item()
|
||||
r[name]=s/20
|
||||
print("%-22s %8.4f %8.4f %+8.4f" % (os.path.basename(p), r["train"], r["val"], r["val"]-r["train"]))
|
||||
del m; torch.cuda.empty_cache()
|
||||
Reference in new issue
Block a user