File size: 1,647 Bytes
1d842e3
 
 
 
 
 
 
 
 
 
baa1d92
 
1d842e3
baa1d92
 
1d842e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
baa1d92
1d842e3
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/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()