Download code/tests/test_audit_g6_eval_scripts_probe_exit.py from viai957/align: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/viai957/align/resolve/main/code/tests/test_audit_g6_eval_scripts_probe_exit.py
- Command line
-
hf download hf://viai957/align/code/tests/test_audit_g6_eval_scripts_probe_exit.py
-
curl -L -o test_audit_g6_eval_scripts_probe_exit.py https://huggingface.co/viai957/align/resolve/main/code/tests/test_audit_g6_eval_scripts_probe_exit.py
1.54 kB
| """U11-10: --verify-resume-only must exit nonzero when the bitwise resume check FAILED.""" | |
| import importlib.util | |
| import os | |
| import types | |
| REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| def _load(): | |
| spec = importlib.util.spec_from_file_location( | |
| "probe_under_test", os.path.join(REPO, "scripts", "qwen3_sft_probe.py") | |
| ) | |
| m = importlib.util.module_from_spec(spec) | |
| spec.loader.exec_module(m) | |
| return m | |
| def _trainer(verify_passed, stop_exit_code=0): | |
| t = types.SimpleNamespace(stop_exit_code=stop_exit_code) | |
| if verify_passed is not None: | |
| t.verify_passed = verify_passed | |
| return t | |
| def test_failed_verification_is_nonzero(): | |
| p = _load() | |
| assert p.final_exit_code(_trainer(False), verify_only=True, any_rank=bool) == 1 | |
| def test_missing_verdict_is_a_failure_not_a_pass(): | |
| p = _load() | |
| assert p.final_exit_code(_trainer(None), verify_only=True, any_rank=bool) == 1 | |
| def test_passed_verification_and_normal_run_are_zero(): | |
| p = _load() | |
| assert p.final_exit_code(_trainer(True), verify_only=True, any_rank=bool) == 0 | |
| assert p.final_exit_code(_trainer(None, stop_exit_code=0), verify_only=False, any_rank=bool) == 0 | |
| assert p.final_exit_code(_trainer(None, stop_exit_code=82), verify_only=False, any_rank=bool) == 82 | |
| def test_one_failing_rank_fails_every_rank(): | |
| p = _load() | |
| # any_rank stands in for the cross-rank MAX: another rank failed. | |
| assert p.final_exit_code(_trainer(True), verify_only=True, any_rank=lambda local_bad: True) == 1 | |