Publish credential-free structural-smoke runner
Browse files
training/run_fable_router_structural_campaign.py
CHANGED
|
@@ -73,6 +73,11 @@ def main() -> int:
|
|
| 73 |
parser.add_argument("--source-revision", required=True)
|
| 74 |
parser.add_argument("--banks", nargs="+", default=list(DEFAULT_BANKS))
|
| 75 |
parser.add_argument("--continue-on-failure", action="store_true")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
args = parser.parse_args()
|
| 77 |
if not args.owner_execute:
|
| 78 |
raise SystemExit("refusing GPU/model execution without --owner-execute")
|
|
@@ -84,8 +89,8 @@ def main() -> int:
|
|
| 84 |
if len(args.banks) != len(set(args.banks)) or not set(args.banks).issubset(configured):
|
| 85 |
raise SystemExit("campaign banks must be unique configured bank IDs")
|
| 86 |
token = os.environ.get("HF_TOKEN")
|
| 87 |
-
if not token:
|
| 88 |
-
raise SystemExit("HF_TOKEN
|
| 89 |
|
| 90 |
stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
|
| 91 |
output = args.work_dir.resolve() / f"fable-router-structural-campaign-{stamp}"
|
|
@@ -115,6 +120,8 @@ def main() -> int:
|
|
| 115 |
"--platform", args.platform,
|
| 116 |
"--work-dir", str(args.work_dir.resolve()),
|
| 117 |
]
|
|
|
|
|
|
|
| 118 |
returncode, lines = run_bank(command)
|
| 119 |
result_path, result = result_from_output(lines)
|
| 120 |
row = {
|
|
@@ -146,22 +153,29 @@ def main() -> int:
|
|
| 146 |
result_path.write_text(json.dumps(summary, indent=2) + "\n", encoding="utf-8")
|
| 147 |
repo = config["smoke"]["resultRepo"]
|
| 148 |
remote = f"campaigns/{output.name}/result.json"
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
print(result_path, flush=True)
|
| 166 |
return 0 if all_passed else 1
|
| 167 |
|
|
|
|
| 73 |
parser.add_argument("--source-revision", required=True)
|
| 74 |
parser.add_argument("--banks", nargs="+", default=list(DEFAULT_BANKS))
|
| 75 |
parser.add_argument("--continue-on-failure", action="store_true")
|
| 76 |
+
parser.add_argument(
|
| 77 |
+
"--curriculum-path",
|
| 78 |
+
type=Path,
|
| 79 |
+
help="Verified local sft-train.jsonl override for credential-free cloud execution",
|
| 80 |
+
)
|
| 81 |
args = parser.parse_args()
|
| 82 |
if not args.owner_execute:
|
| 83 |
raise SystemExit("refusing GPU/model execution without --owner-execute")
|
|
|
|
| 89 |
if len(args.banks) != len(set(args.banks)) or not set(args.banks).issubset(configured):
|
| 90 |
raise SystemExit("campaign banks must be unique configured bank IDs")
|
| 91 |
token = os.environ.get("HF_TOKEN")
|
| 92 |
+
if not token and not args.curriculum_path:
|
| 93 |
+
raise SystemExit("either HF_TOKEN or --curriculum-path is required")
|
| 94 |
|
| 95 |
stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
|
| 96 |
output = args.work_dir.resolve() / f"fable-router-structural-campaign-{stamp}"
|
|
|
|
| 120 |
"--platform", args.platform,
|
| 121 |
"--work-dir", str(args.work_dir.resolve()),
|
| 122 |
]
|
| 123 |
+
if args.curriculum_path:
|
| 124 |
+
command.extend(["--curriculum-path", str(args.curriculum_path.resolve())])
|
| 125 |
returncode, lines = run_bank(command)
|
| 126 |
result_path, result = result_from_output(lines)
|
| 127 |
row = {
|
|
|
|
| 153 |
result_path.write_text(json.dumps(summary, indent=2) + "\n", encoding="utf-8")
|
| 154 |
repo = config["smoke"]["resultRepo"]
|
| 155 |
remote = f"campaigns/{output.name}/result.json"
|
| 156 |
+
if token:
|
| 157 |
+
HfApi(token=token).upload_file(
|
| 158 |
+
path_or_fileobj=str(result_path),
|
| 159 |
+
path_in_repo=remote,
|
| 160 |
+
repo_id=repo,
|
| 161 |
+
repo_type="dataset",
|
| 162 |
+
commit_message=f"Persist non-routing structural campaign {output.name}",
|
| 163 |
+
)
|
| 164 |
+
summary["evidenceUpload"] = {"repo": repo, "private": True, "path": remote}
|
| 165 |
+
result_path.write_text(json.dumps(summary, indent=2) + "\n", encoding="utf-8")
|
| 166 |
+
HfApi(token=token).upload_file(
|
| 167 |
+
path_or_fileobj=str(result_path),
|
| 168 |
+
path_in_repo=remote,
|
| 169 |
+
repo_id=repo,
|
| 170 |
+
repo_type="dataset",
|
| 171 |
+
commit_message=f"Finalize non-routing structural campaign {output.name}",
|
| 172 |
+
)
|
| 173 |
+
else:
|
| 174 |
+
summary["evidenceUpload"] = {
|
| 175 |
+
"status": "local_only_pending_authenticated_download",
|
| 176 |
+
"privateRemoteCredentialUsed": False,
|
| 177 |
+
}
|
| 178 |
+
result_path.write_text(json.dumps(summary, indent=2) + "\n", encoding="utf-8")
|
| 179 |
print(result_path, flush=True)
|
| 180 |
return 0 if all_passed else 1
|
| 181 |
|
training/run_fable_router_structural_smoke.py
CHANGED
|
@@ -196,8 +196,11 @@ def run(args: argparse.Namespace, result: dict[str, Any]) -> None:
|
|
| 196 |
if not bank_config:
|
| 197 |
raise RuntimeError(f"unknown bank {args.bank}")
|
| 198 |
token = os.environ.get("HF_TOKEN")
|
| 199 |
-
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
result["config"] = {"path": str(config_path), "sha256": sha256(config_path)}
|
| 203 |
result["bank"] = args.bank
|
|
@@ -232,8 +235,12 @@ def run(args: argparse.Namespace, result: dict[str, Any]) -> None:
|
|
| 232 |
result["bankValidation"] = bank_validation.as_dict()
|
| 233 |
|
| 234 |
train_config = curriculum["sftTrain"]
|
| 235 |
-
train_path =
|
| 236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
)
|
| 238 |
result["curriculumArtifact"] = verify_file(
|
| 239 |
train_path, int(train_config["bytes"]), train_config["sha256"]
|
|
@@ -433,6 +440,11 @@ def main() -> int:
|
|
| 433 |
parser.add_argument("--bank", required=True)
|
| 434 |
parser.add_argument("--platform", choices=("colab", "kaggle", "other"), default="other")
|
| 435 |
parser.add_argument("--work-dir", type=Path, default=Path("/content/autonoma-fable-smoke"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
args = parser.parse_args()
|
| 437 |
if not args.owner_execute:
|
| 438 |
raise SystemExit("refusing GPU/model execution without --owner-execute")
|
|
@@ -501,6 +513,12 @@ def main() -> int:
|
|
| 501 |
result["evidenceUpload"] = upload_evidence(output, config["smoke"]["resultRepo"], token)
|
| 502 |
result_path.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
|
| 503 |
upload_final_result(output, config["smoke"]["resultRepo"], token)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 504 |
except BaseException as exc:
|
| 505 |
result["evidenceUpload"] = {"status": "failed", "error": str(exc)}
|
| 506 |
result_path.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
|
|
|
|
| 196 |
if not bank_config:
|
| 197 |
raise RuntimeError(f"unknown bank {args.bank}")
|
| 198 |
token = os.environ.get("HF_TOKEN")
|
| 199 |
+
curriculum_override = getattr(args, "curriculum_path", None)
|
| 200 |
+
if not token and not curriculum_override:
|
| 201 |
+
raise RuntimeError(
|
| 202 |
+
"either HF_TOKEN or --curriculum-path is required for the private curriculum"
|
| 203 |
+
)
|
| 204 |
|
| 205 |
result["config"] = {"path": str(config_path), "sha256": sha256(config_path)}
|
| 206 |
result["bank"] = args.bank
|
|
|
|
| 235 |
result["bankValidation"] = bank_validation.as_dict()
|
| 236 |
|
| 237 |
train_config = curriculum["sftTrain"]
|
| 238 |
+
train_path = (
|
| 239 |
+
Path(curriculum_override).resolve()
|
| 240 |
+
if curriculum_override
|
| 241 |
+
else download(
|
| 242 |
+
curriculum["repo"], curriculum["revision"], train_config["path"], "dataset", token
|
| 243 |
+
)
|
| 244 |
)
|
| 245 |
result["curriculumArtifact"] = verify_file(
|
| 246 |
train_path, int(train_config["bytes"]), train_config["sha256"]
|
|
|
|
| 440 |
parser.add_argument("--bank", required=True)
|
| 441 |
parser.add_argument("--platform", choices=("colab", "kaggle", "other"), default="other")
|
| 442 |
parser.add_argument("--work-dir", type=Path, default=Path("/content/autonoma-fable-smoke"))
|
| 443 |
+
parser.add_argument(
|
| 444 |
+
"--curriculum-path",
|
| 445 |
+
type=Path,
|
| 446 |
+
help="Verified local sft-train.jsonl override for credential-free cloud execution",
|
| 447 |
+
)
|
| 448 |
args = parser.parse_args()
|
| 449 |
if not args.owner_execute:
|
| 450 |
raise SystemExit("refusing GPU/model execution without --owner-execute")
|
|
|
|
| 513 |
result["evidenceUpload"] = upload_evidence(output, config["smoke"]["resultRepo"], token)
|
| 514 |
result_path.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
|
| 515 |
upload_final_result(output, config["smoke"]["resultRepo"], token)
|
| 516 |
+
else:
|
| 517 |
+
result["evidenceUpload"] = {
|
| 518 |
+
"status": "local_only_pending_authenticated_download",
|
| 519 |
+
"privateRemoteCredentialUsed": False,
|
| 520 |
+
}
|
| 521 |
+
result_path.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
|
| 522 |
except BaseException as exc:
|
| 523 |
result["evidenceUpload"] = {"status": "failed", "error": str(exc)}
|
| 524 |
result_path.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
|