omega-helix
This project has not described itself yet.
Brought by drakestapleton
omega-helix / scripts / openwaldo-train.sh
| 1 | #!/bin/sh |
| 2 | # End-to-end OpenWALDO -> Omega Helix verified dataset preparation & training pipeline. |
| 3 | # |
| 4 | # Usage: |
| 5 | # sh scripts/openwaldo-train.sh <openwaldo-export-dir> [out-dir] |
| 6 | # OPENWALDO_CORPUS=core/example sh scripts/openwaldo-train.sh ./waldo-export ./run-waldo |
| 7 | # |
| 8 | # Env: |
| 9 | # OPENWALDO_CORPUS Optional OpenWALDO index path (e.g. core/example); runs |
| 10 | # `waldo index export --format jsonl` if export-dir does not exist yet |
| 11 | # VOCAB BPE vocabulary size (default: 4096; set 256 for byte-level) |
| 12 | # HELD_MOD Held-out split modulus (default: 10 -> 10% held-out; 0 disables) |
| 13 | # TRAIN Set to cpu or gb10 to launch training after preparation (default: none) |
| 14 | # OMC Path to seeded omc compiler (auto-detected if unset) |
| 15 | set -eu |
| 16 | |
| 17 | if [ $# -lt 1 ]; then |
| 18 | echo "usage: $0 <openwaldo-export-dir> [out-dir]" >&2 |
| 19 | exit 2 |
| 20 | fi |
| 21 | |
| 22 | here=$(cd "$(dirname "$0")/.." && pwd) |
| 23 | EXPORT_DIR=$1 |
| 24 | OUT_DIR=${2:-$here/run-openwaldo} |
| 25 | VOCAB=${VOCAB:-4096} |
| 26 | HELD_MOD=${HELD_MOD:-10} |
| 27 | TRAIN=${TRAIN:-none} |
| 28 | |
| 29 | if [ ! -f "$EXPORT_DIR/EXPORT.json" ] && [ -n "${OPENWALDO_CORPUS:-}" ]; then |
| 30 | command -v waldo >/dev/null 2>&1 || { |
| 31 | echo "error: 'waldo' CLI not found; install from https://github.com/openwaldo/waldo" >&2 |
| 32 | exit 1 |
| 33 | } |
| 34 | echo "=== Exporting OpenWALDO corpus '$OPENWALDO_CORPUS' as canonical JSONL ===" |
| 35 | waldo index export --format jsonl "$OPENWALDO_CORPUS" "$EXPORT_DIR" |
| 36 | fi |
| 37 | |
| 38 | WALDO_BIN=$here/build/ollm-waldo |
| 39 | [ -x "$WALDO_BIN" ] || TARGET=openwaldo sh "$here/scripts/build.sh" |
| 40 | |
| 41 | if [ "$(uname -s)" = Darwin ]; then |
| 42 | OLLM_BIN=$here/build/ollm-macos |
| 43 | [ -x "$OLLM_BIN" ] || TARGET=macos sh "$here/scripts/build.sh" |
| 44 | elif [ "$TRAIN" = gb10 ]; then |
| 45 | OLLM_BIN=$here/build/ollm-gb10 |
| 46 | [ -x "$OLLM_BIN" ] || TARGET=gb10 sh "$here/scripts/build.sh" |
| 47 | else |
| 48 | OLLM_BIN=$here/build/ollm |
| 49 | [ -x "$OLLM_BIN" ] || TARGET=aarch64 sh "$here/scripts/build.sh" |
| 50 | fi |
| 51 | |
| 52 | echo "=== Verifying OpenWALDO EXPORT.json and ingesting via pure-Omega ollm-waldo ===" |
| 53 | python3 "$here/tools/openwaldo/openwaldo_bridge.py" prepare \ |
| 54 | "$EXPORT_DIR" "$OUT_DIR" \ |
| 55 | --ollm-waldo "$WALDO_BIN" \ |
| 56 | --ollm "$OLLM_BIN" \ |
| 57 | --vocab "$VOCAB" \ |
| 58 | --held-mod "$HELD_MOD" |
| 59 | |
| 60 | if [ "$TRAIN" = gb10 ]; then |
| 61 | echo "=== Launching GB10 BF16 training on verified OpenWALDO corpus ===" |
| 62 | RUNDIR="$OUT_DIR/gb10" sh "$here/scripts/train-gb10-bf16.sh" \ |
| 63 | "$OUT_DIR/train.tok" "$OUT_DIR/held.tok" "$OUT_DIR/merges${VOCAB}.bin" |
| 64 | python3 "$here/tools/openwaldo/openwaldo_bridge.py" bind-checkpoint \ |
| 65 | "$OUT_DIR/openwaldo-helix-bom.json" "$OUT_DIR/gb10/ck.bin" |
| 66 | elif [ "$TRAIN" = cpu ]; then |
| 67 | echo "=== Running CPU training smoke run on verified OpenWALDO corpus ===" |
| 68 | CK="$OUT_DIR/cpu.ck" |
| 69 | DATA="$OUT_DIR/train.bin" |
| 70 | [ "$VOCAB" -gt 256 ] && DATA="$OUT_DIR/train.tok" |
| 71 | "$OLLM_BIN" init "$CK" "$VOCAB" 64 64 4 256 2 4 1 50 3000 1 |
| 72 | "$OLLM_BIN" train "$CK" "$DATA" 50 10 |
| 73 | python3 "$here/tools/openwaldo/openwaldo_bridge.py" bind-checkpoint \ |
| 74 | "$OUT_DIR/openwaldo-helix-bom.json" "$CK" |
| 75 | fi |
| 76 | |
| 77 | echo "OPENWALDO_PIPELINE_OK bom=$OUT_DIR/openwaldo-helix-bom.json" |