telen / scripts /evaluate_l3_development_pilot.py
haidang2405's picture
Polish TELEN source release and public API
baa1d92 verified
Raw History Blame Contribute Delete
1.65 kB
#!/usr/bin/env python3
"""Evaluate frozen TELEN L3 pilot checkpoints on development events only."""
from __future__ import annotations
import argparse
import json
import sys
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(REPO_ROOT / "src"))
from telen.experiment import BundleValidationError, GateAuthorizationError # noqa: E402
from telen.learned_evaluation import run_l3_development_evaluation # noqa: E402
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description=(
"Evaluate all three frozen L3 development seeds under correct, missing, "
"stale, wrong and unrelated event conditions. Test rows are forbidden."
)
)
parser.add_argument("--manifest", type=Path, required=True)
parser.add_argument("--output", type=Path, required=True)
parser.add_argument("--device", default="cpu")
return parser.parse_args()
def main() -> None:
args = parse_args()
try:
result = run_l3_development_evaluation(
args.manifest, args.output, device=args.device
)
except (GateAuthorizationError, BundleValidationError) as exc:
print(
json.dumps(
{
"artifact_type": "telen_l3_evaluation_refusal",
"authorized": False,
"reason": str(exc),
},
ensure_ascii=False,
indent=2,
)
)
raise SystemExit(2) from exc
print(json.dumps(result, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()