botp
/

File size: 763 Bytes
1d2de8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Keep the user-selected parity workflow free of calibration jobs."""

import importlib.util
from pathlib import Path


def test_parity_keeps_branches_whose_gold_label_is_reserved():
    script = Path(__file__).resolve().parents[1] / "scripts/check_cuda_parity.py"
    spec = importlib.util.spec_from_file_location("parity_checker", script)
    checker = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(checker)
    row = {
        "task": "single",
        "n": 4,
        "head_key": "single/choiceR",
        "gold": 3,
        "letter_logits": [2, 0, 100, 100],
    }
    probabilities = checker.decision_probabilities(row, 1.0)
    assert len(probabilities) == 2
    assert probabilities.argmax() == 0
    assert probabilities[0] > 0.88