Download source/proxy_eval/check.py from rca-umb/five-desks-control: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/datasets/rca-umb/five-desks-control/resolve/main/source/proxy_eval/check.py
- Command line
-
hf download hf://datasets/rca-umb/five-desks-control/source/proxy_eval/check.py
-
curl -L -o check.py https://huggingface.co/datasets/rca-umb/five-desks-control/resolve/main/source/proxy_eval/check.py
1.44 kB
| """Check every proxy family: the scripted oracle scores 1, giving up scores 0, plus family-specific checks. | |
| Usage: .venv/bin/python -m proxy_eval.check [seeds] | |
| """ | |
| import sys | |
| from .tasks import FAMILIES | |
| def play(task, actions): | |
| task.reset() | |
| step = None | |
| for raw in actions: | |
| step = task.step(task.Action.model_validate(raw)) | |
| if step.done: | |
| break | |
| return step | |
| def main(): | |
| seeds = int(sys.argv[1]) if len(sys.argv) > 1 else 10 | |
| failures = 0 | |
| for name, cls in FAMILIES.items(): | |
| for seed in range(seeds): | |
| t = cls(seed) | |
| ok_oracle = (s := play(t, t.oracle())) is not None and s.done and s.reward == 1.0 | |
| ok_quit = play(cls(seed), [cls.finish_action]).reward == 0.0 | |
| extra = True | |
| if name == "software-repofix": # submitting the untouched module must fail | |
| extra = play(cls(seed), [{"tool": "submit"}]).reward == 0.0 | |
| if name == "media-copyedit": # an unedited item must fail | |
| extra = play(cls(seed), [{"command": "submit"}]).reward == 0.0 | |
| if not (ok_oracle and ok_quit and extra): | |
| failures += 1 | |
| print(f"FAIL {name} seed {seed}: oracle={ok_oracle} quit={ok_quit} extra={extra}") | |
| print(f"{name}: checked {seeds} seeds") | |
| print("failures:", failures) | |
| sys.exit(1 if failures else 0) | |
| if __name__ == "__main__": | |
| main() | |