Download eval/regression.py from sage002/sage: direct link, hf CLI and curl.
- Browser
- Download file 603 Bytes
-
https://huggingface.co/sage002/sage/resolve/main/eval/regression.py
- Command line
-
hf download hf://sage002/sage/eval/regression.py
-
curl -L -o regression.py https://huggingface.co/sage002/sage/resolve/main/eval/regression.py
603 Bytes
| """Checkpoint-to-checkpoint regression checks.""" | |
| from __future__ import annotations | |
| def compare_metrics(previous: dict[str, float], current: dict[str, float], threshold: float = 0.005) -> dict[str, object]: | |
| """Flag metric drops larger than the configured threshold.""" | |
| regressions: list[str] = [] | |
| for key, prev_value in previous.items(): | |
| curr_value = current.get(key) | |
| if curr_value is None: | |
| continue | |
| if curr_value < prev_value * (1.0 - threshold): | |
| regressions.append(key) | |
| return {"regressions": regressions, "passed": not regressions} | |