| #!/bin/bash |
| |
| |
| 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 |
|
|
| |
| |
| |
| 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 |
| } |
|
|
| |
| |
| 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 |
| |
| |
| |
| 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 |
|
|
| |
| run "c5_abl_baseline.json" --task trip --method baseline --limit $N_ABL --num-cities 3 |
| |
| 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 |
| |
| 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 |
|
|