Download scripts/bench/make_smoke.py from jaytonde05/kv-cache-quantization-commands: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/datasets/jaytonde05/kv-cache-quantization-commands/resolve/main/scripts/bench/make_smoke.py
- Command line
-
hf download hf://datasets/jaytonde05/kv-cache-quantization-commands/scripts/bench/make_smoke.py
-
curl -L -o make_smoke.py https://huggingface.co/datasets/jaytonde05/kv-cache-quantization-commands/resolve/main/scripts/bench/make_smoke.py
1.03 kB
| """Build small Exp 0 smoke-test subsets from ~/bench/data into ~/bench/data/smoke/.""" | |
| import json | |
| from pathlib import Path | |
| D = Path.home() / "bench" / "data" | |
| S = D / "smoke" | |
| S.mkdir(exist_ok=True) | |
| def load(name): | |
| return [json.loads(line) for line in open(D / name)] | |
| def save(name, rows): | |
| with open(S / name, "w") as f: | |
| for r in rows: | |
| f.write(json.dumps(r, ensure_ascii=False) + "\n") | |
| print(name, len(rows)) | |
| def per_task(rows, k): | |
| out, seen = [], {} | |
| for r in rows: | |
| if seen.get(r["task"], 0) < k: | |
| out.append(r) | |
| seen[r["task"]] = seen.get(r["task"], 0) + 1 | |
| return out | |
| save("ruler_4k_26.jsonl", per_task(load("ruler_4k.jsonl"), 2)) # 2 per task | |
| save("ruler_128k_13.jsonl", per_task(load("ruler_128k.jsonl"), 1)) # 1 per task | |
| save("docvqa_20.jsonl", load("docvqa_1000.jsonl")[:20]) | |
| save("gpqa_8.jsonl", [r for r in load("gpqa_x4.jsonl") if r["sample"] == 0][:8]) | |
| save("lcb_10.jsonl", [r for r in load("lcb_v6_x2.jsonl") if r["sample"] == 0][:10]) | |