Publish credential-free structural-smoke runner
Browse files
training/run_fable_router_stage_a_chunk.py
CHANGED
|
@@ -209,6 +209,48 @@ def load_resume(args: argparse.Namespace) -> tuple[dict[str, Any] | None, Positi
|
|
| 209 |
return state, PositiveReplayBuffer.from_state_dict(state["positiveReplay"]), int(state["eligibleSteps"])
|
| 210 |
|
| 211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
def run(args: argparse.Namespace, result: dict[str, Any]) -> None:
|
| 213 |
campaign, config, manifest = verify_authorization(args.campaign.resolve(), result)
|
| 214 |
curriculum_path = args.campaign.resolve().parents[2] / campaign["frozenCurriculum"]["path"]
|
|
@@ -224,18 +266,12 @@ def run(args: argparse.Namespace, result: dict[str, Any]) -> None:
|
|
| 224 |
if stage_position(curriculum, step).name != "A-host-anchor":
|
| 225 |
raise RuntimeError("requested chunk crosses outside Stage A")
|
| 226 |
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
or proof.get("passed") is not True
|
| 231 |
-
or proof.get("status") != "optimizer_smoke_passed_nonrouting"
|
| 232 |
-
or proof.get("bank") != args.bank
|
| 233 |
-
or proof.get("nonRouting") is not True
|
| 234 |
-
or proof.get("productionRoutingAuthorized") is not False
|
| 235 |
-
):
|
| 236 |
-
raise RuntimeError("bank-specific optimizer admission prerequisite is not a pass")
|
| 237 |
resume_state, replay, eligible_step = load_resume(args)
|
| 238 |
-
result["
|
|
|
|
| 239 |
result["bank"] = args.bank
|
| 240 |
result["range"] = {"start": args.start_step, "end": end_step, "steps": args.steps}
|
| 241 |
result["gpu"] = gpu_facts(14.0)
|
|
@@ -461,6 +497,7 @@ def main() -> int:
|
|
| 461 |
parser.add_argument("--bank", required=True)
|
| 462 |
parser.add_argument("--curriculum-path", type=Path, required=True)
|
| 463 |
parser.add_argument("--optimizer-proof", type=Path, required=True)
|
|
|
|
| 464 |
parser.add_argument("--start-step", type=int, required=True)
|
| 465 |
parser.add_argument("--steps", type=int, default=MAXIMUM_CHUNK_STEPS)
|
| 466 |
parser.add_argument("--resume-dir", type=Path)
|
|
|
|
| 209 |
return state, PositiveReplayBuffer.from_state_dict(state["positiveReplay"]), int(state["eligibleSteps"])
|
| 210 |
|
| 211 |
|
| 212 |
+
def verify_optimizer_prerequisites(
|
| 213 |
+
campaign: dict[str, Any],
|
| 214 |
+
bank: str,
|
| 215 |
+
consolidation_path: Path,
|
| 216 |
+
proof_path: Path,
|
| 217 |
+
) -> tuple[dict[str, Any], dict[str, Any]]:
|
| 218 |
+
consolidation = read_json(consolidation_path)
|
| 219 |
+
if not all(
|
| 220 |
+
(
|
| 221 |
+
consolidation.get("schema") == "AutonomaFableRouterOptimizerConsolidation.v1",
|
| 222 |
+
consolidation.get("status") == "all_four_banks_optimizer_admitted_nonrouting",
|
| 223 |
+
consolidation.get("passed") is True,
|
| 224 |
+
consolidation.get("nonRouting") is True,
|
| 225 |
+
consolidation.get("trainingAuthorized") is True,
|
| 226 |
+
consolidation.get("productionRoutingAuthorized") is False,
|
| 227 |
+
(consolidation.get("interpretation") or {}).get("authorizesStageAAdmissionSmoke") is True,
|
| 228 |
+
(consolidation.get("interpretation") or {}).get("authorizesFullStageA") is False,
|
| 229 |
+
)
|
| 230 |
+
):
|
| 231 |
+
raise RuntimeError("four-bank optimizer consolidation prerequisite is not an admission-smoke pass")
|
| 232 |
+
consolidation_banks = {str(row.get("bank")): row for row in consolidation.get("banks") or []}
|
| 233 |
+
if set(consolidation_banks) != set(campaign["selectedBanks"]["ids"]):
|
| 234 |
+
raise RuntimeError("optimizer consolidation does not contain the exact frozen four-bank set")
|
| 235 |
+
|
| 236 |
+
proof = read_json(proof_path)
|
| 237 |
+
if not all(
|
| 238 |
+
(
|
| 239 |
+
proof.get("schema") == "AutonomaFableRouterOptimizerSmoke.v1",
|
| 240 |
+
proof.get("passed") is True,
|
| 241 |
+
proof.get("status") == "optimizer_smoke_passed_nonrouting",
|
| 242 |
+
proof.get("bank") == bank,
|
| 243 |
+
proof.get("nonRouting") is True,
|
| 244 |
+
proof.get("productionRoutingAuthorized") is False,
|
| 245 |
+
)
|
| 246 |
+
):
|
| 247 |
+
raise RuntimeError("bank-specific optimizer admission prerequisite is not a pass")
|
| 248 |
+
consolidated_proof = ((consolidation_banks[bank].get("files") or {}).get("result") or {})
|
| 249 |
+
if sha256(proof_path) != consolidated_proof.get("sha256") or proof_path.stat().st_size != consolidated_proof.get("bytes"):
|
| 250 |
+
raise RuntimeError("bank-specific optimizer proof is not the result bound by the four-bank consolidation")
|
| 251 |
+
return consolidation, proof
|
| 252 |
+
|
| 253 |
+
|
| 254 |
def run(args: argparse.Namespace, result: dict[str, Any]) -> None:
|
| 255 |
campaign, config, manifest = verify_authorization(args.campaign.resolve(), result)
|
| 256 |
curriculum_path = args.campaign.resolve().parents[2] / campaign["frozenCurriculum"]["path"]
|
|
|
|
| 266 |
if stage_position(curriculum, step).name != "A-host-anchor":
|
| 267 |
raise RuntimeError("requested chunk crosses outside Stage A")
|
| 268 |
|
| 269 |
+
consolidation_path = args.optimizer_consolidation.resolve()
|
| 270 |
+
proof_path = args.optimizer_proof.resolve()
|
| 271 |
+
verify_optimizer_prerequisites(campaign, args.bank, consolidation_path, proof_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
resume_state, replay, eligible_step = load_resume(args)
|
| 273 |
+
result["optimizerConsolidation"] = {"path": str(consolidation_path), "sha256": sha256(consolidation_path)}
|
| 274 |
+
result["optimizerProof"] = {"path": str(proof_path), "sha256": sha256(proof_path)}
|
| 275 |
result["bank"] = args.bank
|
| 276 |
result["range"] = {"start": args.start_step, "end": end_step, "steps": args.steps}
|
| 277 |
result["gpu"] = gpu_facts(14.0)
|
|
|
|
| 497 |
parser.add_argument("--bank", required=True)
|
| 498 |
parser.add_argument("--curriculum-path", type=Path, required=True)
|
| 499 |
parser.add_argument("--optimizer-proof", type=Path, required=True)
|
| 500 |
+
parser.add_argument("--optimizer-consolidation", type=Path, required=True)
|
| 501 |
parser.add_argument("--start-step", type=int, required=True)
|
| 502 |
parser.add_argument("--steps", type=int, default=MAXIMUM_CHUNK_STEPS)
|
| 503 |
parser.add_argument("--resume-dir", type=Path)
|