auto-sync 2026-07-04T05:22:54Z workspace (part 3)
Browse files- workspace/scripts/audit_action_bounds.py +19 -1
- workspace/scripts/audit_chart_feature_sources.py +19 -1
- workspace/scripts/audit_cil_charts.py +19 -1
- workspace/scripts/build_action_scale_vector.py +19 -1
- workspace/scripts/build_data_accounting.py +19 -1
- workspace/scripts/calibrate_dominance.py +19 -1
- workspace/scripts/check_tangent_reconstruction.py +19 -1
- workspace/scripts/eval_chart_positive_memory_proxy.py +27 -1
- workspace/scripts/export_chart_object_embeddings.py +19 -1
- workspace/scripts/export_chart_observation_embeddings.py +19 -1
- workspace/scripts/slurm/reexport_rgb_ref_cil_charts.sbatch +4 -2
workspace/scripts/audit_action_bounds.py
CHANGED
|
@@ -35,6 +35,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 35 |
parser.add_argument("--low", type=float, default=-1.0)
|
| 36 |
parser.add_argument("--high", type=float, default=1.0)
|
| 37 |
parser.add_argument("--tolerance", type=float, default=1.0e-6)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
args = parser.parse_args(argv)
|
| 39 |
|
| 40 |
if args.low >= args.high:
|
|
@@ -85,7 +90,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 85 |
}
|
| 86 |
(out_dir / "metrics.json").write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n")
|
| 87 |
(out_dir / "table.tex").write_text(_latex_table(rows) + "\n")
|
| 88 |
-
(out_dir
|
| 89 |
(out_dir / "eval.log").write_text(
|
| 90 |
"\n".join(f"{row['split']}: {row['num_rows']} rows" for row in rows) + "\n"
|
| 91 |
)
|
|
@@ -430,6 +435,19 @@ def _report(payload: dict[str, Any]) -> str:
|
|
| 430 |
return "\n".join(lines)
|
| 431 |
|
| 432 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 433 |
def _write_provenance(out_dir: Path, args: argparse.Namespace) -> None:
|
| 434 |
config = {key: str(value) for key, value in sorted(vars(args).items())}
|
| 435 |
(out_dir / "config.yaml").write_text(
|
|
|
|
| 35 |
parser.add_argument("--low", type=float, default=-1.0)
|
| 36 |
parser.add_argument("--high", type=float, default=1.0)
|
| 37 |
parser.add_argument("--tolerance", type=float, default=1.0e-6)
|
| 38 |
+
parser.add_argument(
|
| 39 |
+
"--no-markdown-report",
|
| 40 |
+
action="store_true",
|
| 41 |
+
help="Do not write report.md; persistent prose is consolidated in README.md.",
|
| 42 |
+
)
|
| 43 |
args = parser.parse_args(argv)
|
| 44 |
|
| 45 |
if args.low >= args.high:
|
|
|
|
| 90 |
}
|
| 91 |
(out_dir / "metrics.json").write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n")
|
| 92 |
(out_dir / "table.tex").write_text(_latex_table(rows) + "\n")
|
| 93 |
+
_write_markdown_report(out_dir, payload, no_markdown_report=args.no_markdown_report)
|
| 94 |
(out_dir / "eval.log").write_text(
|
| 95 |
"\n".join(f"{row['split']}: {row['num_rows']} rows" for row in rows) + "\n"
|
| 96 |
)
|
|
|
|
| 435 |
return "\n".join(lines)
|
| 436 |
|
| 437 |
|
| 438 |
+
def _write_markdown_report(
|
| 439 |
+
out_dir: Path,
|
| 440 |
+
payload: dict[str, Any],
|
| 441 |
+
*,
|
| 442 |
+
no_markdown_report: bool,
|
| 443 |
+
) -> None:
|
| 444 |
+
report_path = out_dir / "report.md"
|
| 445 |
+
if no_markdown_report:
|
| 446 |
+
report_path.unlink(missing_ok=True)
|
| 447 |
+
return
|
| 448 |
+
report_path.write_text(_report(payload) + "\n")
|
| 449 |
+
|
| 450 |
+
|
| 451 |
def _write_provenance(out_dir: Path, args: argparse.Namespace) -> None:
|
| 452 |
config = {key: str(value) for key, value in sorted(vars(args).items())}
|
| 453 |
(out_dir / "config.yaml").write_text(
|
workspace/scripts/audit_chart_feature_sources.py
CHANGED
|
@@ -34,6 +34,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 34 |
],
|
| 35 |
)
|
| 36 |
parser.add_argument("--out-dir", type=Path, default=Path("runs/chart_feature_audit"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
args = parser.parse_args(argv)
|
| 38 |
|
| 39 |
out_dir = args.out_dir
|
|
@@ -137,7 +142,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 137 |
(out_dir / "metrics_by_task.json").write_text(_metrics_by_task(split_rows) + "\n")
|
| 138 |
(out_dir / "metrics_by_seed.json").write_text("{}\n")
|
| 139 |
(out_dir / "table.tex").write_text(_table(split_rows) + "\n")
|
| 140 |
-
(out_dir
|
| 141 |
(out_dir / "train.log").write_text("not a training run; audited chart feature sources\n")
|
| 142 |
(out_dir / "eval.log").write_text("audited chart feature sources in exported chart indexes\n")
|
| 143 |
print(json.dumps({"out_dir": str(out_dir), "splits": len(split_rows)}, indent=2))
|
|
@@ -244,6 +249,19 @@ def _report(metrics: dict[str, Any]) -> str:
|
|
| 244 |
return "\n".join(lines)
|
| 245 |
|
| 246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
def _write_provenance(out_dir: Path, args: argparse.Namespace) -> None:
|
| 248 |
(out_dir / "config.yaml").write_text(
|
| 249 |
"\n".join(f"{key}: {value}" for key, value in sorted(vars(args).items())) + "\n"
|
|
|
|
| 34 |
],
|
| 35 |
)
|
| 36 |
parser.add_argument("--out-dir", type=Path, default=Path("runs/chart_feature_audit"))
|
| 37 |
+
parser.add_argument(
|
| 38 |
+
"--no-markdown-report",
|
| 39 |
+
action="store_true",
|
| 40 |
+
help="Do not write report.md; persistent prose is consolidated in README.md.",
|
| 41 |
+
)
|
| 42 |
args = parser.parse_args(argv)
|
| 43 |
|
| 44 |
out_dir = args.out_dir
|
|
|
|
| 142 |
(out_dir / "metrics_by_task.json").write_text(_metrics_by_task(split_rows) + "\n")
|
| 143 |
(out_dir / "metrics_by_seed.json").write_text("{}\n")
|
| 144 |
(out_dir / "table.tex").write_text(_table(split_rows) + "\n")
|
| 145 |
+
_write_markdown_report(out_dir, metrics, no_markdown_report=args.no_markdown_report)
|
| 146 |
(out_dir / "train.log").write_text("not a training run; audited chart feature sources\n")
|
| 147 |
(out_dir / "eval.log").write_text("audited chart feature sources in exported chart indexes\n")
|
| 148 |
print(json.dumps({"out_dir": str(out_dir), "splits": len(split_rows)}, indent=2))
|
|
|
|
| 249 |
return "\n".join(lines)
|
| 250 |
|
| 251 |
|
| 252 |
+
def _write_markdown_report(
|
| 253 |
+
out_dir: Path,
|
| 254 |
+
metrics: dict[str, Any],
|
| 255 |
+
*,
|
| 256 |
+
no_markdown_report: bool,
|
| 257 |
+
) -> None:
|
| 258 |
+
report_path = out_dir / "report.md"
|
| 259 |
+
if no_markdown_report:
|
| 260 |
+
report_path.unlink(missing_ok=True)
|
| 261 |
+
return
|
| 262 |
+
report_path.write_text(_report(metrics) + "\n")
|
| 263 |
+
|
| 264 |
+
|
| 265 |
def _write_provenance(out_dir: Path, args: argparse.Namespace) -> None:
|
| 266 |
(out_dir / "config.yaml").write_text(
|
| 267 |
"\n".join(f"{key}: {value}" for key, value in sorted(vars(args).items())) + "\n"
|
workspace/scripts/audit_cil_charts.py
CHANGED
|
@@ -16,6 +16,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 16 |
parser.add_argument("--chart-root", type=Path, default=Path("data/cil_charts"))
|
| 17 |
parser.add_argument("--run-root", type=Path, default=Path("runs"))
|
| 18 |
parser.add_argument("--out-dir", type=Path, default=Path("runs/leakage_audit"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
args = parser.parse_args(argv)
|
| 20 |
|
| 21 |
indexes = _load_indexes(args.chart_root)
|
|
@@ -52,11 +57,24 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 52 |
out_dir = args.out_dir
|
| 53 |
out_dir.mkdir(parents=True, exist_ok=True)
|
| 54 |
(out_dir / "report.json").write_text(json.dumps(report, indent=2, sort_keys=True) + "\n")
|
| 55 |
-
(out_dir
|
| 56 |
print(json.dumps({"status": report["status"], "violations": len(violations)}, indent=2))
|
| 57 |
return 1 if violations else 0
|
| 58 |
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
def _load_indexes(chart_root: Path) -> dict[str, tuple[Path, dict[str, Any]]]:
|
| 61 |
output: dict[str, tuple[Path, dict[str, Any]]] = {}
|
| 62 |
for split in REQUIRED_SPLITS:
|
|
|
|
| 16 |
parser.add_argument("--chart-root", type=Path, default=Path("data/cil_charts"))
|
| 17 |
parser.add_argument("--run-root", type=Path, default=Path("runs"))
|
| 18 |
parser.add_argument("--out-dir", type=Path, default=Path("runs/leakage_audit"))
|
| 19 |
+
parser.add_argument(
|
| 20 |
+
"--no-markdown-report",
|
| 21 |
+
action="store_true",
|
| 22 |
+
help="Do not write report.md; persistent prose is consolidated in README.md.",
|
| 23 |
+
)
|
| 24 |
args = parser.parse_args(argv)
|
| 25 |
|
| 26 |
indexes = _load_indexes(args.chart_root)
|
|
|
|
| 57 |
out_dir = args.out_dir
|
| 58 |
out_dir.mkdir(parents=True, exist_ok=True)
|
| 59 |
(out_dir / "report.json").write_text(json.dumps(report, indent=2, sort_keys=True) + "\n")
|
| 60 |
+
_write_markdown_report(out_dir, report, no_markdown_report=args.no_markdown_report)
|
| 61 |
print(json.dumps({"status": report["status"], "violations": len(violations)}, indent=2))
|
| 62 |
return 1 if violations else 0
|
| 63 |
|
| 64 |
|
| 65 |
+
def _write_markdown_report(
|
| 66 |
+
out_dir: Path,
|
| 67 |
+
report: dict[str, Any],
|
| 68 |
+
*,
|
| 69 |
+
no_markdown_report: bool,
|
| 70 |
+
) -> None:
|
| 71 |
+
report_path = out_dir / "report.md"
|
| 72 |
+
if no_markdown_report:
|
| 73 |
+
report_path.unlink(missing_ok=True)
|
| 74 |
+
return
|
| 75 |
+
report_path.write_text(_markdown(report) + "\n")
|
| 76 |
+
|
| 77 |
+
|
| 78 |
def _load_indexes(chart_root: Path) -> dict[str, tuple[Path, dict[str, Any]]]:
|
| 79 |
output: dict[str, tuple[Path, dict[str, Any]]] = {}
|
| 80 |
for split in REQUIRED_SPLITS:
|
workspace/scripts/build_action_scale_vector.py
CHANGED
|
@@ -54,6 +54,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 54 |
default=1.0,
|
| 55 |
help="Maximum allowed scale value.",
|
| 56 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
args = parser.parse_args(argv)
|
| 58 |
|
| 59 |
if args.floor <= 0.0:
|
|
@@ -133,7 +138,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 133 |
)
|
| 134 |
(out_dir / "eval.log").write_text("no eval; action convention artifact only\n")
|
| 135 |
(out_dir / "table.tex").write_text(_table(payload) + "\n")
|
| 136 |
-
(out_dir
|
| 137 |
print(json.dumps({"out_dir": str(out_dir), "scale_env": payload["scale_env"]}, indent=2))
|
| 138 |
return 0
|
| 139 |
|
|
@@ -178,6 +183,19 @@ def _report(payload: dict[str, Any]) -> str:
|
|
| 178 |
)
|
| 179 |
|
| 180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
def _latex_escape(value: str) -> str:
|
| 182 |
return value.replace("_", "\\_").replace("%", "\\%").replace("&", "\\&")
|
| 183 |
|
|
|
|
| 54 |
default=1.0,
|
| 55 |
help="Maximum allowed scale value.",
|
| 56 |
)
|
| 57 |
+
parser.add_argument(
|
| 58 |
+
"--no-markdown-report",
|
| 59 |
+
action="store_true",
|
| 60 |
+
help="Do not write report.md; persistent prose is consolidated in README.md.",
|
| 61 |
+
)
|
| 62 |
args = parser.parse_args(argv)
|
| 63 |
|
| 64 |
if args.floor <= 0.0:
|
|
|
|
| 138 |
)
|
| 139 |
(out_dir / "eval.log").write_text("no eval; action convention artifact only\n")
|
| 140 |
(out_dir / "table.tex").write_text(_table(payload) + "\n")
|
| 141 |
+
_write_markdown_report(out_dir, payload, no_markdown_report=args.no_markdown_report)
|
| 142 |
print(json.dumps({"out_dir": str(out_dir), "scale_env": payload["scale_env"]}, indent=2))
|
| 143 |
return 0
|
| 144 |
|
|
|
|
| 183 |
)
|
| 184 |
|
| 185 |
|
| 186 |
+
def _write_markdown_report(
|
| 187 |
+
out_dir: Path,
|
| 188 |
+
payload: dict[str, Any],
|
| 189 |
+
*,
|
| 190 |
+
no_markdown_report: bool,
|
| 191 |
+
) -> None:
|
| 192 |
+
report_path = out_dir / "report.md"
|
| 193 |
+
if no_markdown_report:
|
| 194 |
+
report_path.unlink(missing_ok=True)
|
| 195 |
+
return
|
| 196 |
+
report_path.write_text(_report(payload) + "\n")
|
| 197 |
+
|
| 198 |
+
|
| 199 |
def _latex_escape(value: str) -> str:
|
| 200 |
return value.replace("_", "\\_").replace("%", "\\%").replace("&", "\\&")
|
| 201 |
|
workspace/scripts/build_data_accounting.py
CHANGED
|
@@ -35,6 +35,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 35 |
"--base-candidate-types",
|
| 36 |
default=",".join(DEFAULT_BASE_CANDIDATE_TYPES),
|
| 37 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
args = parser.parse_args(argv)
|
| 39 |
|
| 40 |
fractions = _parse_split_fractions(args.split_fractions)
|
|
@@ -103,11 +108,24 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 103 |
out_dir.mkdir(parents=True, exist_ok=True)
|
| 104 |
(out_dir / "table.json").write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n")
|
| 105 |
(out_dir / "table.tex").write_text(_latex_table(materialized) + "\n")
|
| 106 |
-
(out_dir
|
| 107 |
print(json.dumps({"out_dir": str(out_dir), "split_hash": payload["split_hash"]}, indent=2))
|
| 108 |
return 0
|
| 109 |
|
| 110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
def _empty_row(split: str) -> dict[str, Any]:
|
| 112 |
return {
|
| 113 |
"split": split,
|
|
|
|
| 35 |
"--base-candidate-types",
|
| 36 |
default=",".join(DEFAULT_BASE_CANDIDATE_TYPES),
|
| 37 |
)
|
| 38 |
+
parser.add_argument(
|
| 39 |
+
"--no-markdown-report",
|
| 40 |
+
action="store_true",
|
| 41 |
+
help="Do not write report.md; persistent prose is consolidated in README.md.",
|
| 42 |
+
)
|
| 43 |
args = parser.parse_args(argv)
|
| 44 |
|
| 45 |
fractions = _parse_split_fractions(args.split_fractions)
|
|
|
|
| 108 |
out_dir.mkdir(parents=True, exist_ok=True)
|
| 109 |
(out_dir / "table.json").write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n")
|
| 110 |
(out_dir / "table.tex").write_text(_latex_table(materialized) + "\n")
|
| 111 |
+
_write_markdown_report(out_dir, payload, no_markdown_report=args.no_markdown_report)
|
| 112 |
print(json.dumps({"out_dir": str(out_dir), "split_hash": payload["split_hash"]}, indent=2))
|
| 113 |
return 0
|
| 114 |
|
| 115 |
|
| 116 |
+
def _write_markdown_report(
|
| 117 |
+
out_dir: Path,
|
| 118 |
+
payload: dict[str, Any],
|
| 119 |
+
*,
|
| 120 |
+
no_markdown_report: bool,
|
| 121 |
+
) -> None:
|
| 122 |
+
report_path = out_dir / "report.md"
|
| 123 |
+
if no_markdown_report:
|
| 124 |
+
report_path.unlink(missing_ok=True)
|
| 125 |
+
return
|
| 126 |
+
report_path.write_text(_markdown_report(payload) + "\n")
|
| 127 |
+
|
| 128 |
+
|
| 129 |
def _empty_row(split: str) -> dict[str, Any]:
|
| 130 |
return {
|
| 131 |
"split": split,
|
workspace/scripts/calibrate_dominance.py
CHANGED
|
@@ -21,6 +21,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 21 |
parser.add_argument("--input", type=Path, required=True, help="Measured calibration JSON rows.")
|
| 22 |
parser.add_argument("--out-dir", type=Path, default=Path("runs/dominance_calibration"))
|
| 23 |
parser.add_argument("--alpha", type=float, default=0.1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
args = parser.parse_args(argv)
|
| 25 |
if not 0.0 < args.alpha < 1.0:
|
| 26 |
parser.error("--alpha must be in (0, 1)")
|
|
@@ -66,7 +71,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 66 |
(out_dir / "train.log").write_text("fit conformal residual quantile from measured calibration rows\n")
|
| 67 |
(out_dir / "eval.log").write_text("no held-out dominance eval in calibration script\n")
|
| 68 |
(out_dir / "table.tex").write_text(_table(payload) + "\n")
|
| 69 |
-
(out_dir
|
| 70 |
print(json.dumps({"out_dir": str(out_dir), "residual_quantile": quantile}, indent=2))
|
| 71 |
return 0
|
| 72 |
|
|
@@ -125,6 +130,19 @@ def _report(payload: dict[str, Any]) -> str:
|
|
| 125 |
)
|
| 126 |
|
| 127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
def _run(command: list[str]) -> str:
|
| 129 |
try:
|
| 130 |
return subprocess.check_output(command, cwd=PROJECT_ROOT, text=True).strip()
|
|
|
|
| 21 |
parser.add_argument("--input", type=Path, required=True, help="Measured calibration JSON rows.")
|
| 22 |
parser.add_argument("--out-dir", type=Path, default=Path("runs/dominance_calibration"))
|
| 23 |
parser.add_argument("--alpha", type=float, default=0.1)
|
| 24 |
+
parser.add_argument(
|
| 25 |
+
"--no-markdown-report",
|
| 26 |
+
action="store_true",
|
| 27 |
+
help="Do not write report.md; persistent prose is consolidated in README.md.",
|
| 28 |
+
)
|
| 29 |
args = parser.parse_args(argv)
|
| 30 |
if not 0.0 < args.alpha < 1.0:
|
| 31 |
parser.error("--alpha must be in (0, 1)")
|
|
|
|
| 71 |
(out_dir / "train.log").write_text("fit conformal residual quantile from measured calibration rows\n")
|
| 72 |
(out_dir / "eval.log").write_text("no held-out dominance eval in calibration script\n")
|
| 73 |
(out_dir / "table.tex").write_text(_table(payload) + "\n")
|
| 74 |
+
_write_markdown_report(out_dir, payload, no_markdown_report=args.no_markdown_report)
|
| 75 |
print(json.dumps({"out_dir": str(out_dir), "residual_quantile": quantile}, indent=2))
|
| 76 |
return 0
|
| 77 |
|
|
|
|
| 130 |
)
|
| 131 |
|
| 132 |
|
| 133 |
+
def _write_markdown_report(
|
| 134 |
+
out_dir: Path,
|
| 135 |
+
payload: dict[str, Any],
|
| 136 |
+
*,
|
| 137 |
+
no_markdown_report: bool,
|
| 138 |
+
) -> None:
|
| 139 |
+
report_path = out_dir / "report.md"
|
| 140 |
+
if no_markdown_report:
|
| 141 |
+
report_path.unlink(missing_ok=True)
|
| 142 |
+
return
|
| 143 |
+
report_path.write_text(_report(payload) + "\n")
|
| 144 |
+
|
| 145 |
+
|
| 146 |
def _run(command: list[str]) -> str:
|
| 147 |
try:
|
| 148 |
return subprocess.check_output(command, cwd=PROJECT_ROOT, text=True).strip()
|
workspace/scripts/check_tangent_reconstruction.py
CHANGED
|
@@ -31,6 +31,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 31 |
)
|
| 32 |
parser.add_argument("--chart-root", type=Path, default=Path("data/cil_charts"))
|
| 33 |
parser.add_argument("--out-dir", type=Path, default=Path("runs/tangent_reconstruction"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
args = parser.parse_args(argv)
|
| 35 |
|
| 36 |
indexes = args.chart_index or sorted(args.chart_root.glob("*/index.json"))
|
|
@@ -61,7 +66,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 61 |
(out_dir / "train.log").write_text("no training; checked exported tangent summaries\n")
|
| 62 |
(out_dir / "eval.log").write_text(f"checked {len(rows)} rows across {len(indexes)} indexes\n")
|
| 63 |
(out_dir / "table.tex").write_text(_table(summary) + "\n")
|
| 64 |
-
(out_dir
|
| 65 |
print(json.dumps({"out_dir": str(out_dir), **summary}, indent=2))
|
| 66 |
return 0
|
| 67 |
|
|
@@ -167,6 +172,19 @@ def _report(summary: dict[str, Any]) -> str:
|
|
| 167 |
)
|
| 168 |
|
| 169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
def _run(command: list[str]) -> str:
|
| 171 |
try:
|
| 172 |
return subprocess.check_output(command, cwd=PROJECT_ROOT, text=True).strip()
|
|
|
|
| 31 |
)
|
| 32 |
parser.add_argument("--chart-root", type=Path, default=Path("data/cil_charts"))
|
| 33 |
parser.add_argument("--out-dir", type=Path, default=Path("runs/tangent_reconstruction"))
|
| 34 |
+
parser.add_argument(
|
| 35 |
+
"--no-markdown-report",
|
| 36 |
+
action="store_true",
|
| 37 |
+
help="Do not write report.md; persistent prose is consolidated in README.md.",
|
| 38 |
+
)
|
| 39 |
args = parser.parse_args(argv)
|
| 40 |
|
| 41 |
indexes = args.chart_index or sorted(args.chart_root.glob("*/index.json"))
|
|
|
|
| 66 |
(out_dir / "train.log").write_text("no training; checked exported tangent summaries\n")
|
| 67 |
(out_dir / "eval.log").write_text(f"checked {len(rows)} rows across {len(indexes)} indexes\n")
|
| 68 |
(out_dir / "table.tex").write_text(_table(summary) + "\n")
|
| 69 |
+
_write_markdown_report(out_dir, summary, no_markdown_report=args.no_markdown_report)
|
| 70 |
print(json.dumps({"out_dir": str(out_dir), **summary}, indent=2))
|
| 71 |
return 0
|
| 72 |
|
|
|
|
| 172 |
)
|
| 173 |
|
| 174 |
|
| 175 |
+
def _write_markdown_report(
|
| 176 |
+
out_dir: Path,
|
| 177 |
+
summary: dict[str, Any],
|
| 178 |
+
*,
|
| 179 |
+
no_markdown_report: bool,
|
| 180 |
+
) -> None:
|
| 181 |
+
report_path = out_dir / "report.md"
|
| 182 |
+
if no_markdown_report:
|
| 183 |
+
report_path.unlink(missing_ok=True)
|
| 184 |
+
return
|
| 185 |
+
report_path.write_text(_report(summary) + "\n")
|
| 186 |
+
|
| 187 |
+
|
| 188 |
def _run(command: list[str]) -> str:
|
| 189 |
try:
|
| 190 |
return subprocess.check_output(command, cwd=PROJECT_ROOT, text=True).strip()
|
workspace/scripts/eval_chart_positive_memory_proxy.py
CHANGED
|
@@ -47,6 +47,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 47 |
parser.add_argument("--neighbors", type=int, default=8)
|
| 48 |
parser.add_argument("--max-target-charts", type=int, default=100000)
|
| 49 |
parser.add_argument("--thresholds", default="0.20,0.40")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
args = parser.parse_args(argv)
|
| 51 |
|
| 52 |
thresholds = [float(item) for item in args.thresholds.split(",") if item.strip()]
|
|
@@ -129,7 +134,13 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 129 |
+ "\n"
|
| 130 |
)
|
| 131 |
(out_dir / "table.tex").write_text(_table(summary) + "\n")
|
| 132 |
-
(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
print(json.dumps({"out_dir": str(out_dir), "num_rows": len(rows)}, indent=2))
|
| 134 |
return 0
|
| 135 |
|
|
@@ -304,6 +315,21 @@ def _report(method: str, k: int, summary: dict[str, Any]) -> str:
|
|
| 304 |
return "\n".join(lines)
|
| 305 |
|
| 306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
def _latex_escape(value: str) -> str:
|
| 308 |
return value.replace("_", "\\_").replace("%", "\\%").replace("&", "\\&")
|
| 309 |
|
|
|
|
| 47 |
parser.add_argument("--neighbors", type=int, default=8)
|
| 48 |
parser.add_argument("--max-target-charts", type=int, default=100000)
|
| 49 |
parser.add_argument("--thresholds", default="0.20,0.40")
|
| 50 |
+
parser.add_argument(
|
| 51 |
+
"--no-markdown-report",
|
| 52 |
+
action="store_true",
|
| 53 |
+
help="Do not write report.md; persistent prose is consolidated in README.md.",
|
| 54 |
+
)
|
| 55 |
args = parser.parse_args(argv)
|
| 56 |
|
| 57 |
thresholds = [float(item) for item in args.thresholds.split(",") if item.strip()]
|
|
|
|
| 134 |
+ "\n"
|
| 135 |
)
|
| 136 |
(out_dir / "table.tex").write_text(_table(summary) + "\n")
|
| 137 |
+
_write_markdown_report(
|
| 138 |
+
out_dir,
|
| 139 |
+
args.mode,
|
| 140 |
+
args.k,
|
| 141 |
+
summary,
|
| 142 |
+
no_markdown_report=args.no_markdown_report,
|
| 143 |
+
)
|
| 144 |
print(json.dumps({"out_dir": str(out_dir), "num_rows": len(rows)}, indent=2))
|
| 145 |
return 0
|
| 146 |
|
|
|
|
| 315 |
return "\n".join(lines)
|
| 316 |
|
| 317 |
|
| 318 |
+
def _write_markdown_report(
|
| 319 |
+
out_dir: Path,
|
| 320 |
+
method: str,
|
| 321 |
+
k: int,
|
| 322 |
+
summary: dict[str, Any],
|
| 323 |
+
*,
|
| 324 |
+
no_markdown_report: bool,
|
| 325 |
+
) -> None:
|
| 326 |
+
report_path = out_dir / "report.md"
|
| 327 |
+
if no_markdown_report:
|
| 328 |
+
report_path.unlink(missing_ok=True)
|
| 329 |
+
return
|
| 330 |
+
report_path.write_text(_report(method, k, summary) + "\n")
|
| 331 |
+
|
| 332 |
+
|
| 333 |
def _latex_escape(value: str) -> str:
|
| 334 |
return value.replace("_", "\\_").replace("%", "\\%").replace("&", "\\&")
|
| 335 |
|
workspace/scripts/export_chart_object_embeddings.py
CHANGED
|
@@ -46,6 +46,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 46 |
default=Path("runs/chart_object_embeddings_rgb_refs"),
|
| 47 |
)
|
| 48 |
parser.add_argument("--overwrite", action="store_true")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
args = parser.parse_args(argv)
|
| 50 |
|
| 51 |
out_dir = args.out_dir
|
|
@@ -75,7 +80,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 75 |
(out_dir / "metrics_by_task.json").write_text(_metrics_by_task(split_rows) + "\n")
|
| 76 |
(out_dir / "metrics_by_seed.json").write_text("{}\n")
|
| 77 |
(out_dir / "table.tex").write_text(_table(split_rows) + "\n")
|
| 78 |
-
(out_dir
|
| 79 |
(out_dir / "train.log").write_text("not a training run; exported object-layout embeddings\n")
|
| 80 |
(out_dir / "eval.log").write_text(
|
| 81 |
"decoded observation_ref JPEGs only; no outcomes, labels, or hidden branches read\n"
|
|
@@ -348,6 +353,19 @@ def _report(metrics: dict[str, Any]) -> str:
|
|
| 348 |
return "\n".join(lines)
|
| 349 |
|
| 350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
def _write_provenance(out_dir: Path, args: argparse.Namespace) -> None:
|
| 352 |
(out_dir / "config.yaml").write_text(
|
| 353 |
"\n".join(f"{key}: {value}" for key, value in sorted(vars(args).items())) + "\n"
|
|
|
|
| 46 |
default=Path("runs/chart_object_embeddings_rgb_refs"),
|
| 47 |
)
|
| 48 |
parser.add_argument("--overwrite", action="store_true")
|
| 49 |
+
parser.add_argument(
|
| 50 |
+
"--no-markdown-report",
|
| 51 |
+
action="store_true",
|
| 52 |
+
help="Do not write report.md; persistent prose is consolidated in README.md.",
|
| 53 |
+
)
|
| 54 |
args = parser.parse_args(argv)
|
| 55 |
|
| 56 |
out_dir = args.out_dir
|
|
|
|
| 80 |
(out_dir / "metrics_by_task.json").write_text(_metrics_by_task(split_rows) + "\n")
|
| 81 |
(out_dir / "metrics_by_seed.json").write_text("{}\n")
|
| 82 |
(out_dir / "table.tex").write_text(_table(split_rows) + "\n")
|
| 83 |
+
_write_markdown_report(out_dir, metrics, no_markdown_report=args.no_markdown_report)
|
| 84 |
(out_dir / "train.log").write_text("not a training run; exported object-layout embeddings\n")
|
| 85 |
(out_dir / "eval.log").write_text(
|
| 86 |
"decoded observation_ref JPEGs only; no outcomes, labels, or hidden branches read\n"
|
|
|
|
| 353 |
return "\n".join(lines)
|
| 354 |
|
| 355 |
|
| 356 |
+
def _write_markdown_report(
|
| 357 |
+
out_dir: Path,
|
| 358 |
+
metrics: dict[str, Any],
|
| 359 |
+
*,
|
| 360 |
+
no_markdown_report: bool,
|
| 361 |
+
) -> None:
|
| 362 |
+
report_path = out_dir / "report.md"
|
| 363 |
+
if no_markdown_report:
|
| 364 |
+
report_path.unlink(missing_ok=True)
|
| 365 |
+
return
|
| 366 |
+
report_path.write_text(_report(metrics) + "\n")
|
| 367 |
+
|
| 368 |
+
|
| 369 |
def _write_provenance(out_dir: Path, args: argparse.Namespace) -> None:
|
| 370 |
(out_dir / "config.yaml").write_text(
|
| 371 |
"\n".join(f"{key}: {value}" for key, value in sorted(vars(args).items())) + "\n"
|
workspace/scripts/export_chart_observation_embeddings.py
CHANGED
|
@@ -43,6 +43,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 43 |
default=Path("runs/chart_observation_embeddings_rgb_refs"),
|
| 44 |
)
|
| 45 |
parser.add_argument("--overwrite", action="store_true")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
args = parser.parse_args(argv)
|
| 47 |
|
| 48 |
out_dir = args.out_dir
|
|
@@ -76,7 +81,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 76 |
(out_dir / "metrics_by_task.json").write_text(_metrics_by_task(split_rows) + "\n")
|
| 77 |
(out_dir / "metrics_by_seed.json").write_text("{}\n")
|
| 78 |
(out_dir / "table.tex").write_text(_table(split_rows) + "\n")
|
| 79 |
-
(out_dir
|
| 80 |
(out_dir / "train.log").write_text("not a training run; exported observation embeddings\n")
|
| 81 |
(out_dir / "eval.log").write_text("decoded observation_ref JPEGs only; no outcomes read\n")
|
| 82 |
print(json.dumps({"out_dir": str(out_dir), "splits": len(split_rows)}, indent=2))
|
|
@@ -284,6 +289,19 @@ def _report(metrics: dict[str, Any]) -> str:
|
|
| 284 |
return "\n".join(lines)
|
| 285 |
|
| 286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
def _write_provenance(out_dir: Path, args: argparse.Namespace) -> None:
|
| 288 |
(out_dir / "config.yaml").write_text(
|
| 289 |
"\n".join(f"{key}: {value}" for key, value in sorted(vars(args).items())) + "\n"
|
|
|
|
| 43 |
default=Path("runs/chart_observation_embeddings_rgb_refs"),
|
| 44 |
)
|
| 45 |
parser.add_argument("--overwrite", action="store_true")
|
| 46 |
+
parser.add_argument(
|
| 47 |
+
"--no-markdown-report",
|
| 48 |
+
action="store_true",
|
| 49 |
+
help="Do not write report.md; persistent prose is consolidated in README.md.",
|
| 50 |
+
)
|
| 51 |
args = parser.parse_args(argv)
|
| 52 |
|
| 53 |
out_dir = args.out_dir
|
|
|
|
| 81 |
(out_dir / "metrics_by_task.json").write_text(_metrics_by_task(split_rows) + "\n")
|
| 82 |
(out_dir / "metrics_by_seed.json").write_text("{}\n")
|
| 83 |
(out_dir / "table.tex").write_text(_table(split_rows) + "\n")
|
| 84 |
+
_write_markdown_report(out_dir, metrics, no_markdown_report=args.no_markdown_report)
|
| 85 |
(out_dir / "train.log").write_text("not a training run; exported observation embeddings\n")
|
| 86 |
(out_dir / "eval.log").write_text("decoded observation_ref JPEGs only; no outcomes read\n")
|
| 87 |
print(json.dumps({"out_dir": str(out_dir), "splits": len(split_rows)}, indent=2))
|
|
|
|
| 289 |
return "\n".join(lines)
|
| 290 |
|
| 291 |
|
| 292 |
+
def _write_markdown_report(
|
| 293 |
+
out_dir: Path,
|
| 294 |
+
metrics: dict[str, Any],
|
| 295 |
+
*,
|
| 296 |
+
no_markdown_report: bool,
|
| 297 |
+
) -> None:
|
| 298 |
+
report_path = out_dir / "report.md"
|
| 299 |
+
if no_markdown_report:
|
| 300 |
+
report_path.unlink(missing_ok=True)
|
| 301 |
+
return
|
| 302 |
+
report_path.write_text(_report(metrics) + "\n")
|
| 303 |
+
|
| 304 |
+
|
| 305 |
def _write_provenance(out_dir: Path, args: argparse.Namespace) -> None:
|
| 306 |
(out_dir / "config.yaml").write_text(
|
| 307 |
"\n".join(f"{key}: {value}" for key, value in sorted(vars(args).items())) + "\n"
|
workspace/scripts/slurm/reexport_rgb_ref_cil_charts.sbatch
CHANGED
|
@@ -51,8 +51,10 @@ common_args=(
|
|
| 51 |
|
| 52 |
"$PYTHON" scripts/audit_cil_charts.py \
|
| 53 |
--chart-root "$OUT_ROOT" \
|
| 54 |
-
--out-dir runs/leakage_audit_rgb_refs
|
|
|
|
| 55 |
|
| 56 |
"$PYTHON" scripts/audit_chart_feature_sources.py \
|
| 57 |
--indexes "$OUT_ROOT/train/index.json" "$OUT_ROOT/val/index.json" "$OUT_ROOT/test/index.json" \
|
| 58 |
-
--out-dir runs/chart_feature_audit_rgb_refs
|
|
|
|
|
|
| 51 |
|
| 52 |
"$PYTHON" scripts/audit_cil_charts.py \
|
| 53 |
--chart-root "$OUT_ROOT" \
|
| 54 |
+
--out-dir runs/leakage_audit_rgb_refs \
|
| 55 |
+
--no-markdown-report
|
| 56 |
|
| 57 |
"$PYTHON" scripts/audit_chart_feature_sources.py \
|
| 58 |
--indexes "$OUT_ROOT/train/index.json" "$OUT_ROOT/val/index.json" "$OUT_ROOT/test/index.json" \
|
| 59 |
+
--out-dir runs/chart_feature_audit_rgb_refs \
|
| 60 |
+
--no-markdown-report
|