sergiopaniego HF Staff commited on
Commit
e4497c4
·
verified ·
1 Parent(s): cc8d831

Separate the dataset seed from the rollout seed: one seed meant changing the seed changed the task

Browse files
Files changed (1) hide show
  1. capture_trace.py +10 -3
capture_trace.py CHANGED
@@ -72,7 +72,12 @@ def parse_args():
72
  p.add_argument("--model", default="Qwen/Qwen3-8B")
73
  p.add_argument("--sandbox-vllm-url", required=True, help="Public url the remote sandbox reaches vLLM through.")
74
  p.add_argument("--n-prompts", type=int, default=64, help="Same as training, so task indices line up.")
75
- p.add_argument("--seed", type=int, default=0, help="build_dataset is deterministic on this.")
 
 
 
 
 
76
  p.add_argument("--task-index", type=int, default=0, help="Which task of the built dataset to capture.")
77
  p.add_argument("--sandbox-image", default="ghcr.io/huggingface/openenv-opencode-sandbox:latest")
78
  p.add_argument("--sandbox-flavor", default="cpu-basic")
@@ -97,6 +102,7 @@ def main():
97
  out = pathlib.Path(args.out_dir)
98
  out.mkdir(parents=True, exist_ok=True)
99
 
 
100
  rows, tests_by_id = build_dataset(n_prompts=args.n_prompts, seed=args.seed)
101
  if not 0 <= args.task_index < len(rows):
102
  raise SystemExit(f"--task-index {args.task_index} outside 0..{len(rows) - 1}")
@@ -104,12 +110,13 @@ def main():
104
  instruction = prompt[-1]["content"]
105
  task_id = _instruction_id(instruction)
106
  held_out = tests_by_id[task_id]
107
- print(f"[task] index={args.task_index} id={task_id[:12]} held_out_tests={len(held_out)}", flush=True)
 
108
 
109
  factory = build_factory(args.sandbox_vllm_url, args.model, tests_by_id, args.sandbox_image, args.sandbox_flavor)
110
  episode_id = uuid.uuid4().hex
111
  print("[session] creating (boots sandbox + opencode + capture proxy)...", flush=True)
112
- session = factory.create(prompt, seed=args.seed, episode_id=episode_id)
113
 
114
  timed_out = False
115
  try:
 
72
  p.add_argument("--model", default="Qwen/Qwen3-8B")
73
  p.add_argument("--sandbox-vllm-url", required=True, help="Public url the remote sandbox reaches vLLM through.")
74
  p.add_argument("--n-prompts", type=int, default=64, help="Same as training, so task indices line up.")
75
+ p.add_argument("--seed", type=int, default=0,
76
+ help="Dataset seed. build_dataset is deterministic on this, so it also decides WHICH task "
77
+ "each index points at. Change it and --task-index selects a different problem.")
78
+ p.add_argument("--rollout-seed", type=int, default=None,
79
+ help="Seed for the rollout only, so you can sample the SAME task several times. "
80
+ "Defaults to --seed.")
81
  p.add_argument("--task-index", type=int, default=0, help="Which task of the built dataset to capture.")
82
  p.add_argument("--sandbox-image", default="ghcr.io/huggingface/openenv-opencode-sandbox:latest")
83
  p.add_argument("--sandbox-flavor", default="cpu-basic")
 
102
  out = pathlib.Path(args.out_dir)
103
  out.mkdir(parents=True, exist_ok=True)
104
 
105
+ rollout_seed = args.rollout_seed if args.rollout_seed is not None else args.seed
106
  rows, tests_by_id = build_dataset(n_prompts=args.n_prompts, seed=args.seed)
107
  if not 0 <= args.task_index < len(rows):
108
  raise SystemExit(f"--task-index {args.task_index} outside 0..{len(rows) - 1}")
 
110
  instruction = prompt[-1]["content"]
111
  task_id = _instruction_id(instruction)
112
  held_out = tests_by_id[task_id]
113
+ print(f"[task] index={args.task_index} id={task_id[:12]} held_out_tests={len(held_out)} "
114
+ f"dataset_seed={args.seed} rollout_seed={rollout_seed}", flush=True)
115
 
116
  factory = build_factory(args.sandbox_vllm_url, args.model, tests_by_id, args.sandbox_image, args.sandbox_flavor)
117
  episode_id = uuid.uuid4().hex
118
  print("[session] creating (boots sandbox + opencode + capture proxy)...", flush=True)
119
+ session = factory.create(prompt, seed=rollout_seed, episode_id=episode_id)
120
 
121
  timed_out = False
122
  try: