Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-tool-model/blob/main/deployment/speed/prepare.py # omega-tool-model First-party Omega tool-use model source, serving harnesses, and verification records Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-tool-model / deployment / speed / prepare.py` 67 lines ยท 2784 bytes Raw Blame History 1 import os 2 """External preparation tool. Only the private measurement copy is edited.""" 3 from pathlib import Path 4 import hashlib,json,subprocess,difflib 5 R=Path(__file__).resolve().parent 6 D=(Path(os.path.expanduser('~')) / '/.local/share/omega-tool-model/round40'.lstrip('/')) 7 C=(Path(os.path.expanduser('~')) / '/handoffs/omega-llm-`20261101`/omega-mv/seed/out/omc'.lstrip('/')) 8 def sha(p):return hashlib.sha256(p.read_bytes()).hexdigest() 9 m=json.loads((D/'DEPLOYED.json').read_text()) 10 assert sha(D/'model.ck')==m['checkpoint_sha256'] 11 assert sha(D/'omega-tool-model')==m['runtime_sha256'] 12 assert sha(C)=='`2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`' 13 src=(D/'source.om').read_text() 14 out='global tmarks ulong 180\nglobal tbytes uchar 1440\n'+src 15 def change(a,b): 16 global out 17 assert out.count(a)==1,(a,out.count(a)) 18 out=out.replace(a,b) 19 change('fn main to int\niread\nnn = ulong 160','fn main to int\nput tmarks 0 ulong monons\niread\nput tmarks 1 ulong monons\nnn = ulong 160') 20 change('nn = ulong 160\nockload 1','nn = ulong 160\nockload 1\nput tmarks 2 ulong monons') 21 change('np = obprompt 3\nif ge np get og 1','np = obprompt 3\nput tmarks 7 np\nput tmarks 3 ulong monons\nif ge np get og 1') 22 change('ggopen\nggupw\nfor i ulong nn','ggopen\nggupw\nput tmarks 4 ulong monons\nfor i ulong nn') 23 change('c = gsnext\nif eq c 0\nbreak\nend\nobtput c\nocpush c\nend\noflush\nr = nvstop\nret 0', '''c = gsnext 24 if eq c 0 25 put tmarks 9 1 26 break 27 end 28 put tmarks add i 10 ulong monons 29 put tmarks 8 add i 1 30 obtput c 31 ocpush c 32 end 33 put tmarks 5 ulong monons 34 oflush 35 r = nvstop 36 put tmarks 6 ulong monons 37 timereport 38 ret 0''') 39 out+=''' 40 note Emit timing only after model output and device cleanup; 180 little-endian u64 values. 41 fn timereport to void 42 for i ulong 180 43 for j ulong 8 44 v = and shr get tmarks i mul j 8 255 45 put tbytes add mul i 8 j uchar v 46 end 47 end 48 p = ulong 0 49 while lt p len tbytes bound 1440 50 r = write 2 tbytes p sub len tbytes p 51 if le r 0 52 exit 70 53 end 54 p = add p ulong r 55 end 56 end 57 ''' 58 (R/'timed.om').write_text(out) 59 (R/'timing.diff').write_text(''.join(difflib.unified_diff(src.splitlines(True),out.splitlines(True),fromfile='installed',tofile='instrumented'))) 60 start=src.index('text nvctl ');end=src.index('fn main to int') 61 assert src[start:end]==out[out.index('text nvctl '):out.index('fn main to int')] 62 p=subprocess.run([str(C)],input=out.encode(),capture_output=True,timeout=60) 63 (R/'compile.stderr').write_bytes(p.stderr) 64 assert p.returncode==0,(p.returncode,p.stderr.decode()) 65 (R/'timed').write_bytes(p.stdout);(R/'timed').chmod(0o700) 66 (R/'pins.json').write_text(json.dumps({str(p):sha(p) for p in (D/'model.ck',D/'merges.bin',D/'omega-tool-model',D/'source.om',C,R/'timed.om',R/'timed')},indent=2)+'\n') 67 print('Private timing build passed; model and GPU source unchanged.')