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/native/omegese45/core/cli.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 / native / omegese45 / core / cli.om` 440 lines · 6794 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note oe45core command line (aien-train #45, pipeline lane); docs/omegese45/CORE-CLI.md. 3 note Build order: SHA unit (export words removed), vocab.om, msg.om, core/model.om, 4 note core/ckpt.om, core/run.om, core/cli.om. 5 note init CKDIR TRAIN.ids SEED P1 TOTAL ORDER LRSH step-0 checkpoint (lr = 2^-LRSH) 6 note train CKDIR TRAIN.ids UNTIL EVERY resume and train to step UNTIL 7 note evaldev CKDIR DEV.ids dev metrics line 8 note decode CKDIR U|G EPFILE one message line; rc 0 50 53 (40 prefix) 9 note batch CKDIR U|G INFILE OUTFILE one result line per prefix; rc 0 10 note info CKDIR header line of the loaded slot 11 note Exits: 0 ok, 2 usage or malformed data file, 40 invalid prefix, 50 DECODE_INVALID, 12 note 51 CKPT_REFUSED, 52 CKPT_VOCAB, 53 DECODE_BUDGET, 54 training data differs from the 13 note checkpoint binding, 70 file I/O. 14 const OPOBN ulong `4194304` 15 global opob uchar `4194305` 16 global opon ulong 1 17 global opcm uchar 16 18 text ophd "oe45 v1\n" 19 text opdl "D " 20 text opil "I " 21 22 note --- output buffer (batch) --- 23 fn opoc c uchar to void 24 n = get opon 0 25 if ge n OPOBN 26 exit 2 27 end 28 put opob n c 29 put opon 0 add n 1 30 end 31 32 fn opon10 v ulong to void 33 b = new uchar 24 0 34 p = ulong 24 35 if eq v 0 36 opoc 48 37 ret 38 end 39 while gt v 0 bound 24 40 p = sub p 1 41 put b p uchar add 48 rem v 10 42 v = div v 10 43 end 44 for i ulong sub 24 p 45 opoc get b add p i 46 end 47 end 48 49 note Word of id into the buffer; digits follow `0x` or a digit without a space. 50 fn opow id ulong pv ulong first bool to void 51 dg = and ge id 25 lt id OPV 52 if not or first and dg ge pv 24 53 opoc 32 54 end 55 o = get ocwo id 56 for j ulong get ocwl id 57 opoc get ocvtsv add o j 58 end 59 end 60 61 note Emitted ids opseq[s, s + n) as words. 62 fn opowds s ulong n ulong to void 63 pv = ulong 0 64 for i ulong n 65 id = ulong get opseq add s i 66 opow id pv eq i 0 67 pv = id 68 end 69 end 70 71 note --- prefix parsing --- 72 note Parse the OE45 v1 prefix in opdb[a, b) into opseq / opsl. The first line must be 73 note `oe45 v1`; each further line one message valid under the contract validator; the 74 note sequence G (A R)* or G followed by a final `act refuse C end` (interface §3: a refuse 75 note comes only right after G and gets no R; its P is decoded next). Ends in G, R or that 76 note refuse A (kind 5 below). 0 or 40. 77 fn opprefix a ulong b ulong to ulong 78 if not ophdr a b 79 ret 40 80 end 81 p = add a 8 82 n = ulong 0 83 lk = ulong 0 84 while lt p b bound 200 85 e = p 86 while and lt e b ne get opdb e 10 bound 4097 87 e = add e 1 88 end 89 if or ge e b gt sub e p 4095 90 ret 40 91 end 92 for i ulong sub e p 93 put ocin i get opdb add p i 94 end 95 k = ocvline sub e p 0 96 if lt k 0 97 ret 40 98 end 99 c = get ocnids 0 100 if not opnextk lk ulong k 101 ret 40 102 end 103 if and and eq k 2 eq get ocids 1 9 ne lk 1 104 ret 40 105 end 106 if gt add n c OPMAXL 107 ret 40 108 end 109 for i ulong c 110 put opseq add n i uchar get ocids i 111 end 112 n = add n c 113 lk = ulong k 114 if and eq k 2 eq get ocids 1 9 115 lk = ulong 5 116 end 117 p = add e 1 118 end 119 if not or or eq lk 1 eq lk 3 eq lk 5 120 ret 40 121 end 122 put opsl 0 n 123 ret 0 124 end 125 126 note Kind k may follow kind lk in a prefix (0 = nothing yet; 5 = a refuse A, which ends it). 127 fn opnextk lk ulong k ulong to bool 128 if eq lk 0 129 ret eq k 1 130 end 131 if or eq lk 1 eq lk 3 132 ret eq k 2 133 end 134 if eq lk 2 135 ret eq k 3 136 end 137 ret false 138 end 139 140 fn ophdr a ulong b ulong to bool 141 if gt add a 8 b 142 ret false 143 end 144 for i ulong 8 145 if ne get opdb add a i get ophd i 146 ret false 147 end 148 end 149 ret true 150 end 151 152 note --- subcommands --- 153 fn opmode i ulong to ulong 154 n = argread i opcm 0 16 155 if ne n 1 156 exit 2 157 end 158 m = ulong get opcm 0 159 if not or eq m 85 eq m 71 160 exit 2 161 end 162 ret m 163 end 164 165 fn opcinit to int 166 if ne argcnt 9 167 exit 2 168 end 169 opckdir 2 170 opldat 3 171 put opmeta 0 opdecu 4 172 put opmeta 3 opdecu 5 173 put opmeta 4 opdecu 6 174 put opmeta 5 opdecu 7 175 sh = opdecu 8 176 if or eq sh 0 gt sh 30 177 exit 2 178 end 179 put opmeta 6 shl sub 127 sh 23 180 put opmeta 7 1 181 put opmeta 1 0 182 put opmeta 2 0 183 for s ulong 2 184 n = opslp s 185 r = unlink opckp 0 n 186 end 187 opinit get opmeta 0 188 opvpin 189 opsave 190 ret 0 191 end 192 193 fn opbind to void 194 d = new uchar 32 0 195 for i ulong 32 196 put d i get optds i 197 end 198 ophdat 199 for i ulong 32 200 if ne get optds i get d i 201 exit 54 202 end 203 end 204 end 205 206 fn opctrain to int 207 if ne argcnt 6 208 exit 2 209 end 210 opckdir 2 211 opload 212 opread 3 213 opindex 214 opbind 215 until = opdecu 4 216 every = opdecu 5 217 if eq every 0 218 exit 2 219 end 220 optrain until every 221 ret 0 222 end 223 224 fn opcdev to int 225 if ne argcnt 4 226 exit 2 227 end 228 opckdir 2 229 opload 230 opldat 3 231 for i ulong 16 232 put opst i 0 233 end 234 n = get opne 0 235 for e ulong n 236 opepi e 237 opdevep 238 end 239 w = write 1 opdl 0 2 240 ocputn get opmeta 1 241 ocputc 32 242 ocputn n 243 for i ulong 5 244 ocputc 32 245 ocputn get opst add i 1 246 end 247 ocputc 10 248 ret 0 249 end 250 251 fn opcdec to int 252 if ne argcnt 5 253 exit 2 254 end 255 opckdir 2 256 md = opmode 3 257 opread 4 258 r = opprefix 0 get opdn 0 259 if ne r 0 260 exit 40 261 end 262 opload 263 n = get opsl 0 264 r = opdecode n md 265 if ne r 0 266 exit int r 267 end 268 c = get opln 0 269 for i ulong c 270 put ocids i ulong get opseq add n i 271 end 272 b = ocdec c 273 if lt b 0 274 exit 50 275 end 276 w = write 1 ocout 0 ulong b 277 ocputc 10 278 ret 0 279 end 280 281 note Next prefix start after a: the next line `oe45 v1` at a line start, or b. 282 fn opnextp a ulong b ulong to ulong 283 if ge add a 1 b 284 ret b 285 end 286 for q ulong sub b add a 1 287 p = add add a 1 q 288 if eq get opdb sub p 1 10 289 if ophdr p b 290 ret p 291 end 292 end 293 end 294 ret b 295 end 296 297 fn opcbat to int 298 if ne argcnt 6 299 exit 2 300 end 301 opckdir 2 302 md = opmode 3 303 opload 304 opread 4 305 b = get opdn 0 306 a = ulong 0 307 while lt a b bound 100000 308 e = opnextp a b 309 r = opprefix a e 310 if ne r 0 311 opon10 40 312 opoc 10 313 else 314 opbline md 315 end 316 a = e 317 end 318 n = oppath 5 319 fd = int fopen opfp 0 n 577 420 320 if lt fd 0 321 exit 70 322 end 323 p = ulong 0 324 while lt p get opon 0 bound 5000 325 w = write fd opob p sub get opon 0 p 326 if le w 0 327 exit 70 328 end 329 p = add p ulong w 330 end 331 if ne fsync fd 0 332 exit 70 333 end 334 if ne fclose fd 0 335 exit 70 336 end 337 ret 0 338 end 339 340 note One batch result line for the parsed prefix. 341 fn opbline md ulong to void 342 n = get opsl 0 343 r = opdecode n md 344 c = get opln 0 345 if eq r 0 346 opoc 111 347 opoc 107 348 opoc 32 349 for i ulong c 350 put ocids i ulong get opseq add n i 351 end 352 b = ocdec c 353 for i ulong ulong b 354 opoc get ocout i 355 end 356 else 357 opoc 101 358 opoc 114 359 opoc 114 360 opoc 32 361 opon10 r 362 if gt c 0 363 opoc 32 364 opowds n c 365 end 366 end 367 opoc 10 368 end 369 370 fn opcinfo to int 371 if ne argcnt 3 372 exit 2 373 end 374 opckdir 2 375 opload 376 w = write 1 opil 0 2 377 ocputc add 97 uchar get opslt 0 378 for i ulong 8 379 ocputc 32 380 ocputn get opmeta i 381 end 382 ocputc 32 383 for i ulong 32 384 opphex get opck add 112 i 385 end 386 ocputc 32 387 for i ulong 32 388 opphex get opck add 8 i 389 end 390 ocputc 32 391 for i ulong 32 392 opphex get opck add 144 i 393 end 394 ocputc 10 395 ret 0 396 end 397 398 fn opphex v uchar to void 399 opnib shr v 4 400 opnib and v 15 401 end 402 403 fn opnib v uchar to void 404 if lt v 10 405 ocputc add v 48 406 else 407 ocputc add v 87 408 end 409 end 410 411 fn main to int 412 if lt argcnt 2 413 exit 2 414 end 415 n = argread 1 opcm 0 16 416 if lt n 4 417 exit 2 418 end 419 c0 = get opcm 0 420 c1 = get opcm 1 421 if eq c0 105 422 if eq get opcm 2 105 423 ret opcinit 424 end 425 ret opcinfo 426 end 427 if eq c0 116 428 ret opctrain 429 end 430 if eq c0 101 431 ret opcdev 432 end 433 if eq c0 100 434 ret opcdec 435 end 436 if eq c0 98 437 ret opcbat 438 end 439 exit 2 440 end