Download scripts/gaps_texts.py from nokeepai/inkling-2-mini-prune-map: direct link, hf CLI and curl.
- Browser
- Download file 1.75 kB
-
https://huggingface.co/datasets/nokeepai/inkling-2-mini-prune-map/resolve/main/scripts/gaps_texts.py
- Command line
-
hf download hf://datasets/nokeepai/inkling-2-mini-prune-map/scripts/gaps_texts.py
-
curl -L -o gaps_texts.py https://huggingface.co/datasets/nokeepai/inkling-2-mini-prune-map/resolve/main/scripts/gaps_texts.py
1.75 kB
| """Held-out ruler texts for the two domains texts.py has no ruler set for: r_tools (glaive) and r_agent (SWE-smith). | |
| python3 gaps_texts.py --raw /srv/prune/data/raw --out /srv/prune/data/texts | |
| Same rules as texts.py build: buckets 8-9, sha1 order, leak guard against the test problems and the calibration rows, | |
| plain-text rendering, ctx 1024, 2x24,000 scored tokens + 3% margin. Run after texts.py build (needs calib/*.jsonl). | |
| """ | |
| import argparse | |
| import json | |
| import os | |
| import sys | |
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
| import texts as T # noqa: E402 | |
| def main(): | |
| p = argparse.ArgumentParser() | |
| p.add_argument('--raw', default='/srv/prune/data/raw') | |
| p.add_argument('--out', default='/srv/prune/data/texts') | |
| p.add_argument('--ruler-tokens', type=int, default=24000) | |
| a = p.parse_args() | |
| counter = T.Counter(a.raw) | |
| tests = {t: T.read_jsonl(f'{a.out}/tests/{t}.jsonl') for t in T.TESTS} | |
| guard = T.Shingles(T.test_problems(tests)) | |
| calib_keys = set() | |
| for d in T.CALIB_DOMAINS: | |
| for r in T.read_jsonl(f'{a.out}/calib/{d}.jsonl'): | |
| calib_keys |= T.row_keys(r) | |
| man_path = f'{a.out}/ruler/manifest.json' | |
| man = json.load(open(man_path)) | |
| target = int(2 * a.ruler_tokens * T.MARGIN) | |
| for dom in ('tools', 'agent'): | |
| src = T.Source(a.raw, dom) | |
| rows, tok, skipped = T.take(T.chat_rows(src, (8, 9), counter), target, counter, guard, calib_keys) | |
| m = T.write_ruler(a.out, f'r_{dom}', rows, 1024, -(-2 * a.ruler_tokens // 1024), counter, man) | |
| m['skipped_leak'] = skipped | |
| print(f'ruler r_{dom} {m} counter={counter.name}', flush=True) | |
| json.dump(man, open(man_path, 'w'), indent=1) | |
| if __name__ == '__main__': | |
| main() | |