v5c: add --min-investigation-steps filter for submit-only with longer contexts
Browse files- training/train_sft.py +9 -0
training/train_sft.py
CHANGED
|
@@ -93,6 +93,7 @@ class SftConfig:
|
|
| 93 |
eval_holdout_hard: int = 3
|
| 94 |
eval_every_epoch: bool = True
|
| 95 |
submit_only: bool = False
|
|
|
|
| 96 |
|
| 97 |
lr: float = 5e-5
|
| 98 |
grad_clip: float = 1.0
|
|
@@ -220,6 +221,7 @@ def build_sft_examples(
|
|
| 220 |
"prompt_ids": prompt_ids,
|
| 221 |
"completion_ids": completion_ids,
|
| 222 |
"completion_text": completion_text,
|
|
|
|
| 223 |
})
|
| 224 |
messages.append({"role": "assistant", "content": completion_text})
|
| 225 |
obs = env.step(build_action(action_dict))
|
|
@@ -313,6 +315,10 @@ def main() -> None:
|
|
| 313 |
if cfg.submit_only:
|
| 314 |
examples = [ex for ex in examples if ex["action_type"] == "submit_final_resolution"]
|
| 315 |
print(f"[setup] submit-only mode: filtered to {len(examples)} submit examples", flush=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
print(f"[setup] train_tasks={len(train_tasks)} eval_tasks={len(eval_tasks)} examples={len(examples)}", flush=True)
|
| 317 |
|
| 318 |
tracker = None
|
|
@@ -439,6 +445,7 @@ def _parse_args() -> SftConfig:
|
|
| 439 |
p.add_argument("--no-push", action="store_true")
|
| 440 |
p.add_argument("--no-4bit", action="store_true")
|
| 441 |
p.add_argument("--submit-only", action="store_true")
|
|
|
|
| 442 |
args = p.parse_args()
|
| 443 |
|
| 444 |
cfg = SftConfig()
|
|
@@ -466,6 +473,8 @@ def _parse_args() -> SftConfig:
|
|
| 466 |
cfg.use_4bit = False
|
| 467 |
if args.submit_only:
|
| 468 |
cfg.submit_only = True
|
|
|
|
|
|
|
| 469 |
return cfg
|
| 470 |
|
| 471 |
|
|
|
|
| 93 |
eval_holdout_hard: int = 3
|
| 94 |
eval_every_epoch: bool = True
|
| 95 |
submit_only: bool = False
|
| 96 |
+
min_investigation_steps: int = 0
|
| 97 |
|
| 98 |
lr: float = 5e-5
|
| 99 |
grad_clip: float = 1.0
|
|
|
|
| 221 |
"prompt_ids": prompt_ids,
|
| 222 |
"completion_ids": completion_ids,
|
| 223 |
"completion_text": completion_text,
|
| 224 |
+
"trace_inv_steps": n_inv,
|
| 225 |
})
|
| 226 |
messages.append({"role": "assistant", "content": completion_text})
|
| 227 |
obs = env.step(build_action(action_dict))
|
|
|
|
| 315 |
if cfg.submit_only:
|
| 316 |
examples = [ex for ex in examples if ex["action_type"] == "submit_final_resolution"]
|
| 317 |
print(f"[setup] submit-only mode: filtered to {len(examples)} submit examples", flush=True)
|
| 318 |
+
if cfg.min_investigation_steps > 0:
|
| 319 |
+
before = len(examples)
|
| 320 |
+
examples = [ex for ex in examples if ex.get("trace_inv_steps", 0) >= cfg.min_investigation_steps]
|
| 321 |
+
print(f"[setup] min_investigation_steps={cfg.min_investigation_steps}: {before} -> {len(examples)} examples", flush=True)
|
| 322 |
print(f"[setup] train_tasks={len(train_tasks)} eval_tasks={len(eval_tasks)} examples={len(examples)}", flush=True)
|
| 323 |
|
| 324 |
tracker = None
|
|
|
|
| 445 |
p.add_argument("--no-push", action="store_true")
|
| 446 |
p.add_argument("--no-4bit", action="store_true")
|
| 447 |
p.add_argument("--submit-only", action="store_true")
|
| 448 |
+
p.add_argument("--min-investigation-steps", type=int, default=None)
|
| 449 |
args = p.parse_args()
|
| 450 |
|
| 451 |
cfg = SftConfig()
|
|
|
|
| 473 |
cfg.use_4bit = False
|
| 474 |
if args.submit_only:
|
| 475 |
cfg.submit_only = True
|
| 476 |
+
if args.min_investigation_steps is not None:
|
| 477 |
+
cfg.min_investigation_steps = args.min_investigation_steps
|
| 478 |
return cfg
|
| 479 |
|
| 480 |
|