Download scripts/bench/make_6t.py from jaytonde05/kv-cache-quantization-commands: direct link, hf CLI and curl.
- Browser
- Download file 742 Bytes
-
https://huggingface.co/datasets/jaytonde05/kv-cache-quantization-commands/resolve/main/scripts/bench/make_6t.py
- Command line
-
hf download hf://datasets/jaytonde05/kv-cache-quantization-commands/scripts/bench/make_6t.py
-
curl -L -o make_6t.py https://huggingface.co/datasets/jaytonde05/kv-cache-quantization-commands/resolve/main/scripts/bench/make_6t.py
742 Bytes
| """RULER subset: 6 KV-sensitive tasks x 30 samples at 4K/32K/128K -> 180 rows each.""" | |
| import json, os, collections | |
| os.chdir(os.path.expanduser("~/bench/" + os.environ.get("KVQ_DATA", "data"))) | |
| TASKS = {"niah_single_2", "niah_multikey_1", "niah_multikey_3", "niah_multivalue", "vt", "qa_2"} | |
| for n in ["4k", "32k", "128k"]: | |
| rows = [r for r in map(json.loads, open(f"ruler_{n}.jsonl")) if r["task"] in TASKS] | |
| rows = [r for i, r in enumerate(rows) if sum(1 for x in rows[:i] if x["task"] == r["task"]) < 30] | |
| with open(f"ruler_{n}_6t.jsonl", "w") as f: | |
| for r in rows: | |
| f.write(json.dumps(r, ensure_ascii=False) + "\n") | |
| print(f"ruler_{n}_6t.jsonl", len(rows), dict(collections.Counter(r["task"] for r in rows))) | |