interplane.Get Omega
Read in your language

omega-helix

This project has not described itself yet.

Brought by drakestapleton

branch main Branches Tags History

omega-helix / scripts / openwaldo-train.sh

77 lines · 3048 bytes Raw Blame History
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)
15set -eu
16
17if [ $# -lt 1 ]; then
18 echo "usage: $0 <openwaldo-export-dir> [out-dir]" >&2
19 exit 2
20fi
21
22here=$(cd "$(dirname "$0")/.." && pwd)
23EXPORT_DIR=$1
24OUT_DIR=${2:-$here/run-openwaldo}
25VOCAB=${VOCAB:-4096}
26HELD_MOD=${HELD_MOD:-10}
27TRAIN=${TRAIN:-none}
28
29if [ ! -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"
36fi
37
38WALDO_BIN=$here/build/ollm-waldo
39[ -x "$WALDO_BIN" ] || TARGET=openwaldo sh "$here/scripts/build.sh"
40
41if [ "$(uname -s)" = Darwin ]; then
42 OLLM_BIN=$here/build/ollm-macos
43 [ -x "$OLLM_BIN" ] || TARGET=macos sh "$here/scripts/build.sh"
44elif [ "$TRAIN" = gb10 ]; then
45 OLLM_BIN=$here/build/ollm-gb10
46 [ -x "$OLLM_BIN" ] || TARGET=gb10 sh "$here/scripts/build.sh"
47else
48 OLLM_BIN=$here/build/ollm
49 [ -x "$OLLM_BIN" ] || TARGET=aarch64 sh "$here/scripts/build.sh"
50fi
51
52echo "=== Verifying OpenWALDO EXPORT.json and ingesting via pure-Omega ollm-waldo ==="
53python3 "$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
60if [ "$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"
66elif [ "$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"
75fi
76
77echo "OPENWALDO_PIPELINE_OK bom=$OUT_DIR/openwaldo-helix-bom.json"