#!/bin/bash # Trip Plan half of the reproduction: Claim 3 (main table) + Claim 5 (buffer ablation). # Resumable: finished configs are pulled from the results repo and skipped. set -uo pipefail pip install -q "transformers==4.46.2" "huggingface_hub<1.0" "datasets<4" "accelerate" 2>&1 | tail -1 python -c " from huggingface_hub import snapshot_download snapshot_download('ashishk1331/ccd-repro-code', repo_type='dataset', local_dir='/work')" cd /work && mkdir -p outputs nvidia-smi --query-gpu=name,memory.total --format=csv # Fail fast if this GPU has no compiled kernels for our torch build (e.g. torch # 2.5.1 on Blackwell/sm_120). Without this, every config dies one-by-one and the # job burns wall-clock reporting the same CUDA error N times. python - <<'EOF' || exit 1 import torch, sys if not torch.cuda.is_available(): print("ABORT: no CUDA"); sys.exit(1) name = torch.cuda.get_device_name(0) cap = torch.cuda.get_device_capability(0) try: (torch.zeros(8, 8, device="cuda", dtype=torch.bfloat16) @ torch.zeros(8, 8, device="cuda", dtype=torch.bfloat16)).cpu() except Exception as e: print(f"ABORT: {name} sm_{cap[0]}{cap[1]} unusable with torch {torch.__version__}: {e}") sys.exit(1) print(f"GPU OK: {name} sm_{cap[0]}{cap[1]} torch {torch.__version__}") EOF N_TRIP=${N_TRIP:-64} N_ABL=${N_ABL:-40} python - <<'EOF' from huggingface_hub import HfApi, snapshot_download import glob, shutil api = HfApi(); api.create_repo('ashishk1331/ccd-repro-results', repo_type='dataset', exist_ok=True) try: snapshot_download('ashishk1331/ccd-repro-results', repo_type='dataset', local_dir='/work/_prev') n = 0 for f in glob.glob('/work/_prev/outputs/*.json'): shutil.copy(f, '/work/outputs/'); n += 1 print(f'resumed {n} finished configs') except Exception as e: print('no previous results:', e) EOF push () { python - <<'EOF' 2>&1 | tail -1 || true from huggingface_hub import HfApi HfApi().upload_folder(folder_path="outputs", path_in_repo="outputs", repo_id="ashishk1331/ccd-repro-results", repo_type="dataset") print("pushed") EOF } run () { out="outputs/$1"; shift if [ -f "$out" ]; then echo "SKIP $out"; return; fi echo "=========== RUN $out : $* ===========" python scripts/run_eval.py "$@" --out "$out" || echo "!!!!! FAILED: $out" push } ########## Claim 3 — Trip Plan main table # paper: baseline 15.10 | CCD 16.93 (+1.83) | CCD-DS 19.01 (+3.91) @ 75.20 steps (3.48x) run "c3_trip_baseline.json" --task trip --method baseline --limit $N_TRIP run "c3_trip_ccd.json" --task trip --method ccd --limit $N_TRIP run "c3_trip_ccd_ds.json" --task trip --method ccd_ds --limit $N_TRIP # "repaired" CCD-DS: V raised to the value the reported 3.48x actually requires # at d=3 (V >= 13.9 by the k <= V/(d+1) bound). Tests whether the IDEA delivers # even though the STATED configuration (V=4) cannot. run "c3_trip_ccd_ds_V16.json" --task trip --method ccd_ds --limit $N_TRIP --buffer-V 16 run "c3_trip_ccd_V16.json" --task trip --method ccd --limit $N_TRIP --buffer-V 16 ########## Claim 5 — buffer ablation on the City=3 subset (paper: peak 70% at size 4) run "c5_abl_baseline.json" --task trip --method baseline --limit $N_ABL --num-cities 3 # V axis at d=3 (maps the k ~ max(1, V/(d+1)) law and the accuracy trade-off) for V in 1 2 4 8 16; do run "c5_abl_V${V}.json" --task trip --method ccd_ds --limit $N_ABL --num-cities 3 --buffer-V $V --history-d 3 done # d axis at V=4 for d in 1 2 5; do run "c5_abl_d${d}.json" --task trip --method ccd_ds --limit $N_ABL --num-cities 3 --buffer-V 4 --history-d $d done echo "=================== TRIP DONE ===================" python - <<'EOF' import json, glob for f in sorted(glob.glob("outputs/c3_*.json")) + sorted(glob.glob("outputs/c5_*.json")): r = json.load(open(f)) print(f"{f.split('/')[-1]:28s} score={r['score']:6.2f} steps={r['mean_steps']:7.2f} " f"speedup={r['speedup_vs_uniform']:5.2f}x V={r['buffer_V']} d={r['history_d']} n={r['n_examples']}") EOF push