File size: 1,653 Bytes
1120183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
30
31
32
"""Prespecified single Flash warmstart epoch; original gold, no teacher dependency."""
import math,json,hashlib,random
EXP='F4B-ERROR-TARGETED-GT725-20261022-V1'
TEMPERATURE=1.5539092221462472
REVISION='6d771ad7b5ecff5e93b8fc7b90d4c5ccc341954d'
MODEL_ID='b92d6898a1a0cebeec8573c3ba34cfbb810a2920fc49da60097f3a8e2de24ebc'

def need(v,reason):
 if not v:raise ValueError(reason)

def digest(v):return hashlib.sha256(json.dumps(v,ensure_ascii=False,sort_keys=True,separators=(',',':'),allow_nan=False).encode()).hexdigest()

def target(row,option_keys):
 y=row['target'];need(isinstance(y,list)and 1<=len(y)<=255,'full original255 distribution')
 need(len(y)==len(option_keys),'Source target/code ABI differs; never add/drop/argmax slots')
 need(all(type(v)in(int,float)and math.isfinite(v)and v>=0 for v in y),'finite source target')
 need(abs(math.fsum(y)-1.)<=1e-5,'C2 original normalized target required; no silent new normalization')
 return tuple(y)

def lr_factor(step,total):
 need(type(step)is int and type(total)is int and 1<=step<=total,'Actual optimizer step boundary')
 warmup=max(1,int(total*.15))
 return step/warmup if step<=warmup else .1+.45*(1+math.cos(math.pi*(step-warmup)/max(1,total-warmup)))

def training_order(rows,seed=20260920,window=8192,batch=256):
 need(batch==256 and rows,'Actual C1 frozen9150 source order')
 return [list(range(i,min(i+batch,len(rows))))for i in range(0,len(rows),batch)]

def rank_micro_indices(group,rank,world=8):
 need(world==8 and 0<=rank<world and 1<=len(group)<=256,'Frozen global256/world8')
 return [group[i]if i<len(group)else None for i in range(rank,256,world)]