Download scripts/bench/make_lean.py from jaytonde05/kv-cache-quantization-commands: direct link, hf CLI and curl.
- Browser
- Download file 637 Bytes
-
https://huggingface.co/datasets/jaytonde05/kv-cache-quantization-commands/resolve/main/scripts/bench/make_lean.py
- Command line
-
hf download hf://datasets/jaytonde05/kv-cache-quantization-commands/scripts/bench/make_lean.py
-
curl -L -o make_lean.py https://huggingface.co/datasets/jaytonde05/kv-cache-quantization-commands/resolve/main/scripts/bench/make_lean.py
637 Bytes
| """Lean RULER subsets: first 20 items per task (13 tasks) at 4K/32K/128K -> 260 rows each.""" | |
| import json, os, collections | |
| os.chdir(os.path.expanduser("~/bench/data")) | |
| for n in ["4k", "32k", "128k"]: | |
| rows = [json.loads(l) for l in open(f"ruler_{n}.jsonl")] | |
| seen, out = collections.Counter(), [] | |
| for r in rows: | |
| if seen[r["task"]] < 20: | |
| out.append(r); seen[r["task"]] += 1 | |
| with open(f"ruler_{n}_260.jsonl", "w") as f: | |
| for r in out: | |
| f.write(json.dumps(r, ensure_ascii=False) + "\n") | |
| print(f"ruler_{n}_260.jsonl", len(out), dict(seen) == {t: 20 for t in seen}, len(seen), "tasks") | |