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
aien-train / native / neuralese / nl1r-task / main.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | text TCH "C,2," |
| 3 | fn thead to void |
| 4 | z = write 1 TCH 0 len TCH |
| 5 | if ne z long len TCH |
| 6 | exit 80 |
| 7 | end |
| 8 | field get TC 0 |
| 9 | field get TC 1 |
| 10 | field get TC 2 |
| 11 | field 4 |
| 12 | field 40 |
| 13 | field get NSH 3 |
| 14 | outnum 0 |
| 15 | newline |
| 16 | for i ulong 40 |
| 17 | z = write 1 PT 0 len PT |
| 18 | if ne z long len PT |
| 19 | exit 80 |
| 20 | end |
| 21 | field i |
| 22 | outnum bitcast ulong get NP i |
| 23 | newline |
| 24 | end |
| 25 | end |
| 26 | fn trow id ulong arm ulong variant ulong enc long dec long rc int to void |
| 27 | z = write 1 RT 0 len RT |
| 28 | if ne z long len RT |
| 29 | exit 80 |
| 30 | end |
| 31 | field id |
| 32 | field arm |
| 33 | field variant |
| 34 | field get TL 0 |
| 35 | for i ulong 32 |
| 36 | field ulong get WB i |
| 37 | end |
| 38 | for j ulong 4 |
| 39 | field bitcast ulong get NO j |
| 40 | end |
| 41 | for j ulong 4 |
| 42 | p = ulong 0 |
| 43 | if ge get NO j 0.5f64 |
| 44 | p = 1 |
| 45 | end |
| 46 | field p |
| 47 | end |
| 48 | field tabst rc |
| 49 | field ulong enc |
| 50 | field ulong dec |
| 51 | field ulong rc |
| 52 | context = ulong 0 |
| 53 | if eq get TC 0 2 |
| 54 | context = and id 3 |
| 55 | end |
| 56 | field context |
| 57 | outnum 0 |
| 58 | newline |
| 59 | end |
| 60 | fn tcases to int |
| 61 | for id ulong 16 |
| 62 | context = ulong 0 |
| 63 | if eq get TC 0 2 |
| 64 | context = and id 3 |
| 65 | end |
| 66 | for arm ulong 5 |
| 67 | for variant ulong 3 |
| 68 | start = monons |
| 69 | rc = tencode id arm variant |
| 70 | if ne rc 0 |
| 71 | ret rc |
| 72 | end |
| 73 | mid = monons |
| 74 | note Refused raw records are canonical zeros; decoder itself is atomic on refusal. |
| 75 | for j ulong 4 |
| 76 | put NO j 0.0f64 |
| 77 | end |
| 78 | rc = tdecode 2 arm variant context get TL 0 0 |
| 79 | finish = monons |
| 80 | if eq variant 2 |
| 81 | if ne rc 2 |
| 82 | ret 71 |
| 83 | end |
| 84 | else |
| 85 | if ne rc 0 |
| 86 | ret rc |
| 87 | end |
| 88 | end |
| 89 | trow id arm variant sub mid start sub finish mid rc |
| 90 | end |
| 91 | end |
| 92 | end |
| 93 | ret 0 |
| 94 | end |
| 95 | fn main to int |
| 96 | if ne argcnt 4 |
| 97 | ret 90 |
| 98 | end |
| 99 | task = argnum 1 |
| 100 | seed = argnum 2 |
| 101 | mask = argnum 3 |
| 102 | if or gt task 2 or eq seed 0 gt seed 4294967295 |
| 103 | ret 90 |
| 104 | end |
| 105 | if or eq mask 0 gt mask 65535 |
| 106 | ret 90 |
| 107 | end |
| 108 | put TC 0 task |
| 109 | put TC 1 seed |
| 110 | put TC 2 mask |
| 111 | rc = nshape 1 |
| 112 | if ne rc 0 |
| 113 | ret rc |
| 114 | end |
| 115 | start = monons |
| 116 | ninit seed |
| 117 | rc = ttrain mask |
| 118 | finish = monons |
| 119 | if ne rc 0 |
| 120 | ret rc |
| 121 | end |
| 122 | thead |
| 123 | rc = tcases |
| 124 | if ne rc 0 |
| 125 | ret rc |
| 126 | end |
| 127 | note T measures initialization and training; per-row encode/decode and judge costs are separate. |
| 128 | z = write 1 TT 0 len TT |
| 129 | if ne z long len TT |
| 130 | ret 80 |
| 131 | end |
| 132 | field ulong start |
| 133 | outnum ulong finish |
| 134 | newline |
| 135 | z = write 1 DONE 0 len DONE |
| 136 | if ne z long len DONE |
| 137 | ret 80 |
| 138 | end |
| 139 | ret 0 |
| 140 | end |