TiedAlphaAdapter: learned per-dim alpha with tied B (anchored by construction); pre-registration item 14
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,8 @@ import torch
|
||||
import torch.nn.functional as F
|
||||
|
||||
from loop_common import (AdaptiveMergeAdapter, BandLooper, MergeAdapter,
|
||||
ParcaeAdapter, PerDepthAdapter, RecurrentAdapter)
|
||||
ParcaeAdapter, PerDepthAdapter, RecurrentAdapter,
|
||||
TiedAlphaAdapter)
|
||||
from prep_mbpp import DIRECT_SUFFIX, mbpp_prompt
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||
@@ -61,6 +62,9 @@ ap.add_argument("--recmax", type=int, default=16)
|
||||
ap.add_argument("--parcae", action="store_true",
|
||||
help="rec regime with rho(A)<1 by construction "
|
||||
"(diag-negative-exp ZOH parameterization)")
|
||||
ap.add_argument("--tiedalpha", action="store_true",
|
||||
help="merge with learned per-dim constant alpha, B tied "
|
||||
"to (1-a); standard curriculum")
|
||||
ap.add_argument("--perdepth", type=int, default=0,
|
||||
help="PerDepthAdapter: one merge per iteration depth "
|
||||
"(Bae-style relaxation), standard curriculum")
|
||||
@@ -80,7 +84,8 @@ SUFFIX = ((f"_s{SEED}" if SEED else "")
|
||||
+ ("_warm" if ARGS.warm else "")
|
||||
+ (("_parcae" if ARGS.parcae else "_rec") + str(ARGS.recmax)
|
||||
if ARGS.rec else "")
|
||||
+ (f"_pd{ARGS.perdepth}" if ARGS.perdepth else ""))
|
||||
+ (f"_pd{ARGS.perdepth}" if ARGS.perdepth else "")
|
||||
+ ("_ta" if ARGS.tiedalpha else ""))
|
||||
PAUSE_ID = 6 # <unused0>
|
||||
|
||||
|
||||
@@ -139,7 +144,9 @@ def main():
|
||||
p.requires_grad_(False)
|
||||
looper = BandLooper(model)
|
||||
d = model.config.get_text_config().hidden_size
|
||||
if ARGS.perdepth:
|
||||
if ARGS.tiedalpha:
|
||||
adapter = TiedAlphaAdapter(d=d, alpha=ARGS.alpha).cuda()
|
||||
elif ARGS.perdepth:
|
||||
adapter = PerDepthAdapter(d=d, alpha=ARGS.alpha,
|
||||
n_depth=ARGS.perdepth).cuda()
|
||||
elif ARGS.parcae:
|
||||
|
||||
Reference in New Issue
Block a user