full-164 HumanEval to settle Claim 4
Browse files- scripts/job_he_full.sh +73 -0
scripts/job_he_full.sh
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Claim 4 at FULL scale: all 164 HumanEval problems, baseline vs CCD.
|
| 3 |
+
# At n=32 CCD showed +9.38 with a unanimous 3-0 McNemar split, but 3 discordant
|
| 4 |
+
# pairs cannot reach p<0.05 (0.250 is the floor). n=164 should yield ~15
|
| 5 |
+
# discordant pairs -- enough to actually settle the paper's headline quality claim.
|
| 6 |
+
set -uo pipefail
|
| 7 |
+
pip install -q "transformers==4.46.2" "huggingface_hub<1.0" "datasets<4" "accelerate" 2>&1 | tail -1
|
| 8 |
+
python -c "
|
| 9 |
+
from huggingface_hub import snapshot_download
|
| 10 |
+
snapshot_download('ashishk1331/ccd-repro-code', repo_type='dataset', local_dir='/work')"
|
| 11 |
+
cd /work && mkdir -p outputs
|
| 12 |
+
nvidia-smi --query-gpu=name,memory.total --format=csv
|
| 13 |
+
|
| 14 |
+
python - <<'EOF' || exit 1
|
| 15 |
+
import torch, sys
|
| 16 |
+
if not torch.cuda.is_available(): print("ABORT: no CUDA"); sys.exit(1)
|
| 17 |
+
try:
|
| 18 |
+
(torch.zeros(8,8,device="cuda",dtype=torch.bfloat16) @
|
| 19 |
+
torch.zeros(8,8,device="cuda",dtype=torch.bfloat16)).cpu()
|
| 20 |
+
except Exception as e:
|
| 21 |
+
print(f"ABORT: GPU unusable with torch {torch.__version__}: {e}"); sys.exit(1)
|
| 22 |
+
print(f"GPU OK: {torch.cuda.get_device_name(0)} torch {torch.__version__}")
|
| 23 |
+
EOF
|
| 24 |
+
|
| 25 |
+
python - <<'EOF'
|
| 26 |
+
from huggingface_hub import HfApi, snapshot_download
|
| 27 |
+
import glob, shutil
|
| 28 |
+
HfApi().create_repo('ashishk1331/ccd-repro-results', repo_type='dataset', exist_ok=True)
|
| 29 |
+
try:
|
| 30 |
+
snapshot_download('ashishk1331/ccd-repro-results', repo_type='dataset', local_dir='/work/_prev')
|
| 31 |
+
n = 0
|
| 32 |
+
for f in glob.glob('/work/_prev/outputs/*.json'):
|
| 33 |
+
shutil.copy(f, '/work/outputs/'); n += 1
|
| 34 |
+
print(f'resumed {n} finished configs')
|
| 35 |
+
except Exception as e:
|
| 36 |
+
print('no previous results:', e)
|
| 37 |
+
EOF
|
| 38 |
+
|
| 39 |
+
push () {
|
| 40 |
+
python - <<'EOF' 2>&1 | tail -1 || true
|
| 41 |
+
from huggingface_hub import HfApi
|
| 42 |
+
HfApi().upload_folder(folder_path="outputs", path_in_repo="outputs",
|
| 43 |
+
repo_id="ashishk1331/ccd-repro-results", repo_type="dataset")
|
| 44 |
+
print("pushed")
|
| 45 |
+
EOF
|
| 46 |
+
}
|
| 47 |
+
run () {
|
| 48 |
+
out="outputs/$1"; shift
|
| 49 |
+
if [ -f "$out" ]; then echo "SKIP $out"; return; fi
|
| 50 |
+
echo "=========== RUN $out : $* ==========="
|
| 51 |
+
python scripts/run_eval.py "$@" --out "$out" || echo "!!!!! FAILED: $out"
|
| 52 |
+
push
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
# full 164, the two arms that decide the paper's headline quality claim
|
| 56 |
+
run "c4full_he_baseline.json" --task humaneval --method baseline --limit 164 --temperature 0.0 --top-p 0.9
|
| 57 |
+
run "c4full_he_ccd.json" --task humaneval --method ccd --limit 164 --temperature 0.0 --top-p 0.9
|
| 58 |
+
|
| 59 |
+
echo "=================== HE FULL DONE ==================="
|
| 60 |
+
python - <<'EOF'
|
| 61 |
+
import json
|
| 62 |
+
b = json.load(open("outputs/c4full_he_baseline.json"))
|
| 63 |
+
c = json.load(open("outputs/c4full_he_ccd.json"))
|
| 64 |
+
import math
|
| 65 |
+
bs, cs = b["per_example_score"], c["per_example_score"]
|
| 66 |
+
b01 = sum(1 for x,y in zip(bs,cs) if x==0 and y==1)
|
| 67 |
+
b10 = sum(1 for x,y in zip(bs,cs) if x==1 and y==0)
|
| 68 |
+
n = b01+b10; k = min(b01,b10)
|
| 69 |
+
p = min(1.0, 2*sum(math.comb(n,i) for i in range(k+1))/2**n) if n else 1.0
|
| 70 |
+
print(f"baseline {b['score']:.2f} CCD {c['score']:.2f} delta {c['score']-b['score']:+.2f}")
|
| 71 |
+
print(f"McNemar: win {b01} / lose {b10} -> p = {p:.4f} (paper claims +4.65)")
|
| 72 |
+
EOF
|
| 73 |
+
push
|