File size: 880 Bytes
de561c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
"""Extract a seeded-random 400-task subset of HellaSwag matching GPTQModel's selection."""

import random
import sys
from pathlib import Path

SEED = 1
N_SAMPLES = 400
LINES_PER_TASK = 6

def main():
    root = Path(__file__).resolve().parent.parent
    full_path = root / "hellaswag_val_full.txt"
    out_path = root / "hellaswag_val_400.txt"

    lines = full_path.read_text().splitlines()
    n_tasks = len(lines) // LINES_PER_TASK

    indices = list(range(n_tasks))
    rng = random.Random(SEED)
    rng.shuffle(indices)
    selected = indices[:N_SAMPLES]

    with open(out_path, "w") as f:
        for idx in selected:
            start = idx * LINES_PER_TASK
            for line in lines[start:start + LINES_PER_TASK]:
                f.write(line + "\n")

    print(f"Wrote {N_SAMPLES} tasks to {out_path}")

if __name__ == "__main__":
    main()