Download tests/test_evaluation_gate.py from Infinity08/KAWK50M-Project: direct link, hf CLI and curl.
- Browser
- Download file 876 Bytes
-
https://huggingface.co/datasets/Infinity08/KAWK50M-Project/resolve/main/tests/test_evaluation_gate.py
- Command line
-
hf download hf://datasets/Infinity08/KAWK50M-Project/tests/test_evaluation_gate.py
-
curl -L -o test_evaluation_gate.py https://huggingface.co/datasets/Infinity08/KAWK50M-Project/resolve/main/tests/test_evaluation_gate.py
876 Bytes
| import pytest | |
| from scripts.check_evaluation_gate import gate_result | |
| def test_evaluation_gate_requires_real_improvement_and_samples() -> None: | |
| baseline = {"validation_loss": 3.2, "samples": [{"continuation": "기준"}]} | |
| candidate = {"validation_loss": 3.0, "samples": [{"continuation": "개선"}]} | |
| result = gate_result( | |
| candidate, | |
| baseline=baseline, | |
| max_loss=3.1, | |
| min_improvement=0.1, | |
| ) | |
| assert result["passed"] is True | |
| assert result["loss_improvement"] == pytest.approx(0.2) | |
| with pytest.raises(ValueError, match="below required"): | |
| gate_result( | |
| {"validation_loss": 3.15, "samples": [{}]}, | |
| baseline=baseline, | |
| min_improvement=0.1, | |
| ) | |
| with pytest.raises(ValueError, match="no generation samples"): | |
| gate_result({"validation_loss": 3.0, "samples": []}) | |