ashishk1331 commited on
Commit
ed62109
·
verified ·
1 Parent(s): 458c1fd

fix: stratified Trip sampling (prefix was all City=3)

Browse files
scripts/__pycache__/run_eval.cpython-312.pyc CHANGED
Binary files a/scripts/__pycache__/run_eval.cpython-312.pyc and b/scripts/__pycache__/run_eval.cpython-312.pyc differ
 
scripts/job_trip.sh CHANGED
@@ -9,7 +9,7 @@ snapshot_download('ashishk1331/ccd-repro-code', repo_type='dataset', local_dir='
9
  cd /work && mkdir -p outputs
10
  nvidia-smi --query-gpu=name,memory.total --format=csv
11
 
12
- N_TRIP=${N_TRIP:-60}
13
  N_ABL=${N_ABL:-40}
14
 
15
  python - <<'EOF'
 
9
  cd /work && mkdir -p outputs
10
  nvidia-smi --query-gpu=name,memory.total --format=csv
11
 
12
+ N_TRIP=${N_TRIP:-64}
13
  N_ABL=${N_ABL:-40}
14
 
15
  python - <<'EOF'
scripts/run_eval.py CHANGED
@@ -34,13 +34,38 @@ TASK_DEFAULTS = {
34
  # ---------------------------------------------------------------- data / prompts
35
 
36
  def load_trip(limit=None, num_cities=None, seed=0):
 
 
 
 
 
 
 
 
 
37
  with open(os.path.join(DATA, "trip_planning.json")) as f:
38
  data = json.load(f)
39
  items = list(data.values())
40
  if num_cities is not None:
 
 
41
  items = [i for i in items if i["num_cities"] == str(num_cities)]
42
- if limit:
43
- items = items[:limit] # deterministic prefix; the file order is fixed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  # 2-shot prompt, exactly as DreamLM/Dream eval_planning.py::eval_trip
45
  prompts = []
46
  for i in items:
 
34
  # ---------------------------------------------------------------- data / prompts
35
 
36
  def load_trip(limit=None, num_cities=None, seed=0):
37
+ """Load Trip Plan examples.
38
+
39
+ IMPORTANT: the benchmark file is ordered by difficulty -- the first 200 of the
40
+ 1600 examples all have num_cities=3 (the easiest tier), then 200 with 4, etc.
41
+ Taking a prefix therefore samples ONLY the easiest tier and inflates the score
42
+ (measured: 55% on a prefix-60 vs the paper's 15.10% over the full set).
43
+ When no explicit tier is requested we take a *stratified* sample: equal numbers
44
+ from each num_cities tier, so the subset matches the full benchmark's mix.
45
+ """
46
  with open(os.path.join(DATA, "trip_planning.json")) as f:
47
  data = json.load(f)
48
  items = list(data.values())
49
  if num_cities is not None:
50
+ # single-tier request (e.g. the Claim 5 City=3 ablation): prefix is fine,
51
+ # every example in the tier is equivalent for sampling purposes
52
  items = [i for i in items if i["num_cities"] == str(num_cities)]
53
+ if limit:
54
+ items = items[:limit]
55
+ elif limit:
56
+ import random
57
+ tiers = sorted({i["num_cities"] for i in items}, key=int)
58
+ per = limit // len(tiers)
59
+ rng = random.Random(seed)
60
+ picked = []
61
+ for t in tiers:
62
+ pool = [i for i in items if i["num_cities"] == t]
63
+ picked.extend(rng.sample(pool, min(per, len(pool))))
64
+ # top up any remainder deterministically from the unpicked pool
65
+ if len(picked) < limit:
66
+ rest = [i for i in items if i not in picked]
67
+ picked.extend(rng.sample(rest, limit - len(picked)))
68
+ items = picked
69
  # 2-shot prompt, exactly as DreamLM/Dream eval_planning.py::eval_trip
70
  prompts = []
71
  for i in items: