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/aien-train/blob/main/tools/omegallm/wdrive/wpolicy.om # aien-train AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished. 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 `aien-train / tools / omegallm / wdrive / wpolicy.om` 315 lines ยท 6184 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note wpolicy.om (DRA-187, lane wsp): PREREG section 9 driver. Composed after wbuild.om: 3 note OMC=omc wbuild OUT/wpolicy tools/omegallm/wdrive/wbuild.om@wbmain tools/omegallm/wdrive/wpolicy.om 4 note Usage: wpolicy prep|run BASE P0 P2 WORKDIR 5 note BASE is the unedited checkpoint, P0 the edit with Adam m and v kept (wpatch policy 0 or wprobe save), 6 note P2 the same edit applied by wpatch with policy 2 (m and v of the changed entries zeroed). 7 note Both modes first run `WPROBE survive BASE P0 BASE P0 P2` and print its line after PRE: it exits 67 8 note when P2's weights differ from P0's and 68 when P0 changes nothing. Then each of BASE, P0, P2 is 9 note copied to WORKDIR/base.ck, p0.ck, p2.ck; its header word 9 (step) and word 10 (total) must both be 10 note 600, and word 10 is set to 601 so that `ollm train` takes exactly one step (the payload FNV covers 11 note only the payload, so it stays valid). Prints PREP NAME PATH per copy. 12 note run then trains each copy one step on TRAIN, stdout to WORKDIR/NAME.train.log, printing 13 note TRAIN NAME RC LOG, and prints the edit survival of each policy against the base's own step: 14 note p0 S ... from WPROBE survive BASE P0 WORKDIR/base.ck WORKDIR/p0.ck P2 15 note p2 S ... from WPROBE survive BASE P2 WORKDIR/base.ck WORKDIR/p2.ck 16 note (wprobe's survive: changed count, survival /, largest |d1 - d0| / |d0|). 17 note Every child runs under the pool lock LOCK (taken in this process with flock(2), at most 7200 s, as 18 note `flock -w 7200 -o` did; a timeout counts as exit status 1), with an empty environment, as 19 note /usr/bin/taskset -c POOL /usr/bin/nice -n 10 ... 20 note Environment: HOME (required), POOL (default 19), LOCK (default HOME/handoffs/hive/queen/pool-POOL.lock), 21 note OLLM (default HOME/work/wsp/build/ollm), WPROBE (default HOME/work/wsp/build/wprobe), TRAIN (default 22 note HOME/handoffs/tool-omega-`20261104`/round40/data/train.tok). 23 note Exits: 0 done, 1 a child exited nonzero (stderr FAIL STEP rc=N), 2 usage, 65 a header is not at 24 note step 600 of 600 (stderr HEADER NAME STEP TOTAL), 70 I/O. 25 26 note string slots (wdz, see wbuild.om): 0 HOME, 1 POOL, 2 LOCK, 3 OLLM, 4 WPROBE, 5 TRAIN, 6 BASE, 27 note 7 P0, 8 P2, 9 WORKDIR, 10 11 12 the copies WORKDIR/base.ck, p0.ck, p2.ck 28 text wptollm "OLLM" 29 text wptwp "WPROBE" 30 text wpttr "TRAIN" 31 text wpdollm "/work/wsp/build/ollm" 32 text wpdwp "/work/wsp/build/wprobe" 33 text wpdtr "/handoffs/tool-omega-`20261104`/round40/data/train.tok" 34 text wpprep "prep" 35 text wprun "run" 36 text wpsvt "survive" 37 text wptrain "train" 38 text wp601 "601" 39 text wpone "1" 40 text wpkb "base" 41 text wpk0 "p0" 42 text wpk2 "p2" 43 text wpsck ".ck" 44 text wpslog ".train.log" 45 text wppre "PRE " 46 text wpprp "PREP " 47 text wptrn "TRAIN " 48 text wphdr "HEADER " 49 text wpfail "FAIL " 50 text wprc " rc=" 51 text wpcantt "cannot open " 52 text wpnl "\n" 53 text wpuse "usage: wpolicy prep|run BASE P0 P2 WORKDIR\n" 54 55 fn wpusage to void 56 wdoclr 57 wdot wpuse 58 wdoflush 2 59 exit 2 60 end 61 62 note argument bytes wdab[0 .. n) equal t 63 fn wpargeq n ulong t view uchar * to bool 64 if ne n len t 65 ret false 66 end 67 for j ulong n 68 if ne get wdab j get t j 69 ret false 70 end 71 end 72 ret true 73 end 74 75 note the name of copy i (0 base, 1 p0, 2 p2) to the output, to the path builder 76 fn wponame i ulong to void 77 if eq i 0 78 wdot wpkb 79 end 80 if eq i 1 81 wdot wpk0 82 end 83 if eq i 2 84 wdot wpk2 85 end 86 end 87 88 fn wppname i ulong to void 89 if eq i 0 90 wdpt wpkb 91 end 92 if eq i 1 93 wdpt wpk0 94 end 95 if eq i 2 96 wdpt wpk2 97 end 98 end 99 100 note WORKDIR/NAME followed by sfx 101 fn wpdst i ulong sfx view uchar * to void 102 wdpclr 103 wdzp 9 104 wdpc 47 105 wppname i 106 wdpt sfx 107 end 108 109 fn wpslot k ulong to void 110 wdpclr 111 wdzp k 112 wdkp 113 end 114 115 note the path in wdp could not be opened 116 fn wpcant to void 117 wdoclr 118 wdot wpcantt 119 wdop 120 wdot wpnl 121 wdoflush 2 122 exit 70 123 end 124 125 fn wpfailx st view uchar * rc long to void 126 wdoclr 127 wdot wpfail 128 wdot st 129 wdot wprc 130 wdod ulong rc 131 wdot wpnl 132 wdoflush 2 133 exit 1 134 end 135 136 note survive BASE EDIT BASE1 EDIT1 [EDIT2] from slots; e2 0 leaves EDIT2 out. Prints pre first, then 137 note wprobe's line follows on the same stdout. 138 fn wpsurv a ulong b ulong c ulong d ulong e2 ulong to void 139 wdkpre 140 wpslot 4 141 wdkt wpsvt 142 wpslot a 143 wpslot b 144 wpslot c 145 wpslot d 146 if gt e2 0 147 wpslot e2 148 end 149 rc = wdpoolrun -1 -1 -1 150 if ne rc 0 151 wpfailx wpsvt rc 152 end 153 end 154 155 fn wpu64 h view uchar * o ulong to ulong 156 x = ulong 0 157 for k ulong 8 158 x = or x shl ulong get h add o k mul k 8 159 end 160 ret x 161 end 162 163 note copy source slot 6 + i to WORKDIR/NAME.ck; check and raise the header's total 164 fn wpcopy i ulong to void 165 h = new uchar 120 0 166 wdpclr 167 wdzp add 6 i 168 fi = wdopen 0 0 169 if lt fi 0 170 wpcant 171 end 172 wpdst i wpsck 173 fo = wdopen 578 436 174 if lt fo 0 175 wpcant 176 end 177 wdcopyfd fi fo 178 c = fclose fi 179 r = pread fo h 0 120 0 180 if ne r 120 181 exit 70 182 end 183 st = wpu64 h 72 184 tot = wpu64 h 80 185 if or ne st 600 ne tot 600 186 wdoclr 187 wdot wphdr 188 wponame i 189 wdoc 32 190 wdod st 191 wdoc 32 192 wdod tot 193 wdot wpnl 194 wdoflush 2 195 exit 65 196 end 197 v = ulong 601 198 for k ulong 8 199 put h k uchar and shr v mul k 8 255 200 end 201 w = pwrite fo h 0 8 80 202 if ne w 8 203 exit 70 204 end 205 c2 = fclose fo 206 if ne c2 0 207 exit 70 208 end 209 wdoclr 210 wdot wpprp 211 wponame i 212 wdoc 32 213 wpdst i wpsck 214 wdop 215 wdot wpnl 216 wdoflush 1 217 end 218 219 note one training step of WORKDIR/NAME.ck, stdout to WORKDIR/NAME.train.log 220 fn wptrain1 i ulong to void 221 wpdst i wpslog 222 fo = wdopen 577 436 223 if lt fo 0 224 wpcant 225 end 226 wdkpre 227 wpslot 3 228 wdkt wptrain 229 wpdst i wpsck 230 wdkp 231 wpslot 5 232 wdkt wp601 233 wdkt wpone 234 rc = wdpoolrun -1 fo -1 235 c = fclose fo 236 wdoclr 237 wdot wptrn 238 wponame i 239 wdoc 32 240 wdod ulong rc 241 wdoc 32 242 wpdst i wpslog 243 wdop 244 wdot wpnl 245 wdoflush 1 246 if ne rc 0 247 wpfailx wptrain rc 248 end 249 end 250 251 note copy i's path into slot 10 + i 252 fn wpsetdst i ulong to void 253 wpdst i wpsck 254 wdzsave add 10 i 255 end 256 257 fn wpsetup to void 258 wdzpool 259 wdzenv wptollm 3 wpdollm 260 wdzenv wptwp 4 wpdwp 261 wdzenv wpttr 5 wpdtr 262 for i ulong 4 263 wdpclr 264 wdpa add i 2 265 wdzsave add i 6 266 end 267 end 268 269 fn main to int 270 if ne argcnt 6 271 wpusage 272 end 273 n = wdarg 1 274 md = ulong 0 275 if wpargeq n wpprep 276 md = 1 277 end 278 if wpargeq n wprun 279 md = 2 280 end 281 if eq md 0 282 wpusage 283 end 284 wpsetup 285 wdpclr 286 wdzp 9 287 m = makedir wdp 0 get wdpn 0 509 288 for i ulong 3 289 wpsetdst i 290 end 291 wdoclr 292 wdot wppre 293 wdoflush 1 294 wpsurv 6 7 6 7 8 295 for i2 ulong 3 296 wpcopy i2 297 end 298 if eq md 1 299 ret 0 300 end 301 for i3 ulong 3 302 wptrain1 i3 303 end 304 wdoclr 305 wdot wpk0 306 wdoc 32 307 wdoflush 1 308 wpsurv 6 7 10 11 8 309 wdoclr 310 wdot wpk2 311 wdoc 32 312 wdoflush 1 313 wpsurv 6 8 10 12 0 314 ret 0 315 end