Make dataset audit mandatory for training loop
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -29,3 +32,35 @@ def test_training_command_is_cuda_deterministic_and_bound_to_frozen_inputs(tmp_p
|
||||
assert "seed=42" in command
|
||||
assert "epochs=160" in command
|
||||
assert f"data={tmp_path / 'dataset.yaml'}" in command
|
||||
|
||||
|
||||
def test_loop_refuses_failed_dataset_audit(tmp_path: Path) -> None:
|
||||
audit = tmp_path / "audit.json"
|
||||
audit.write_text(json.dumps({"status": "needs_attention", "low_variance_positive_tile_count": 4}))
|
||||
result = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
str(SCRIPT),
|
||||
"--initial-model",
|
||||
str(tmp_path / "base.pt"),
|
||||
"--train-yaml",
|
||||
str(tmp_path / "dataset.yaml"),
|
||||
"--dataset-audit",
|
||||
str(audit),
|
||||
"--calibration-summary",
|
||||
str(tmp_path / "cal.json"),
|
||||
"--test-summary",
|
||||
str(tmp_path / "test.json"),
|
||||
"--background-summary",
|
||||
str(tmp_path / "background.json"),
|
||||
"--corpus-manifest",
|
||||
str(tmp_path / "manifest.json"),
|
||||
"--output-dir",
|
||||
str(tmp_path / "output"),
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert result.returncode != 0
|
||||
assert "Dataset audit is not ok" in result.stderr
|
||||
|
||||
Reference in New Issue
Block a user