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 / docs / OPENWALDO.md

104 lines · 5644 bytes Raw Blame History Rendered
1# OpenWALDO Open-Source Training Dataset Integration
2
3Omega Helix connects directly to [**OpenWALDO**](https://github.com/openwaldo/waldo) (Open Weights, Artifacts, Licenses, Data, Origins) so models can be trained on a **100% open-source, license-audited, cryptographically pinned corpus** with end-to-end provenance from raw shards to trained `OLLMCK0x` checkpoints.
4
5## Architecture & Trust Boundary
6
7```text
8OpenWALDO Git Index + Lookaside
9 │ waldo index export --format jsonl <corpus> <export-dir>
10 ▼
11 <export-dir>/EXPORT.json + data/**/*.jsonl
12 │
13 ├─ 1. Fail-closed verification (`tools/openwaldo/openwaldo_bridge.py verify`)
14 │ • Validates `kind == "waldo-corpus-export"`, `schema == 1`, `bom.kind == "openwaldo-bom"`
15 │ • Rejects path traversal (`..`, absolute paths, non-`data/` paths)
16 │ • Verifies every shard's byte size & SHA-256 against `EXPORT.json` and `bom.shards`
17 │ • Verifies every JSONL record's `sha256 == sha256(utf8(text))`, `kind`, `source`, `license`
18 │
19 ├─ 2. Pure seeded-Omega ingestion (`tools/openwaldo/waldo_ingest.om` -> `build/ollm-waldo`)
20 │ • Strict RFC 8259 JSON parsing using `native/net/json.om` (zero C, zero Python, zero libc)
21 │ • Streams `kind == "pretrain"` text verbatim + NUL (`\0`) EOS terminator
22 │ • Renders `kind == "conversation"` turns as `role: content\n` (matching `native/serve.om`) + `\0`
23 │ • Deterministic train/held split (`i mod HELD_MOD == HELD_MOD - 1 -> held.bin`)
24 │
25 ├─ 3. Tokenization & Multi-Architecture Training (`omega_helix_backend.py`)
26 │ • BPE (`ollm bpefit`/`bpeenc`), byte-level (`V >= 256`), or `u32` (`V > 65535`)
27 │ • Trains ANY `ollm-univ` (`OLLMCK04`) architecture: `llama`, `qwen2`, `qwen3`,
28 │ `mistral`, `gemma`, `gpt`, `gelu`, looped cores (`LP/LC/NP`), or `custom` flags
29 │ • Imports HuggingFace Safetensors bases & exports Safetensors (`F32`/`BF16`) + GGUF v3
30 │
31 └─ 4. Provenance BOM (`openwaldo-helix-bom.json` + `openwaldo-helix-observations.json`)
32 • Cryptographically links `EXPORT.json` SHA-256, shard `object_sha256`s, licenses,
33 tokenizer & token file SHA-256s, trained `OLLMCK04` / HF / GGUF SHA-256s, and eval metrics
34```
35
36## Quick Start
37
38### 1. Export a verified OpenWALDO corpus as canonical JSONL
39```sh
40# Install waldo from https://github.com/openwaldo/waldo
41waldo index export --format jsonl core/example ./waldo-export
42```
43
44### 2. Universal OpenWALDO Backend Adapter (Any Architecture, End-to-End)
45Build `openwaldo`, `univ`, `interchange`, and CPU binaries, then train `llama`, `qwen3`, `gemma`, `gpt`, looped cores, or fine-tune an imported HF Safetensors checkpoint in one fail-closed command:
46```sh
47TARGET=openwaldo sh scripts/build.sh
48TARGET=univ sh scripts/build.sh
49TARGET=interchange sh scripts/build.sh
50TARGET=macos sh scripts/build.sh # or TARGET=aarch64 on Linux
51
52python3 tools/openwaldo/omega_helix_backend.py \
53 --export-dir ./waldo-export \
54 --workdir ./run-waldo-qwen3 \
55 --arch qwen3 --tokenizer bpe --vocab 4096 \
56 -T 256 -D 384 -H 12 -H_KV 4 -F 1536 -L 4 -B 2 \
57 --steps 100 --lr-micro 3000 --export-hf --export-gguf
58```
59Outputs verified `openwaldo-helix-bom.json` and `openwaldo-helix-observations.json` with SHA-256 hashes of every dataset shard, token stream, `OLLMCK04` checkpoint, HuggingFace `config.json` + `model.safetensors`, GGUF v3 file, and before/after held-out NLL & BPB. Accepts `--spec job.json`, `--hf-dir ./hf-model`, `--LP/--LC/--NP` looped cores, and custom `--flags`.
60
61### 3. Shell Pipeline & GB10 Fast Path (`scripts/openwaldo-train.sh`)
62```sh
63# Verify EXPORT.json + ingest via pure-Omega ollm-waldo + tokenize (V=4096)
64sh scripts/openwaldo-train.sh ./waldo-export ./run-waldo
65
66# Or export + verify + train on DGX Spark GB10 (85k tok/s BF16) in one command:
67OPENWALDO_CORPUS=core/example TRAIN=gb10 sh scripts/openwaldo-train.sh ./waldo-export ./run-waldo
68```
69
70### 4. Bind an external checkpoint to the OpenWALDO BOM
71```sh
72python3 tools/openwaldo/openwaldo_bridge.py bind-checkpoint \
73 ./run-waldo/openwaldo-helix-bom.json ./run-waldo/gb10/ck.bin
74```
75
76## Standalone Pure-Omega Ingestor (`ollm-waldo`)
77
78Build `ollm-waldo` on Linux AArch64 or Apple Silicon macOS:
79```sh
80TARGET=openwaldo sh scripts/build.sh
81./build/ollm-waldo verified.jsonl train.bin held.bin 10
82# stdout: W <total_docs> <train_docs> <held_docs> <train_bytes> <held_bytes>
83```
84
85Exit codes (fail-closed):
86- `0`: success
87- `2`: usage error
88- `21`: malformed JSON or line > `983,040` bytes
89- `22`: missing/invalid `sha256`, `kind`, `text`, `source`, or `license`
90- `23`: invalid `conversation` JSON or missing `messages`/`role`/`content`
91- `70`: I/O error
92
93## Tests & Negative Controls
94
95```sh
96TARGET=openwaldo sh scripts/build.sh
97TARGET=univ sh scripts/build.sh
98TARGET=interchange sh scripts/build.sh
99OLLM_WALDO_BIN=./build/ollm-waldo \
100OLLM_UNIV_BIN=./build/ollm-univ \
101OLLM_INTERCHANGE_BIN=./build/ollm-interchange \
102 python3 -m unittest discover -s tools/openwaldo -p "test_*.py" -v
103```
104All 25 tests verify valid `waldo-corpus-export` schema-1 fixtures (`pretrain` + `conversation`), pure-Omega ingestion, end-to-end multi-architecture training (`llama`, `mistral`, `qwen2`, `qwen3`, `gemma`, `gpt`, `gelu`, looped cores, custom flags, `u16`/`u32` tokens, BPE), HuggingFace BF16 + GGUF v3 exports & re-import fine-tuning, deterministic reproducibility, BOM binding, and fail-closed refusals.