botp
/

Solomon / mlx /tests /test_parity.py
orz99's picture ArcherHume's picture
Duplicate from DoccyHealth/Solomon
1d2de8a
Raw History Blame Contribute Delete
763 Bytes
"""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