interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / train / omega-llm / tools / contrast / replay.sh

42 lines · 1831 bytes Raw Blame History
1#!/usr/bin/env bash
2set -euo pipefail
3bin=$(realpath "$1")
4omc=$(realpath "$2")
5data=$(realpath run-01)
6work=$(mktemp -d)
7trap 'rm -rf "$work"' EXIT
8cd "$work"
9for panel in fresh example earlier; do
10 mkdir "gold-$panel"
11 (cd "gold-$panel" && "$bin/grade" "$data/$panel.json" "$omc" >grades)
12 test "$(wc -l <"gold-$panel/grades")" -eq "$(jq length "$data/$panel.json")"
13done
14for model in parent control treatment mean starting focused; do
15 for panel in $(jq -r --arg m "$model" '.[$m]|keys[]' "$data/generations.json"); do
16 dir="$model-$panel"
17 mkdir "$dir"
18 (cd "$dir"
19 jq -r --arg m "$model" --arg p "$panel" '.[$m][$p][] | .body | @base64' "$data/generations.json" |
20 { i=0; while IFS= read -r encoded; do printf %s "$encoded" | base64 -d >"answer-$i"; i=$((i+1)); done; }
21 "$bin/grade" "$data/$panel.json" "$omc" cached >grades
22 jq -r --arg m "$model" --arg p "$panel" '.[$m][$p] | to_entries[] | "\(.key) \(.value.grade)"' "$data/generations.json" | cmp - grades)
23 done
24done
25for mode in example compile; do
26 dir="selected-$mode"
27 mkdir "$dir"
28 args=()
29 if [[ $mode == compile ]]; then args+=(compile); fi
30 (cd "$dir"
31 "$bin/select" "$data/example.json" "$omc" ../parent-fresh ../control-fresh ../treatment-fresh "${args[@]}" >choices
32 "$bin/grade" "$data/fresh.json" "$omc" cached >grades
33 cmp grades "$data/$dir.grades" && cmp choices "$data/$dir.choices")
34done
35"$bin/contrast" > contrast.om
36sha256sum -c "$data/contrast.sha256"
37# Cross both original limits. Compare the complete record multiset including duplicates.
38for _ in {1..12}; do cat contrast.om; done >old.om
39"$bin/mix"
40cat old.om contrast.om | LC_ALL=C sort -z >expected.records
41LC_ALL=C sort -z mixed.om | cmp - expected.records
42echo "All reference functions, archived generations and fresh chain selections reproduced."