Fix dtype mismatch in validate_layer: cast flat to float before F.linear

This commit is contained in:
2026-05-31 20:23:18 +00:00
parent 46c4ef2cf5
commit baee36e728

View File

@@ -210,7 +210,7 @@ def validate_layer(li, all_weights, cfg, device='cuda:0'):
flat = (X_flat * rms_inv).to(torch.bfloat16)
# F.linear + split [pre(4), post(4), comb(16)]
proj = torch.nn.functional.linear(flat, fn).float()
proj = torch.nn.functional.linear(flat.float(), fn).float()
pre_w, post_w, comb_w = proj.split([n_hc, n_hc, n_hc * n_hc], dim=-1)
pre_b, post_b, comb_b = base.split([n_hc, n_hc, n_hc * n_hc])
pre_s, post_s, comb_s = scale.unbind(0)