File size: 3,516 Bytes
f9bc0c1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #!/usr/bin/env bash
# Build a single-file git bundle of everything the remote run needs, WITHOUT
# touching the (shared, "admin"-branch) repository that tracks ~/Desktop.
#
# What goes in (this mirror excludes junk; models included by default ~46 MB):
# indra/ cloned inference package (Apache-2.0)
# models/indra-ocr-v3.1.1/ ONNX + safetensors + meta (OpenRAIL-M)
# tools/indra_eval/ verified eval harness + inspectors + synth generator
# tools/exp/ THIS experiment code (train / export / exactness / A glue)
# docs/ investigation + experiment plan + remote run sheet
# results/smoke/ smoke records (tiny; gives the remote a live sanity ref)
#
# Usage: bash tools/exp/make_bundle.sh [--no-models] [--out FILE.bundle]
set -euo pipefail
REPO=$(cd "$(dirname "$0")/../.." && pwd)
STAGE=/tmp/opencode/indra_exp_stage
OUT=""
INCLUDE_MODELS=1
while [[ $# -gt 0 ]]; do
case "$1" in
--no-models) INCLUDE_MODELS=0; shift ;;
--out) OUT="$2"; shift 2 ;;
*) echo "unknown arg $1"; exit 1 ;;
esac
done
OUT="${OUT:-$REPO/indra_nepali_exp.bundle}"
rm -rf "$STAGE"; mkdir -p "$STAGE"
mkdir -p "$STAGE/indra" "$STAGE/tools" "$STAGE/docs" "$STAGE/results/smoke"
rsync -a \
--exclude '__pycache__' --exclude '*.pyc' --exclude '.ipynb_checkpoints' \
--exclude '.git' --exclude '.github' --exclude 'indra.egg-info' \
"$REPO/indra/" "$STAGE/indra/"
rsync -a --exclude '__pycache__' --exclude '*.pyc' "$REPO/tools/" "$STAGE/tools/"
rsync -a "$REPO/docs/" "$STAGE/docs/"
rsync -a "$REPO/logs/" "$STAGE/logs/"
rsync -a "$REPO/results/smoke/" "$STAGE/results/smoke/"
# top-level reference docs (tiny; the docx is the human-readable report)
for f in INDRA_OCR_NEPALI_COMPLETE_REPORT.docx INDRA_OCR_NEPALI_FEASIBILITY.md; do
[[ -f "$REPO/$f" ]] && cp -a "$REPO/$f" "$STAGE/$f"
done
if [[ $INCLUDE_MODELS == 1 ]]; then
mkdir -p "$STAGE/models"
rsync -a "$REPO/models/" "$STAGE/models/"
fi
cat > "$STAGE/.gitignore" <<'EOF'
__pycache__/
*.pyc
.deps/
runs/
*.bundle
EOF
# a short top-level README for whoever lands on the far side
cat > "$STAGE/README_BUNDLE.md" <<'EOF'
# OCR_INDRA experiment bundle
Remote run companion for `docs/REMOTE_RUN_SHEET.md` (start there).
Layout: indra/ = cloned indra-ocr v0.3.2 (commit 3d773ae); models/indra-ocr-v3.1.1/
= Hub artifacts @ v3.1.1 (OpenRAIL-M — fine-tuning explicitly licensed §II ¶36);
tools/indra_eval = verified inspector/eval harness; tools/exp = experiment code;
INDRA_OCR_NEPALI_COMPLETE_REPORT.docx = full investigation report (read-only).
Setup: `bash tools/exp/remote_setup.sh` (deps + probe + offline verification gate),
then follow the run sheet. `bash tools/exp/verify_bundle.sh` alone re-checks the
toolchain with no data: torch re-implementation → ONNX export → exactness vs the
shipped rec.onnx → rec-lines smoke CER. Offline-verified 2026-10-20 on torch
2.14.1+cpu / onnxruntime 1.31.0 (export uses the legacy torch exporter on purpose).
Never copy datasets off the remote; only results files leave.
EOF
cd "$STAGE"
git init -q -b main
git -c user.name=ocr-indra-exp -c user.email=exp@local add -A
git -c user.name=ocr-indra-exp -c user.email=exp@local commit -qm "experiment bundle: indra eval + finetune toolkit"
git bundle create "$OUT" --all
git bundle verify "$OUT" >/dev/null 2>&1 && echo "bundle verified OK"
echo "bundle: $OUT ($(du -h "$OUT" | cut -f1))"
echo
echo "Transfer, then on the remote:"
echo " git clone $OUT OCR_INDRA && cd OCR_INDRA && bash tools/exp/remote_setup.sh"
|