ParcaeAdapter: rho(A)<1 by construction (ZOH negative-diag), rho logging in rec arms, pre-registration item 12

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Nils
2026-07-15 00:53:34 +02:00
co-authored by Claude Fable 5
parent d2da8044c3
commit f254b20b62
4 changed files with 89 additions and 6 deletions
+5 -2
View File
@@ -16,7 +16,7 @@ from pathlib import Path
import torch
from loop_common import (AdaptiveMergeAdapter, BandLooper, MergeAdapter,
RecurrentAdapter)
ParcaeAdapter, RecurrentAdapter)
from prep_mbpp import DIRECT_SUFFIX, extract_code, mbpp_prompt, run_tests
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
@@ -79,13 +79,16 @@ def main():
ap.add_argument("--adaptive", action="store_true")
ap.add_argument("--rec", action="store_true",
help="RecurrentAdapter (noise h0, learned A/B)")
ap.add_argument("--parcae", action="store_true",
help="ParcaeAdapter (rho(A)<1 by construction)")
args = ap.parse_args()
ks = [int(x) for x in args.ks.split(",")]
model, tok = load_model(dtype=torch.bfloat16)
tok.padding_side = "left"
looper = BandLooper(model)
cls = (RecurrentAdapter if args.rec
cls = (ParcaeAdapter if args.parcae
else RecurrentAdapter if args.rec
else AdaptiveMergeAdapter if args.adaptive else MergeAdapter)
kw = ({"alpha0": args.alpha} if args.adaptive else {"alpha": args.alpha})
adapter = cls(d=model.config.get_text_config().hidden_size, **kw).cuda()