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
omega-mv / train / omega-llm / tools / contrast / replay.sh
| 1 | #!/usr/bin/env bash |
| 2 | set -euo pipefail |
| 3 | bin=$(realpath "$1") |
| 4 | omc=$(realpath "$2") |
| 5 | data=$(realpath run-01) |
| 6 | work=$(mktemp -d) |
| 7 | trap 'rm -rf "$work"' EXIT |
| 8 | cd "$work" |
| 9 | for 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")" |
| 13 | done |
| 14 | for 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 |
| 24 | done |
| 25 | for 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") |
| 34 | done |
| 35 | "$bin/contrast" > contrast.om |
| 36 | sha256sum -c "$data/contrast.sha256" |
| 37 | # Cross both original limits. Compare the complete record multiset including duplicates. |
| 38 | for _ in {1..12}; do cat contrast.om; done >old.om |
| 39 | "$bin/mix" |
| 40 | cat old.om contrast.om | LC_ALL=C sort -z >expected.records |
| 41 | LC_ALL=C sort -z mixed.om | cmp - expected.records |
| 42 | echo "All reference functions, archived generations and fresh chain selections reproduced." |