File size: 1,454 Bytes
26d15fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Build an eval-time T=<N> variant of a loop model (config-only clone; weights identical).
For the P2 T-sweep (does entity tracking degrade monotonically as inference iterations grow?).

Usage: python make_t_variant.py <SRC_TAG> <T>
  e.g. python make_t_variant.py loop2_full 2      -> hf_loop2_T2        (legacy naming, frozen)
       python make_t_variant.py loop2_full_s1 4   -> hf_loop2_T4_s1    (legacy naming, frozen)
       python make_t_variant.py bind1_tt1_s0 2    -> hf_bind1_tt1_s0_ti2  (new naming, NAMING.md)
Legacy 'full' tags keep the baked 'full'->'T<N>' replacement; everything else gets the
new-generation `_ti<N>` suffix so physical == logical name (fill_meta/oracle tooling relies on it).
"""
import os, sys, json, shutil
_ROOT = os.environ.get("BABYLM_ROOT", os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
WORK = os.environ.get("BABYLM_WORK", os.path.join(_ROOT, "alaya-strict-small"))

srctag = sys.argv[1]; T = int(sys.argv[2])
src = os.path.join(WORK, "hf_" + srctag)
assert os.path.exists(src), f"{src} missing (export the loop model first)"
name = ("hf_" + srctag.replace("full", f"T{T}")) if "full" in srctag else f"hf_{srctag}_ti{T}"
dst = os.path.join(WORK, name)
if os.path.exists(dst): shutil.rmtree(dst)
shutil.copytree(src, dst)
p = os.path.join(dst, "config.json")
c = json.load(open(p, encoding="utf-8")); c["T"] = T
json.dump(c, open(p, "w", encoding="utf-8"), indent=2)
print(f"built {dst}  (T={T})")