incremental HumanEval extension 32..63
Browse files- scripts/__pycache__/run_eval.cpython-312.pyc +0 -0
- scripts/job_he_ext.sh +37 -0
- scripts/run_eval.py +12 -4
scripts/__pycache__/run_eval.cpython-312.pyc
CHANGED
|
Binary files a/scripts/__pycache__/run_eval.cpython-312.pyc and b/scripts/__pycache__/run_eval.cpython-312.pyc differ
|
|
|
scripts/job_he_ext.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Extend Claim 4 from n=32 to n=64 by scoring ONLY problems 32..63 and merging
|
| 3 |
+
# with the runs we already paid for. At n=32 CCD showed +9.38 with a unanimous
|
| 4 |
+
# 3-0 McNemar split, but 3 discordant pairs floor out at p=0.250. n=64 should
|
| 5 |
+
# give ~6 discordant pairs -- enough for p=0.031 if the pattern holds.
|
| 6 |
+
# Cost: 2 x 32 problems instead of 2 x 164. ($2.70 vs $13.85)
|
| 7 |
+
set -uo pipefail
|
| 8 |
+
pip install -q "transformers==4.46.2" "huggingface_hub<1.0" "datasets<4" "accelerate" 2>&1 | tail -1
|
| 9 |
+
python -c "
|
| 10 |
+
from huggingface_hub import snapshot_download
|
| 11 |
+
snapshot_download('ashishk1331/ccd-repro-code', repo_type='dataset', local_dir='/work')"
|
| 12 |
+
cd /work && mkdir -p outputs
|
| 13 |
+
python - <<'PY' || exit 1
|
| 14 |
+
import torch, sys
|
| 15 |
+
if not torch.cuda.is_available(): print("ABORT: no CUDA"); sys.exit(1)
|
| 16 |
+
try:
|
| 17 |
+
(torch.zeros(8,8,device="cuda",dtype=torch.bfloat16) @
|
| 18 |
+
torch.zeros(8,8,device="cuda",dtype=torch.bfloat16)).cpu()
|
| 19 |
+
except Exception as e:
|
| 20 |
+
print(f"ABORT: GPU unusable: {e}"); sys.exit(1)
|
| 21 |
+
print(f"GPU OK: {torch.cuda.get_device_name(0)}")
|
| 22 |
+
PY
|
| 23 |
+
push () {
|
| 24 |
+
python - <<'PY' 2>&1 | tail -1 || true
|
| 25 |
+
from huggingface_hub import HfApi
|
| 26 |
+
HfApi().upload_folder(folder_path="outputs", path_in_repo="outputs",
|
| 27 |
+
repo_id="ashishk1331/ccd-repro-results", repo_type="dataset")
|
| 28 |
+
print("pushed")
|
| 29 |
+
PY
|
| 30 |
+
}
|
| 31 |
+
for m in baseline ccd; do
|
| 32 |
+
echo "=========== RUN ext $m (problems 32..63) ==========="
|
| 33 |
+
python scripts/run_eval.py --task humaneval --method $m --limit 32 --offset 32 \
|
| 34 |
+
--temperature 0.0 --top-p 0.9 --out "outputs/c4ext_he_${m}.json" || echo "FAILED $m"
|
| 35 |
+
push
|
| 36 |
+
done
|
| 37 |
+
echo "=================== HE EXT DONE ==================="
|
scripts/run_eval.py
CHANGED
|
@@ -74,10 +74,16 @@ def load_trip(limit=None, num_cities=None, seed=0):
|
|
| 74 |
return items, prompts
|
| 75 |
|
| 76 |
|
| 77 |
-
def load_humaneval(limit=None):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
from datasets import load_dataset
|
| 79 |
ds = load_dataset("openai/openai_humaneval", split="test")
|
| 80 |
-
items = list(ds)
|
| 81 |
if limit:
|
| 82 |
items = items[:limit]
|
| 83 |
return items
|
|
@@ -152,6 +158,8 @@ def main():
|
|
| 152 |
ap.add_argument("--task", choices=["trip", "humaneval"], required=True)
|
| 153 |
ap.add_argument("--method", choices=["baseline", "ccd", "ccd_ds"], required=True)
|
| 154 |
ap.add_argument("--limit", type=int, default=None)
|
|
|
|
|
|
|
| 155 |
ap.add_argument("--num-cities", type=int, default=None)
|
| 156 |
ap.add_argument("--buffer-V", type=int, default=4)
|
| 157 |
ap.add_argument("--history-d", type=int, default=3)
|
|
@@ -196,7 +204,7 @@ def main():
|
|
| 196 |
if args.task == "trip":
|
| 197 |
items, prompts = load_trip(args.limit, args.num_cities)
|
| 198 |
else:
|
| 199 |
-
items = load_humaneval(args.limit)
|
| 200 |
prompts = [humaneval_prompt(tok, d) for d in items]
|
| 201 |
|
| 202 |
responses, all_steps, all_budgets, n_fallback = [], [], [], 0
|
|
@@ -237,7 +245,7 @@ def main():
|
|
| 237 |
result = {
|
| 238 |
"task": args.task, "method": args.method, "config": cfg,
|
| 239 |
"buffer_V": args.buffer_V, "history_d": args.history_d,
|
| 240 |
-
"n_examples": len(items), "score": score,
|
| 241 |
"mean_steps": mean_steps,
|
| 242 |
"speedup_vs_uniform": cfg["steps"] / mean_steps,
|
| 243 |
"fallback_steps": n_fallback,
|
|
|
|
| 74 |
return items, prompts
|
| 75 |
|
| 76 |
|
| 77 |
+
def load_humaneval(limit=None, offset=0):
|
| 78 |
+
"""HumanEval problems [offset, offset+limit).
|
| 79 |
+
|
| 80 |
+
The offset lets us EXTEND an existing run instead of repeating it: having
|
| 81 |
+
already scored problems 0..31, we buy problems 32..63 and merge to n=64 for
|
| 82 |
+
the price of the increment rather than re-running the whole prefix.
|
| 83 |
+
"""
|
| 84 |
from datasets import load_dataset
|
| 85 |
ds = load_dataset("openai/openai_humaneval", split="test")
|
| 86 |
+
items = list(ds)[offset:]
|
| 87 |
if limit:
|
| 88 |
items = items[:limit]
|
| 89 |
return items
|
|
|
|
| 158 |
ap.add_argument("--task", choices=["trip", "humaneval"], required=True)
|
| 159 |
ap.add_argument("--method", choices=["baseline", "ccd", "ccd_ds"], required=True)
|
| 160 |
ap.add_argument("--limit", type=int, default=None)
|
| 161 |
+
ap.add_argument("--offset", type=int, default=0,
|
| 162 |
+
help="skip the first N problems (HumanEval; lets a run extend an earlier one)")
|
| 163 |
ap.add_argument("--num-cities", type=int, default=None)
|
| 164 |
ap.add_argument("--buffer-V", type=int, default=4)
|
| 165 |
ap.add_argument("--history-d", type=int, default=3)
|
|
|
|
| 204 |
if args.task == "trip":
|
| 205 |
items, prompts = load_trip(args.limit, args.num_cities)
|
| 206 |
else:
|
| 207 |
+
items = load_humaneval(args.limit, args.offset)
|
| 208 |
prompts = [humaneval_prompt(tok, d) for d in items]
|
| 209 |
|
| 210 |
responses, all_steps, all_budgets, n_fallback = [], [], [], 0
|
|
|
|
| 245 |
result = {
|
| 246 |
"task": args.task, "method": args.method, "config": cfg,
|
| 247 |
"buffer_V": args.buffer_V, "history_d": args.history_d,
|
| 248 |
+
"n_examples": len(items), "score": score, "offset": args.offset,
|
| 249 |
"mean_steps": mean_steps,
|
| 250 |
"speedup_vs_uniform": cfg["steps"] / mean_steps,
|
| 251 |
"fallback_steps": n_fallback,
|