Download native_runtime/contract.py from tinnel123/VisionJEV-4B: direct link, hf CLI and curl.
- Browser
- Download file 1.65 kB
-
https://huggingface.co/tinnel123/VisionJEV-4B/resolve/main/native_runtime/contract.py
- Command line
-
hf download hf://tinnel123/VisionJEV-4B/native_runtime/contract.py
-
curl -L -o contract.py https://huggingface.co/tinnel123/VisionJEV-4B/resolve/main/native_runtime/contract.py
1.65 kB
| """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)] | |